一、安装
# yum install redis
如果安装失败的话,执行以下命令再执行安装
# yum install epel-release
二、操作命令
启动redis
# service redis start
停止redis
# service redis stop
查看redis运行状态
# service redis status
查看redis进程
# ps -ef | grep redis
设置自启动
# chkconfig redis on
三、进入 redis
进入本机redis
# redis-cli
列出所有key
# keys *
四、修改 redis
# vi /etc/redis.conf
需要外网的伙伴请注释掉
# bind 127.0.0.1
更改端口,默认 6379
# port 6379
设置密码
# requirepass 123456
五、重启与链接
# service redis restart
# redis-cli -h 127.0.0.1 -p 6379
连接上后无法操作的,因为没有经过认证,无权限操作
(error) NOAUTH Authentication required.
# auth 123456
认证成功后就可以操作了
- 打赏
请选择打赏方式
![](https://cxiaoyu.cn/wp-content/plugins/wzbaibaoxiang/images/wzt_chahao.png)
![](https://cxiaoyu.cn/wp-content/uploads/2023/06/微信二维码20230606.jpg)
![](https://cxiaoyu.cn/wp-content/uploads/2021/12/QQ二维码.png)
- 微信
- 支付宝