Install and start memcached in Linux

Source: Internet
Author: User
Install and start memcached in Linux

Original post address: http://dapeng725.blog.sohu.com/136682788.html

Download libevent and memcached
WgetHttp://www.danga.com/memcached/dist/Memcached-1.4.0.tar.gz
Wget http://www.monkey.org /~ Provos/libevent-1.2.tar.gz

Unpack

CD/usr/local
Tar-xzvf libevent-1.4.tar.gz
Tar-xzvf memcached-1.2.5.tar.gz

Handle libevent
CD/usr/local/libevent-1.2/
./Configure -- prefix =/usr/local/libevent
Make
Make install

Process memcached
CD/usr/local/memcached-1.2.5/
./Configure -- prefix =/usr/local/memcached -- With-libevent =/usr/local/libevent
Make
Make install

Ll/usr/local/libevent/lib/
A file similar to the following exists:
Libevent-1.4.so.1> libevent-1.4.so.1.0.3
Libevent-1.4.so.1.0.3
Libevent.
Libevent. La
Libevent. So-> libevent-1.4.so.1.0.3

Add memcached lib
Use ld_debug = libs bin/memcached-V to determine lib

32-bit Server
Ln-S/usr/local/libevent/lib/libevent-1.4.so.1/usr/lib
Ln-S/usr/local/libevent/lib/libevent-1.4.so.2/usr/lib

64-bit Server
Ln-S/usr/local/libevent/lib/libevent-1.2.so.1/usr/lib64

CD/usr/local/memcached
/Usr/local/memcached/bin/memcached-H

-P <num> TCP port number to listen on (default: 11211)

-U <num> UDP port number to listen on (default: 0, off)

-S <File> UNIX socket path to listen on (disables Network Support)

-A <mask> access mask for UNIX socket, in octal (default 0700)

-L <ip_addr> interface to listen on, default is indrr_any

-D run as a daemon

-R maximize Core File limit

-U <username> assume identity of <username> (only when run as root)

-M <num> MAX memory to use for items in megabytes, default is 64 MB

-M Return Error on Memory Exhausted (rather than removing items)

-C <num> MAX simultaneous connections, default is 1024

-K lock down all paged memory. Note that there is

Limit on how much memory you may lock. Trying

Allocate more than that wowould fail, so be sure you

Set the limit correctly for the user you started

The daemon with (not for-u <username> user;

Under sh this is done with 'ulimit-S-l num_kb ').

-V verbose (print errors/warnings while in event loop)

-VV very verbose (also print client commands/Reponses)

-H print this help and exit

-I print memcached and libevent license

-B run a managed instanced (Mnemonic: buckets)

-P <File> Save PID in <File>, only used with-D option

-F <factor> chunk size growth factor, default 1.25

-N <bytes> minimum space allocated for key + value + flags, default 48

If the preceding information is displayed, the installation is normal.
Note: Check the Lib folder to be added. When the following occurs:
Memcached: Error while loading shared libraries: libevent-1.3c.so.1: cannot open shared object file: no such file or directory

Use ld_debug = libs bin/memcached-V for debugging

 

Start memcache:
./Memcached-help
./Memcached-D-M 1024-u root-P 11211-C 1024-P/tmp/memcached. PID

Start

Echo/usr/local/memcached/bin/memcached-D-M 10-u root-l 218.16.118.105-P 11211-C 256-P/tmp/memcached. PID>/etc/rc. local

Startup parameters:
-D option is to start a daemon,

-M indicates the amount of memory allocated to memcache. The unit is mb. The default value is 64 MB.
-M Return Error on Memory Exhausted (rather than removing items)
-U is the user who runs memcache. If it is currently root, you need to use this parameter to specify the user.
-L is the IP address of the listening server. The default value is all NICs.

-P is the port used to set TCP listening for memcache, preferably over 1024.

-The C option is the maximum number of concurrent connections. The default value is 1024.

I am playing with Sohu Weibo. Come and "follow" me and learn about my latest news.
Http://dapeng725.t.sohu.com/

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.