#tar -xvf redis.3.2.5.tar.gz –C /usr/local/ #cd /usr/local/ #mv redis.3.2.5 redis #cd redis #make && make install #cp /usr/local/redis/redis.conf /data/redis/conf #vim /data/redis/conf/redis.conf logfile "/data/logs/redis/redis.log" dir "/data/redis/data" daemonize yes maxmemory 104857600 最大限制100M内存 mkdir –p /data/redis/conf/ mkdir –p /data/logs/redis/ mkdir –p /data/redis/data 写启动文件 Vim /etc/init.d/redis # chkconfig: 2345 90 10 # description: Redis is a persistent key-value database PATH=/usr/local/redis/bin:$PATH REdisPORT=6379 EXEC=/usr/local/redis/bin/redis-server REdis_CLI=/usr/local/redis/bin/redis-cli PIDFILE=/var/run/redis_6379.pid CONF="/data/redis/conf/redis.conf" case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists,process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi if [ "$?"="0" ] then echo "Redis is running..." fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist,process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $REdis_CLI -p $REdisPORT SHUTDOWN while [ -x ${PIDFILE} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; restart|force-reload) ${0} stop ${0} start ;; *) echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2 exit 1 esac # chkconfig redis on
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。