redis3.2.8安装总结
- 安装redis
- 修改配置文件.conf
- 开机关机自动启动
安装redis
(1)wget http://download.redis.io/releases/redis-3.2.8.tar.gz
(2)tar –zxvf redis-3.2.8.tar.gz
(3)cd redis-3.2.8
(4)make
(5)cd src
(6)make install
(7)make test (测试)
(8)redis-server –v (查看版本命令)
修改配置文件.conf
(1)cd /etc/
(2)mkdir redis
(3)cd /var/
(4)mkdir redis
(5)cd redis
(6)mkdir data log run
(7)cp redis-3.2.8/redis.conf /etc/redis/redis.conf
(8)vim /etc/redis/redis.conf
(8.1)修改pid目录 pidfile /var/redis/run/redis_6379.pid
(8.2)修改dump目录 dir /var/redis/data
(8.3)修改log目录 logfile /var/redis/log/redis.log
(8.4)将daemonize no 修改成 daemonize yes (运行以下命令即redis服务时可以使得redis在background运行)
(8.5)将bind 127.0.0.1前面加上“#”注释掉(如果bind选项为空的话,那会接受所有来自于可用网络接口的连接。)
(8.6)没有设密码的情况:将protected-mode yes 修改成protected-mode no (为了禁止公网访问redis cache,加强redis安全的。)
(8.7)设有密码的情况:在protected-mode yes下面设置密码,添加为requirepass redis
(9)/usr/local/bin/redis-server /etc/redis/redis.conf (在指定配置下运行redis服务)
(10)ps -ef | grep redis (查看redis运行情况)
开机关机自动启动
(1)cp redis-3.2.8/utils/redis_init_script /etc/init.d/redis (将redis_init_script命名为redis)
(2)vim redis
PIDFILE=/var/redis/run/redis_${REDISPORT}.pid
CONF=”/etc/redis/redis.conf”
(3)chmod +x /etc/init.d/redis尝试启动或停止redisservice redis start
没有设置密码的关闭方式service redis stop
设置了密码的关闭方式/usr/local/bin/redis-cli -h IP -a “password” -p 6379 shutdown
开启服务自启动chkconfig redis on