Linux Memcache Build

Source: Internet
Author: User

This approach is recommended when you deploy a production environment

Memcached relies on libevent, so the installation libevent must be compiled first. Both need to be installed in the Gnu/linux system with more than 2.6 kernel versions. Before compiling, verify that the GCC, make, Patch, and other compilation tools are installed and ready for use.

(1) Compiling source code

Get Libevent

Download the latest version from Libevent's official site (http://www.monkey.org/~provos/libevent/) or use the libevent-2.0.10-stable.tar.gz on the file server

Compiling, installing libevent

#tar-ZXVF libevent-x.x.x-stable.tar.gz

#cd libevent-x.x.x-stable

#./configure && make && make install &&

Get memcached

#wget Http://memcached.org/latest

Or use memcached-1.4.5.tar.gz on the file server

Compiling, installing memcached

#tar-ZXVF memcached-1.x.x.tar.gz

#cd memcached-1.x.x

#./configure--prefix=/usr/local/memcached--with-libevent=/usr/local

#make

#make Install

(2) Start memcached server

#cd/usr/local/memcached/bin

#./memcached-d-M 50-p 11211-u Root

Parameter Description:-m Specifies how many megabytes of cache space to use;-p specifies the port to listen on;-u specifies which user to run

Parameter explanation:

-D runs memcached in the daemon (daemon) mode;

-M sets the amount of memory that memcached can use, in units of M;

-L Set the listening IP address, if it is native, it is usually possible not to set this parameter;

-P Sets the listening port, which defaults to 11211, so you can also not set this parameter;

-u specifies that the user should be specified using this parameter if it is currently root.

(3) Troubleshooting

After the installation is complete, you may receive the following error when you start memcached:

./memcached:error while loading shared libraries:libevent-2.0.so.5:cannot open Shared object file:no such file or dire Ctory

The system cannot locate the Libevent library, and you can solve the problem in this way:

Ln-s/usr/local/lib/libevent-2.0.so.5.0.1/lib/libevent-2.0.so.5

If it is a 64-bit operating system, point to the/lib64 directory

Ln-s/usr/local/lib/libevent-2.0.so.5.0.1/lib64/libevent-2.0.so.5


Linux Memcache Build

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.