时间:2016-02-26 19:06 来源: 我爱IT技术网 作者:佚名
欢迎您访问我爱IT技术网,今天小编为你分享的电脑教程是服务器系列之:【linux memcache安装配置方法】,下面是详细的分享!
linux memcache安装配置方法
#!/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
# Source function library
. /etc/rc.d/init.d/functions
RETVAL=0
prog="memcached"
basedir=/etc/memcached
cmd=${basedir}/bin/memcached
pidfile="$basedir/${prog}.pid"
#logfile="$basedir/memcached_log.txt"
ipaddr="192.168.1.200" # 绑定侦听的IP地址
port="11211" # 服务端口
username="root" # 运行程序的用户身份
max_memory=64 # 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 service: $prog"
$cmd -d -m $max_memory -u $username -l $ipaddr -p $port -c $max_simul_conn -P $pidfile
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}
stop() {
echo -n $"Stopping service: $prog "
run_user=`whoami`
pidlist=`ps -ef | grep $run_user | grep memcached | grep -v grep | awk '{print($2)}'`
for pid in $pidlist
do
# echo "pid=$pid"
kill -9 $pid
if [ $? -ne 0 ]; then
return 1
fi
done
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
#reload)
# reload
# ;;
restart)
stop
start
;;
#condrestart)
# if [ -f /var/lock/subsys/$prog ]; then
# stop
# start
# fi
# ;;
status)
status memcached
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
以上就是关于linux memcache安装配置方法的服务器维护教程分享,更多电脑教程请移步到>>电脑教程频道。
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
