清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#!/bin/sh # # Startup script for the server of memcached # # processname: memcached # pidfile: /etc/memcached/memcached.pid # logfile: /etc/memcached/memcached_log.txt # memcached_home: /etc/memcached # chkconfig: 35 21 79 # description: Start and stop memcached Service MEMCACHED_HOME=/etc/memcached export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MEMCACHED_HOME/lib # Source function library . /etc/rc.d/init.d/functions RETVAL=0 prog="memcached" basedir=/etc/memcached cmd=${basedir}/bin/memcached # 绑定侦听的IP地址 ipaddr=`/sbin/ifconfig eth0|sed -n '2p'|awk '{print $2}'|cut -c 6-30` # 设置memcached启动参数 port=11210 # 服务端口基数,使用11210 + i的方式 threads=4 # 在服务器上运行memcached进程的最大进程数 user=`root` # 运行程序的用户身份 max_memory=128 # default: 64M | 最大使用内存 max_simul_conn=1024 # default: 1024 | 最大同时连接数 #maxcon=51200 #growth_factor=1.3 # default: 1.25 | 块大小增长因子 #thread_num=6 # default: 4 #verbose="-vv" # 查看详细启动信息 #bind_protocol=binary # ascii, binary, or auto (default) start() { echo -n $"Starting $prog: " for((i=1;i<=${threads};i++));do let ServicePort=port+${i} pidfile="$basedir/${prog}${i}.pid" $cmd -d -m $max_memory -u ${user} -l $ipaddr -p ${ServicePort} -c $max_simul_conn -P ${pidfile} done; RETVAL=$? echo [ $RETVAL = 0 ] } stop() { echo -n $"Stopping $prog: " killproc ${cmd} RETVAL=$? echo [ $RETVAL = 0 ] } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status memcached ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit $RETVAL