Parsing: What is memcached?
Memcached is a high-performance, distributed memory object caching system developed by Danga Interactive for reducing database load and increasing access speed in dynamic applications.
First, the software version
Libevent stable Version
wget http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
Memcached stable Version
wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
Second, software Installation
Libevent Installation
[Email protected] software]# tar zxvf libevent-1.4.14b-stable.tar.gz
[Email protected] software]# CD libevent-1.4.14b-stable
[Email protected] libevent]#/configure--prefix=/usr/local/libevent/
[[email protected] libevent]# make
[[email protected] libevent]# make install
memcached Installation
[Email protected] software]# TAR-ZXVF memcached-1.4.5.tar.gz
[Email protected] software]# CD memcached-1.4.5
[Email protected] memcached]#/configure--prefix=/usr/local/memcached--with-libevent=/usr/local/libevent/
[[email protected] memcached]# make
[[email protected] memcached]# make install
Third, write the memcached startup script
#!/bin/bash
# Author:kuangl
# date:2013-05-30
# Description:starts and stops the Memcached services.
# Pidfile:/tmp/memcached1.pid
# config:/usr/local/memcached
# Chkconfig:-55 45
# source Function Library
. /etc/rc.d/init.d/functions
Memcached= "/usr/local/memcached/bin/memcached"
[-e $memcached] | | Exit 1
Start ()
{
echo "Starting memcached:"
Daemon $memcached-D-M 1000-u root-l 127.0.0.1-p 11211-c 1500-p/tmp/memcached1.pid
}
Stop ()
{
echo "Shutting down memcached"
Killproc memcached
}
Case "$" in
Start
Start
;;
Stop
Stop
;;
Restart
Stop
Sleep 3
Start
;;
*)
echo $ "Usage: $ {Start|stop|restart}"
Exit 1
Esac
Exit $?
Iv. Copy the script to the INIT.D directory
[email protected] scripts]# CP memcached.sh/etc/init.d/memcached
V. Add memcached to the system starter
[Email protected] scripts]# chkconfig--add memcached
[Email protected] scripts]# chkconfig--level memcached on
Six, start memcached
[Email protected] scripts]# service memcached restart
Shutting down memcached [OK]
Starting memcached: [OK]
[Email protected] scripts]# Ps-ef |grep memcached
Root 27616 1 0 22:18? 00:00:00/usr/local/memcached/bin/memcached-d-M 1000-u root-l 127.0.0.1-p 11211-c 1500-p/tmp/memcached1.pid
Vii. Common parameters of memcached
Parameters |
Description |
-p < Num> |
set port number default not set to : 11211) |
-u <num> |
udp Listener port default : 11211, 0 close ) |
-L <ip_addr> |
Binding address( default : all allow , no matter the internal or external network or local replacement ip127.0.0.1 only native access ) |
-D |
Standalone process Run |
-U <username> |
Bindings use specified for running processes <username> |
M <num> |
Allowed maximum memory usage, Unit M ( default : MB) |
-P <file> |
will pid< Span style= "font-family: Song body; Color: #0d0d0d; Font-size:14px "> write file <file> need with -d use |
Error message:/usr/local/memcacheq/bin/memcacheq:error while loading shared libraries:libevent-2.0.so.5:cannot open shared Object File:no such file or directory lookup link package: ld_debug=libs/usr/local/memcacheq/bin/memcacheq-v | grep libevent 27382:find library=libm.so.6 [0]; searching27382:Search Cache=/etc/ld.so.cache27382:trying file=/lib64/libm.so.627,382:27,382:find library=libdb-4.7.so [0]; searching27382:Search Cache=/etc/ld.so.cache27382:trying file=/lib64/libdb-4.7.so27,382:27,382:find library=libevent-2.0.so.5 [0]; searching27382:Search Cache=/etc/ld.so.cache27382:Search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/ Lib64/x86_64:/usr/lib64 (System search path) 27382:trying file=/lib64/tls/x86_64/libevent-2.0.so.527382:trying file=/lib64/tls/libevent-2.0.so.527382:trying file=/lib64/x86_64/libevent-2.0.so.527382:trying file=/lib64/libevent-2.0.so.527382:trying file=/usr/lib64/tls/x86_64/libevent-2.0.so.527382:trying file=/usr/lib64/tls/libevent-2.0.so.527382:trying file=/usr/lib64/x86_64/libevent-2.0.so.527382:trying file=/usr/lib64/libevent-2.0.so.527382: Build Link: sudo ln-s/usr/lib/libevent-2.0.so.5.1.7/lib64/libevent-2.0.so.5
"Go" memcached Installation