■ /etc/sysconfig/memcached を適当にコピーして変更
# cp /etc/sysconfig/memcached /etc/sysconfig/memcached-2■ /etc/init.d/memcached を適当にコピーして変更
PORT="11212"
USER="nobody"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
#! /bin/shロックファイルとpidファイルだけリネームしておけばよさそう。
#
# chkconfig: - 55 45
# description: The memcached daemon is a network memory cache service.
# processname: memcached
# config: /etc/sysconfig/memcached
# Source function library.
. /etc/rc.d/init.d/functions
PORT=11212
USER=nobody
MAXCONN=1024
CACHESIZE=64
OPTIONS=""
if [ -f /etc/sysconfig/memcached ];then
. /etc/sysconfig/memcached-2
fi
# Check that networking is up.
if [ "$NETWORKING" = "no" ]
then
exit 0
fi
RETVAL=0
prog="memcached"
start () {
echo -n $"Starting $prog: "
# insure that /var/run/memcached has proper permissions
chown $USER /var/run/memcached
daemon memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached-2.pid $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached-2
}
stop () {
echo -n $"Stopping $prog: "
killproc memcached
RETVAL=$?
echo
if [ $RETVAL -eq 0 ] ; then
rm -f /var/lock/subsys/memcached-2
rm -f /var/run/memcached-2.pid
fi
}
restart () {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status memcached
;;
restart|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/memcached-2 ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
exit 1
esac
exit $?
■ chkconfigに登録と起動
# chkconfig --add memcached-2※chkconfig動いてない場合は、普通に/etc/init.d/memcached-2 start で起動する
# service memcached-2 start
■ 変更したポートで動いてるか確認
# telnet localhost 11212めでたし。
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
set foo 0 100 4
test
STORED
get foo
VALUE foo 0 4
test
END
0 件のコメント:
コメントを投稿