Detailed steps for installing and starting memcache in Linux

Source: Internet
Author: User
In the above section, we have explained how to install Memcache in Windows. next we will explain in detail how to install and start memcache in Linux through the php Chinese network. memcache is a high-performance, distributed memory object cache system, it is used to reduce database load in dynamic applications and improve access speed. It is said that its users, including twitter, digg, and flickr, are all internet giants. Currently, memcache is widely used for reading large users on the Internet. The above describes how to install Memcache in Windows. The first PHP community below will explain in detail how to install and start memcache in Linux.

Download and install memcache

The server is mainly installed on the memcache server, the latest version is memcached-1.4.5

Install libevent again. The latest stable version is 1.4.14.

After the download, upload it to/home/blue/

Run the following command:

Cd/home/bluetar zxvf memcached-1.4.5.tar.gztar zxvf libevent-1.4.14b-stable.tar.gz # install libeventcd libevent-1.4.14b-stable. /configure -- prefix =/home/liuzhy/libevent-1.4.14b-stablemakemake install # install memcachedud/home/blue/memcached-1.4.5. /configure -- prefix =/home/blue/memcached-1.4.5 -- with-libevent =/home/blue/libevent-1.4.14bmake make install
Start memcache service

Go to the bin directory and run:./Memcached-d-m 1024-u blueBut the system says there is a shared library not loaded, the name of the shared library is: libevent-1.4.so.2

First, check the address of the link library used by the memcached command. Run the following command to view details:

LD_DEBUG = libs/usr/local/memcached/bin/memcached-v

Shows where memcache looks for the libevent-1.4.so.2 file, so we only need to specify the libevent-1.4.so.2 file to any directory above. Here we specify it to/lib64. Make a soft connection. The command is as follows:

Ln-s/usr/local/lib/libevent-1.4.so.2/usr/lib/libevent-1.4.so.2

Start the memcache service:./Memcached-d-m 1024-u blueYou can.

The following describes the parameters of the memcached command,

#/Usr/local/bin/memcached-d-m 200-u root-l 192.168.1.91-p 12301-c 1000-P/tmp/memcached. the pid is explained as follows: The-d option is to start a daemon.-m is the amount of memory allocated to Memcache. the unit is MB. here, 200MB-u is the user who runs Memcache, if it is root, you need to use this parameter to specify the user. -L is the IP address of the listening server. if there are multiple IP addresses, I have specified the server IP address 192.168.1.91-p as the port for setting the Memcache listening, and I have set 12301 here, it is best to set port-c above 1024 to the maximum number of concurrent connections. the default value is 1024. here, the setting of 256-P is to set the pid file for saving Memcache, I saved it in/tmp/memcached. pid stops the Memcache process: # kill 'cat/tmp/memcached. the pid can also start multiple daemon processes, but the ports cannot be repeated.

The "-d" parameter in the beginning needs further explanation.

-D install memcached-d uninstall memcached-d start memcached service-d restart memcached service-d stop memcached service-d shutdown stop memcached service

Check service:

1. view the started memcache service:

netstat -lp | grep memcached

2. view the memcache process number (the memcache service can be terminated by the process number: "kill-9 process number ")

ps -ef | grep memcached

The above describes the detailed steps for installing and starting memcache in Linux. For more information, see other related articles in the first PHP community!

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.