欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

centos下twemproxy安装

程序员文章站 2022-03-25 17:58:14
...
1.解压
tar -xvf nutcracker-0.4.1.tar.gz
 2.安装
yum install -y libtool
cd nutcracker-0.4.1
./configure
make
make install
 3.配置文件
cp /home/test/nutcracker-0.4.1/conf/nutcracker.yml /etc/twemproxy/
 4.启动:
/usr/local/sbin/nutcracker -d -c /etc/twemproxy/nutcracker.yml -p /var/run/redisproxy.pid -o /var/log/twemproxy/run/redisproxy.log
 启动脚本(补充):
#!/bin/sh
# nutcracker        Startup script for twemproxy
# chkconfig: - 80 12
#
# processname: nutcracker
# config: /etc/twemproxy/nutcracker.yml
# pidfile: /var/run/redisproxy.pid
source /etc/init.d/functions
BIN="/usr/local/sbin"
CONFIG="/etc/twemproxy/nutcracker.yml "
PIDFILE="/var/run/redisproxy.pid"
### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"
RETVAL=0
prog="nutcracker"
desc="nutcracker"
start() {
        if [ -e $PIDFILE ];then
             echo "$desc already running...."
             exit 1
        fi
        echo -n $"Starting $desc: "
        daemon $BIN/$prog $CONFIG
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
        return $RETVAL
}
stop() {
        echo -n $"Stop $desc: "
        killproc $prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog $PIDFILE
        return $RETVAL
}
restart() {
        stop
        start
}
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  condrestart)
        [ -e /var/lock/subsys/$prog ] && restart
        RETVAL=$?
        ;;
  status)
        status $prog
        RETVAL=$?
        ;;
   *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        RETVAL=1
esac
exit $RETVAL