In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2024-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces in detail "how to install and configure Memcache in the Linux server". The content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to install and configure Memcache in the Linux server" can help you solve your doubts.
1. Install libevent first. When configuring this thing, you need to specify an installation path, that is,. / configure-prefix=/usr; and then make; and then make install
two。 To install memcached, you just need to specify the installation path of libevent, that is,. / configure-with-libevent=/usr;, then make; and then make install.
This completes the installation of the memcache server under linux. The detailed methods are as follows:
1. Download memcached and libevent respectively and put them in the / tmp directory:
The copy code is as follows:
# cd / tmp
# wget http://www.3ppt.com/memcached/dist/memcached-1.2.0.tar.gz
# wget http://www.monkey.org/~provos/libevent-1.2.tar.gz
two。 Install libevent first:
# tar zxvf libevent-1.2.tar.gz
# cd libevent-1.2
#. / configure-prefix=/usr
# make
# make install
(note: an error occurred while executing here:
1no acceptable c compiler found in $path
Since centos does not have gcc installed by default, install it using yum
# yum install gcc* make*
)
3. Test whether libevent is installed successfully:
The copy code is as follows:
# ls-al / usr/lib | grep libevent
Lrwxrwxrwx 1 root root 21 11? 12 17:38 libevent-1.2.so.1-> libevent-1.2.so.1.0.3
-rwxr-xr-x 1 root root 263546 11 hours? 12 17:38 libevent-1.2.so.1.0.3
-rw-r-r- 1 root root 454156 11 hours? 12 17:38 libevent.a
-rwxr-xr-x 1 root root 811 11 11? 12 17:38 libevent.la
Lrwxrwxrwx 1 root root 21 11? 12 17:38 libevent.so-> libevent-1.2.so.1.0.3
It's not bad. It's all installed.
4. To install memcached, you need to specify the installation location of libevent in the installation:
The copy code is as follows:
# cd / tmp
# tar zxvf memcached-1.2.0.tar.gz
# cd memcached-1.2.0
#. / configure-with-libevent=/usr
# make
# make install
If there is an error in the middle, please check the error message carefully and configure or add the corresponding library or path according to the error message.
(note: an error occurred during installation:
1 linux warning: clock error detected. Your creation may be incomplete
Solution:
Modify the current time:
[root] # date-s' 8:01:00 on 2010-11-5'
Write the current system time to cmos
# clock-w
)
Memcached will be placed in / usr/local/bin/memcached after the installation is completed.
5. Test if memcached is installed successfully:
The copy code is as follows:
# ls-al/ usr/local/bin/mem*
-rwxr-xr-x 1 root root 137986 11 hours? 12 17:39 / usr/local/bin/memcached
-rwxr-xr-x 1 root root 140179 11 hours? 12 17:39 / usr/local/bin/memcached-debug
Install the php tutorial extension for memcache
1. Select the memcache version you want to download at http://pecl.php.net/package/memcache.
two。 Install the memcache extension for php
The copy code is as follows:
Tar vxzf memcache-2.2.1.tgz
Cd memcache-2.2.1
/ usr/local/php/bin/phpize
. / configure-enable-memcache-with-php-config=/usr/local/php/bin/php-config-with-zlib-dir
Make
Make install
(note:
1 phpize not found
Solution:
Centos does not have php-devel installed by default.
Yum install php-devel
2 make: * * [memcache.lo] error 1
Zlib is not installed
Yum install zlib-devel
3 the command for configuration is changed to:. / configure-- enable-memcache-- with-php-config=/usr/bin/php-config-- with-zlib-dir
In front of enable and with are two--
)
3. There will be a prompt similar to this after the above installation:
Installing shared extensions: / usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/
4. Change extension_dir = ". /" in php.ini to
Extension_dir = "/ usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/"
5. Add a line to load the memcache extension: extension=memcache.so
Basic settings for memcached:
1. Start the server side of memcache:
# / usr/local/bin/memcached-d-m 10-u root-l 192.168.0.200-p 12000-c 256-p / tmp/memcached.pid
The-d option is to start a daemon
-m is the amount of memory allocated to memcache in mb, and this is 10mb.
-u is the user running memcache. This is root.
-l is the ip address of the listening server. If there are multiple addresses, I specify the ip address of the server 192.168.0.200.
-p is the port on which memcache snooping is set. I have set 12000 here, preferably a port above 1024.
The-c option is the maximum number of concurrent connections running. The default is 1024. I set it here according to the load of your server.
-p is the pid file that is set to save memcache. Here I save it in / tmp/memcached.pid
(note:
one
Error: / usr/local/bin/memcached: error while loading shared libraries: libevent-1.3.so.1: cannot open shared object file: no such file or directory
Set links directly
# ln-s / usr/local/libevent/lib/libevent-1.3.so.1 / lib64/libevent-1.3.so.1
)
two。 To end the memcache process, execute:
# kill `cat / tmp/ Memcached.pid`
Multiple daemons can also be started, but the ports cannot be duplicated.
3. Restart apache,service httpd restart
Memcache environment testing:
Run the following php file, and if there is an output of this is a testing, it means that the environment has been built successfully. Start to appreciate the charm of memcache!
The copy code is as follows:
< ?php $mem = new memcache; $mem->Connect (192.168.0.200 ", 12000)
$mem- > set ('key',' this is a testboxes, 0,60)
$val = $mem- > get ('key')
Echo $val
? >
After reading this, the article "how to install and configure Memcache in Linux server" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself. If you want to know more about the article, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.