Linux download and install Memcache server side

Source: Internet
Author: User

1. Download and install the Memcache server side

Server side is mainly installed 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, you can not install it)
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. Then install memcached, just need to specify the installation path of libevent when configuring the./configure–with-libevent=/usr; then make; then make install;

This completes the installation of Linux under the Memcache server side. The detailed methods are as follows:

1. Download the memcached and libevent back to the ~/tools directory, respectively:

Wget-c http://www.danga.com/memcached/dist/memcached-1.2.7.tar.gz-C http:// www.monkey.org/~provos/libevent-1.2.tar.gz

2. Install Libevent First:
tar zxvf libevent-1.2. Tar . GZCD libevent-1.2. /make makeinstall

3. Test whether the Libevent is installed successfully:
[Email protected] libevent-1.2]#ls-al/usr/local/lib |greplibeventlrwxrwxrwx1Root root +Oct6  -: -libevent-1.2. So.1libevent-1.2. So.1.0.3-rwxr-xr-x1Root root264048Oct6  -: -libevent-1.2. So.1.0.3-rw-r--r--1Root root430332Oct6  -: -libevent.a-rwxr-xr-x1Root root811Oct6  -: -libevent.lalrwxrwxrwx1Root root +Oct6  -: -Libevent.so-libevent-1.2. So.1.0.3

Good, all installed.

4. Install the memcached and require the installation location of the specified libevent in the installation:
CD ~/tools/tar zxvf memcached-1.2. 7. Tar . GZCD memcached-1.2. 7 . /make makeinstall

If there is an error in the middle, please carefully check the errors, follow the error message to configure or add the appropriate library or path.
When the installation is complete, the memcached will be put into/usr/local/bin/memcached,

5. Test whether the memcached is installed successfully:
[Email protected] memcached-1.2. 7 ls 1 159851 Oct  6:/usr/local/bin/ memcached1  165557 Oct  6:/usr/local/bin/memcached-debug

To start the memcached service :


1. Start the server side of the memcache:


#/usr/local/bin/memcached-d-M 100-u root-l 127.0.0.1-p 11211-c 256-p/tmp/memcached.pid

The-D option is to start a daemon,
-M is the amount of memory allocated to Memcache, in megabytes, I'm 10MB,
-U is the user running memcache, I am root here,
-L is the server IP address of the listener, if there are multiple addresses, I specify the server IP address 127.0.0.1,
-P is the port that sets Memcache listening, I set here 11211, preferably more than 1024 ports,
The-c option is the maximum number of concurrent connections to run, the default is 1024, I set the 256 here, according to the load of your server to set,
-P is set to save memcache PID file, I am here to save 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.

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:

#LD_DEBUG =libs memcached-v #Ln -s/usr/local/lib/libevent-1.2. So. 1 /usr/lib64/libevent-1.2. 1 #  - 127.0. 0.1 11211  -p/tmp/memcached.pid

Debug

[Email protected] memcached-1.2.7]#/usr/local/bin/memcached-d-M --U root-l127.0.0.1-P11211-C the-p/tmp/Memcached.pid/usr/local/bin/memcached:error whileLoading shared libraries:libevent-1.2. So.1: Cannot open sharedObject file: No Suchfileor Directory[[email protected] memcached-1.2.7]# ld_debug=libs memcached-v28604:Findlibrary=libevent-1.2. So.1[0]; Searching28604: Search cache=/etc/LD. So.cache28604: Search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/ x86_64:/usr/lib64 (System search Path)28604: Tryingfile=/lib64/tls/x86_64/libevent-1.2. So.1     28604: Tryingfile=/lib64/tls/libevent-1.2. So.1     28604: Tryingfile=/lib64/x86_64/libevent-1.2. So.1     28604: Tryingfile=/lib64/libevent-1.2. So.1     28604: Tryingfile=/usr/lib64/tls/x86_64/libevent-1.2. So.1     28604: Tryingfile=/usr/lib64/tls/libevent-1.2. So.1     28604: Tryingfile=/usr/lib64/x86_64/libevent-1.2. So.1     28604: Tryingfile=/usr/lib64/libevent-1.2. So.1     28604: Memcached:error whileLoading shared libraries:libevent-1.2. So.1: Cannot open sharedObject file: No Suchfileor Directory[[email protected] memcached-1.2.7]#LN-s/usr/local/Liblib/lib64/libexec/[email protected] memcached-1.2.7]#LN-s/usr/local/Liblib/lib64/libexec/[email protected] memcached-1.2.7]#LN-s/usr/local/lib/libevent-1.2. So.1/usr/lib64/libevent-1.2. So.1[email protected] memcached-1.2.7]#/usr/local/bin/memcached-d-M --U root-l127.0.0.1-P11211-C the-p/tmp/Memcached.pid[[email protected] memcached-1.2.7]#

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 server-side command to start Memcache is:

Ten 192.168. 141.64 12000  -p/tmp/memcached.pid

If you want to start the boot automatically, just add a line in the/etc/rc.d/rc.local, the following command

Ten 12000  the


Here are some things to consider:

That is, when IP is not specified, the default is native, User: Best choice: Apache or Deamon
This is the service that belongs to which user and which user starts it.

Transferred from: http://www.cnblogs.com/zgx/archive/2011/08/10/2134097.html

Linux download and install Memcache server side

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.