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 

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native