Install memcached in linux

Source: Internet
Author: User
1. download memcached and libevent to the/tmp Directory: # cd/tmp # sudowgethttp: // container /~ Provos/libevent-

 

1. download memcached and libevent respectively and put them in the/tmp Directory:

# Cd/tmp

# Sudo wget http://www.danga.com/memcached/dist/memcached-1.2.0.tar.gz

# Sudo wget http://www.monkey.org /~ Provos/libevent-1.2.tar.gz

2. install libevent first:

# Tar zxvf libevent-1.2.tar.gz

# Cd libevent-1.2

#./Configure-prefix =/usr // if an error occurs, install gcc and run sudo apt-get install gcc.

# Make // if an error occurs, install make by executing sudo apt-get install make.

# Sudo make install

3. test whether the libevent is successfully installed:

# Ls-al/usr/lib | grep libevent

Lrwxrwxrwx 1 root 21 11 ?? Libevent-1.2.so.1> libevent-1.2.so.1.0.3

-Rwxr-xr-x 1 root 263546 11 ?? Libevent-1.2.so.1.0.3

-Rw-r-1 root 454156 11 ?? 12 libevent.

-Rwxr-xr-x 1 root 811 11 ?? Libevent. la

Lrwxrwxrwx 1 root 21 11 ?? 12 libevent. so-> libevent-1.2.so.1.0.3

Indicates that the installation is successful.

4. install memcached and specify the libevent installation location during installation:

# Cd/tmp

# Tar zxvf memcached-1.2.0.tar.gz

# Cd memcached-1.2.0

#./Configure-with-libevent =/usr

# Make

# Sudo make install

5. test whether memcached is successfully installed:

# Ls-al/usr/local/bin/mem *

-Rwxr-xr-x 1 root 137986 11 ?? 12 :39/usr/local/bin/memcached

-Rwxr-xr-x 1 root 140179 11 ?? 12 :39/usr/local/bin/memcached-debug

6. start the Memcache server:

#/Usr/local/bin/memcached-d-m 10-u root-l 192.168.1.100-p 12000-c 256-P/tmp/memcached. pid

-D option is to start a daemon,

-M indicates the amount of memory allocated to Memcache. the unit is MB. here I am 10 MB,

-U is the user who runs Memcache. here I am root,

-L is the IP address of the listening server. if there are multiple IP addresses, I have specified the IP address 192.168.0.200,

-P is the port for Memcache listening. I have set Port 12000 here, preferably port 1024 or above,

-The "c" option is the maximum number of concurrent connections. the default value is 1024. I have set 256 here, which is based on the load of your server,

-P is the pid file for saving Memcache. here I save it in/tmp/memcached. pid,

To end the Memcache process, run:

# Kill 'cat/tmp/memcached. Pi'

7. test Memcached:

[Root @ localhost/] # telnet 192.168.141.64 12000.

Trying 192.168.141.64...

Connected to 192.168.141.64 (192.168.141.64 ).

Escape character is '^]'.

After the preceding characters are displayed, type:

Set key1 0 60 4

Zhou

STORED

Get key1

VALUE key1 0 4

Zhou

END

So far, Memcached has been installed successfully!

8. to enable automatic startup, add a line to/etc/rc. d/rc. local. the following command

/Usr/local/memcached/bin/memcached-d-m 10-p 12000-u apache-c 256

Some of the above can be referred to: that is, when the ip address is not specified, the default is local. User: the best choice is apache or deamon.

In this way, it is the service of the user and the user who starts the service.

 

Author wuneng94zui

Related Article

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.