Installing the memcached service on Linux

Source: Internet
Author: User
Tags memcached

Download and install the Memcache server-side server-side mainly installs the Memcache server side. Download: http://www.danga.com/memcached/dist/memcached-1.2.2.tar.gz In addition, Memcache used the libevent this library for socket processing, So you also need to install the latest version of Libevent,libevent is libevent-1.3. (If your system already has libevent installed, can not install) official website: http://www.monkey.org/~provos/libevent/Download: http://www.monkey.org/~provos/ Libevent-1.3.tar.gz

Download these two items directly with the wget command. After downloading back to the source file. 1. Install Libevent first. This thing needs to be configured with an installation path, i.e../configure–prefix=/usr; then make; then make install; 2. Install the memcached, just need to specify the installation path of libevent when configuring. CONFIGURE–WITH-LIBEVENT=/USR, then make, and make install, which completes the installation of Linux under the Memcache server side. The detailed methods are as follows:

1. Download memcached and libevent back to the/tmp directory: # cd/tmp # wget http://www.danga.com/memcached/dist/memcached-1.2.0.tar.gz # wget http://www.monkey.org/~provos/libevent-1.2.tar.gz

2. First install Libevent: # tar zxvf libevent-1.2.tar.gz # cd libevent-1.2 #./CONFIGURE–PREFIX=/USR # make # make Install

3. Test whether the Libevent is installed successfully: # Ls-al/usr/lib | grep libevent lrwxrwxrwx 1 root root 21 11?? 17:38 Libevent-1.2.so.1-libevent-1.2.so.1.0.3-rwxr-xr-x 1 root root 263546 11?? 17:38 libevent-1.2.so.1.0.3-rw-r–r–1 root root 454156 11?? 17:38 libevent.a-rwxr-xr-x 1 root root 811 11?? 17:38 libevent.la lrwxrwxrwx 1 root root 21 11?? 17:38 libevent.so-libevent-1.2.so.1.0.3 is also good, all installed.

4. Install memcached, also need to install the installation location of the specified libevent: # cd/tmp # tar zxvf memcached-1.2.0.tar.gz # cd memcached-1.2.0 #./configure–with -LIBEVENT=/USR # make # do install if there is an error in the middle, please double check the errors and follow the error message to configure or add the appropriate libraries or paths. When the installation is complete, the memcached will be put into/usr/local/bin/memcached,

5. Test for successful installation memcached: # ls-al/usr/local/bin/mem*-rwxr-xr-x 1 root root 137986 11?? 17:39/usr/local/bin/memcached-rwxr-xr-x 1 root root 140179 11?? 17:39/usr/local/bin/memcached-debug

start memcached service : 1. Start the Memcache server side: #/usr/local/bin/memcached-d-M 10-u root-l 192.168.141.64-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, the unit is MB, I here is 10MB,-U is the user running memcache, I here is root,-L is the server IP address of the listener, if there are multiple addresses, I specify the IP address of the server 192.168.0.200,-p is set memcache listening port, I set up here 12000, preferably more than 1024 ports, the-C option is the maximum number of concurrent connections running, the default is 1024, I set up here 256, According to your server load amount to set,-P is set to save memcache pid file, I here is saved in/tmp/memcached.pid,

2. If you want to end the memcache process, execute:

# Kill ' Cat/tmp/memcached.pid '

You can also start multiple daemons, but the ports cannot be duplicated.

Test memcached:

[[Email protected]/]#Telnet192.168.141.6412000Trying192.168.141.64...Connected to192.168.141.64  (192.168. 141.64 escape character is  ' ^] '

This memcached installation is successful!

Problems:

1. If you encounter a memcached service when you start the

/usr/local/bin/memcached:error while loading shared libraries:libevent-1.2.so.1:cannot open shared object File:no such file or directory;

Solution:

[[email protected] bin]#Ld_debug=Libs memcached-v [[email protected] bin]#Ln-s/Usr/Lib/libevent-1.2.So.1/Usr/Lib64/libevent-1.2.So.1[[email protected] bin]# /usr/ Local/bin/memcached -d -m 100  -u root -p 12000 -c < Span style= "COLOR: #000000" >1000 -p /tmp/memcached. pid [[Email protected] bin]# ps -aux

You can see the memcached service started.

2. Load the memcached service into the Linux startup item. In case the machine loses power, the system restarts. Then memcached will start automatically.

If the command to start Memcache server is: #/usr/local/bin/memcached-d-M 10-u root-l 192.168.141.64-p 12000-c 256-p/tmp/memcached.pid capacity from 17jquery

If you want to boot automatically start, just add a line in/etc/rc.d/rc.local, the following command/usr/local/memcached/bin/memcached-d-M 10-p 12000-u apache-c 256 above some things can be Test: That is, IP is not specified, the default is native, User: The best choice is: Apache or Deamon This, that is, which user's service, which user started.

Installing the memcached service on Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.