Installation of Memcache server under Linux

Source: Internet
Author: User

 LinuxunderMemcacheinstallation of the server Environmental Requirements:

Installing memcached requires Libevent library support, so check to see if Libevent is installed before installing memcached. The test environment also requires PHP support, and this article assumes that PHP is already installed in the/usr/local/php directory.

Server side is mainly installed Memcache server side, Memcache use libevent this library for socket processing, so also need to install libevent.

memcached : http://www.danga.com/memcached/

libevent : http://monkey.org/~provos/libevent/

Installation configuration:

Download libevent:

Mkdir/home/oldboy/tools-p
cd/home/oldboy/tools/
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz

Install Libevent:

Tar zxf libevent-1.4.13-stable.tar.gz

CD libevent-1.4.13-stable

./configure –-prefix=/usr ; echo $?

Make && make install; echo $?

Cd..

Check if the libevent is installed successfully:

[Email protected] tools]# ls-al/usr/lib |grep libevent

lrwxrwxrwx 1 root root 10:00libevent-1.4.so.2-libevent-1.4.so.2.1.3

-rwxr-xr-x 1 root root 373222 Feb libevent-1.4.so.2.1.3

-rw-r--r--1 root root 604082 Feb libevent.a

-rwxr-xr-x 1 root root 831 Feb 10:00libevent.la

lrwxrwxrwx 1 root root 10:00libevent.so-libevent-1.4.so.2.1.3

lrwxrwxrwx 1 root root 10:00libevent_core-1.4.so.2-libevent_core-1.4.so.2.1.3

-rwxr-xr-x 1 root root 137345 Feb libevent_core-1.4.so.2.1.3

-rw-r--r--1 root root 229088 Feb libevent_core.a

-rwxr-xr-x 1 root root 866 Feb 10:00libevent_core.la

lrwxrwxrwx 1 root root 10:00libevent_core.so-libevent_core-1.4.so.2.1.3

lrwxrwxrwx 1 root root 10:00libevent_extra-1.4.so.2-libevent_extra-1.4.so.2.1.3

-rwxr-xr-x 1 root root 295876 Feb libevent_extra-1.4.so.2.1.3

-rw-r--r--1 root root 469194 Feb libevent_extra.a

-rwxr-xr-x 1 root root 873 Feb 10:00libevent_extra.la

lrwxrwxrwx 1 root root 10:00libevent_extra.so-libevent_extra-1.4.so.2.1.3

Download the installation memcached and specify the location of the libevent:

Cd/home/oldboy/tools

wget http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz

Tar zxf memcached-1.4.13.tar.gz

CD memcached-1.4.13

./configure --with-libevent=/usr ; echo $?

Make && make install; echo $?

Cd..

After the installation is complete, the mencached will be found in the/usr/local/bin/directory

[Email protected] tools]# ls-al/usr/local/bin/

Total 33548

Drwxr-xr-x. 2 root root 4096 Feb 20 10:02.

Drwxr-xr-x. Root root 4096 Feb 19 13:31.

-rwxr-xr-x. 1 root root 7975624 Feb ccmake

-rwxr-xr-x. 1 root root 7860667 Feb cmake

-rwxr-xr-x. 1 root root 8421359 Feb cpack

-rwxr-xr-x. 1 root root 9779615 Feb 11:01 ctest

-rwxr-xr-x 1 root root 297114 Feb 10:02 memcached

Start:

[Email protected] tools]# memcached-p 11211-u root-m 16m-c 10240-p/var/run/memcached_11211.pid-d

[Email protected] tools]# memcached-p 11212-u root-m 16m-c 10240-p/var/run/memcached_11212.pid-d

[Email protected] tools]# lsof-i:11211

COMMAND PID USER FD TYPE DEVICE size/off NODE NAME

memcached 14960 root 26u IPv4 19716 0t0 TCP *:memcache (LISTEN)

memcached 14960 root 27u IPv6 19717 0t0 TCP *:memcache (LISTEN)

memcached 14960 root 28u IPv4 19720 0t0 UDP *:memcache

memcached 14960 root 29u IPv6 19721 0t0 UDP *:memcache

[Email protected] tools]# lsof-i:11212

COMMAND PID USER FD TYPE DEVICE size/off NODE NAME

memcached 14967 root 26u IPv4 19743 0t0 TCP *:11212 (LISTEN)

memcached 14967 root 27u IPv6 19744 0t0 TCP *:11212 (LISTEN)

memcached 14967 root 28u IPv4 19747 0t0 UDP *:11212

memcached 14967 root 29u IPv6 19748 0t0 UDP *:11212

such as:/usr/local/bin/memcached-d-M 200-u root-l 192.168.1.91-p 12000-c1000-p/tmp/memcached.pid

The relevant explanations are as follows:
The-D option is to start a daemon,
-M is the amount of memory allocated to Memcache, in megabytes, 200MB
-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 IP address of the server 192.168.1.91
-P is the port that sets Memcache listening, I set here 12000, preferably more than 1024 ports
The-c option is the maximum number of concurrent connections to run, the default is 1024, and I set the 1000
-P is set to save memcache PID file, I am here to save in/tmp/memcached.pid

To stop the memcache process:

Kill ' Cat /tmp/memcached.pid'

Add to boot:

Cat >>/etc/rc.local<<eof

#memcached start along with SYS by Lisp

Memcached-p 11211-u root-m 16m-c 10240-p/var/run/memcached_11211.pid-d

Memcached-p 11212-u root-m 16m-c 10240-p/var/run/memcached_11212.pid-d

Eof


This article is from the "sword" blog, make sure to keep this source http://sword86.blog.51cto.com/731862/1533826

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.