redis 3.2.4 + centos 6.6
安装:
/usr/local/src/
wget http://download.redis.io/releases/redis-3.2.4.tar.gz
cd redis-3.2.4
make
cd src
make install
此时执行文件在/usr/local/bin/
添加服务:
进入/usr/local/src/redis-3.2.4
cp utils/redis_init_script /etc/rc.d/init.d/redis
vim /etc/rc.d/init.d/redis
在头部添加
#chkconfig: 345 60 60
#!/bin/bash
mkdir /etc/redis
mkdir /var/redis
mkdir /var/redis/6379
cp redis.conf /etc/redis/6379.conf
vim /etc/redis/6379.conf
#设置daemonize为yes
#设置pidfile为/var/run/redis_6379.pid
#设置logfile为/var/log/redis_6379.log
#设置dir为/var/redis/6379
#bind 127.0.0.1 114.XXX.XXX.XXX(IP)
#requirepass XXXXX(密码)
sysctl vm.overcommit_memory=1
chkconfig --add redis
chkconfig redis on
打开防火墙
setup(添加6379端口tcp)
service iptables restart
启动:
service redis start
关闭:
service redis stop
会提示:
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
Waiting for Redis to shutdown ...
因为有密码,所有必须,在新窗口:
redis-cli -h XXX.XXX.XXX.XXX -p 6379 -a PASSWORDXXXXX
SHUTDOWN