- YUM 添加epel 源
yum install epel-release
- 安装 redis
yum install redis
- 配置 redis
vim /etc/redis.conf
找到redis.conf 并修改 daemonize no(第128行) 为 daemonize yes
- 开启客户端要确保服务端启动
redis-server /etc/redis.conf
- 查看版本
redis-server -v
- 测试启动
redis-cli ping
返回PONG,说明启动成功
- 设置为开机启动
chkconfig --add redis
chkconfig redis on
- 关闭开启启动
chkconfig redis off
- 启停命令
service redis start
service redis stop
service redis restart
- 设置访问密码
vim /etc/redis.conf
找到 requirepass 所在行,复制并设置密码
- 允许远程访问
vim /etc/redis.conf
1、protected-mode yes 修改为 protected-mode no
2、bind 127.0.0.1 注释掉
3、iptables 放开 6379 端口