Installation and startup
Memcache used libevent This library for socket processing, so you also need to install libevent,libevent the latest version is libevent-1.3. (If your system already has libevent installed, you can not install it)
#wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
After downloading Libevent, #tar-zxvf, and then Third kind:
#./configure-prefix=/usr/libevent
#make && make install
Then download #wget http://www.memcached.org/files/memcached-1.4.27.tar.gz, this is the memcache of the body, and then the same will be decompressed and third Kind, Note that in configure this step, you should specifically indicate the location of libevent:
#./configure-with-libevent=/usr/libevent/-prefix=/usr/local/memcached
#make && make install
After that, make sure the memcache is installed successfully,#/usr/local/memcached/bin/memcached-d-M 2048-p 11211-u root.
Here are some of the parameters that Memcache starts:
The-D option is to start a daemon process;
-M is the amount of memory allocated to Memcache, in megabytes, 10MB;
-U is the user running memcache, this is root;
-L is the server IP address of the listener, if there are multiple addresses, this specifies the IP address of the server 192.168.0.200;
-P is set memcache listening port, here set 12000, preferably more than 1024 port;
The-c option is the maximum number of concurrent connections to run, the default is 1024, here set 256, according to the server's load amount to set;
-P is set to save memcache pid file, I here is saved in/tmp/memcached.pid, can also start multiple daemons, but the port can not be duplicated.
Configuring logs for Memcache
Memcache default is not with the logging function, if you want to turn on logging, you need to pass the parameter-V,-VV,-VVV, the functions of the three parameters are as follows:
-V Verbose (print errors/warnings while in event loop)
-VV very verbose (also print client commands/reponses)
-VVV extremely verbose (also print internal state transitions)
Verbose itself is a wordy meaning, a V is verbose, two V is particularly verbose, also represents the log level of record also increased. Generally speaking,-VV is enough.
So now the statement to start Memcache is:#/usr/local/memcached/bin/memcached-d-M 2048-p 11211-u root-vv >>/tmp/memcached. Log 2>&1. In this way, the Memcache log is written into the/tmp/memcache.log, which also includes the wrong log.
This article is from "Life is waiting for Gordo" blog, please make sure to keep this source http://chenx1242.blog.51cto.com/10430133/1794192
Memcache installation and start-up