redis教程-关闭protected-mode保护模式 作者:马育民 • 2025-08-10 11:24 • 阅读:10003 # 配置 ### 备份 redis.conf ``` cp /program/redis-6.0.8/redis.conf /program/redis-6.0.8/redis.conf.bak ``` ### 关闭保护模式 `protected-mode` 改为 `no`,关闭保护模式,如下: ``` protected-mode no ``` 如下图: [](https://www.malaoshi.top/upload/0/0/1GW1eKBR5VkI.png) ### 关闭密码 如果之前启用密码,需要关闭,否则登录还是需要输入密码,如下: ``` # requirepass redis ``` [](https://www.malaoshi.top/upload/0/0/1GW1eKIvqN6U.png) # 启动命令 **注意:**后面必须加上配置文件,**否则不生效** ``` redis-server /program/redis-6.0.8/redis.conf ``` # 客户端登录redis ### 方式一:连接本机服务器 ``` redis-cli ``` 执行结果: ``` 127.0.0.1:6379> ``` 说明连接成功 ### 方式二:连接远程服务器 ``` redis-cli -h [redis服务器ip] -p 6379 ``` 执行结果: ``` hadoop1:6379> ``` 说明连接成功 # 关闭服务 ### 方式一: ``` redis-cli shutdown ``` ### 方式二: 先登录,然后执行下面命令: ``` shutdown ``` ### 查看 redis 进程 ``` ps -ef | grep redis ``` 没有redis-server进程 原文出处:http://malaoshi.top/show_1GW1eKmuTL4A.html