centos7.2 下 部署单节点redis 3.2.5
#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