Preparation of a compilation environment
---------------------------------------------------------------------------------------------------------
Yum Install GCC
Yum Install gcc-c++ Libstdc++-devel
Yum Install Zlib-devel
Second, the source package preparation
Download memcached source Package memcached-v1.4.25.
wget http://www.memcached.org/files/memcached-1.4.25.tar.gz
In addition, Memcache used the libevent this library for socket processing, so you also need to install Libevent
wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
Three, installation and configuration
1. Compile and install Libevent
./configure--PREFIX=/USR
Make & make Install
To test whether the Libevent was installed successfully:
Ls-al/usr/lib | grep libevent
2, install memcached, also need to install in the specified Libevent installation location
./configure--WITH-LIBEVENT=/USR
Make & make Install
To test whether memcached is installed successfully:
ls-al/usr/local/bin/mem*
3. Open memcached Daemon
---------------------------------------------------------------------------------------------------------
memcached-d-U Root
---------------------------------------------------------------------------------------------------------
#连接参数
-P Listening Port
-L connected IP address, default is native
-D Start Memecache service
-D Restart Restart
-D stop|shutdown Shutdown service
-D Install installation
-D Uninstall Uninstall
-U Run as identity only valid under root
-m maximum memory usage, unit MB, default 64MB, Max 2G
-M error returned when memory is exhausted
-c Maximum number of simultaneous connections, default is 1024
-F Block Size growth because the default is 1.25
-N Minimum allocated space, key+value+flags default 48
-H Display Help
4. Use Telnet connection to test whether the installation was successful
---------------------------------------------------------------------------------------------------------
telnet localhost 11211
#直接按回车会出现客户端错误.
Quit #退出
---------------------------------------------------------------------------------------------------------
At this point, the memcached installation is complete.
CentOS under source code compilation installation memcached