获取远程redis服务器上的值
来源:互联网 发布:落樱神斧华盛顿知乎 编辑:程序博客网 时间:2024/04/30 04:43
环境:
两台虚拟机,ip分别为:192.168.2.100 、192.168.2.101
100 为 主,101为从。
redis 安装目录 /usr/local/redis-3.2.0 , redis-server,redis-cli 在 /usr/local/redis-3.2.0/src下
100 机器上有个 key为name ,value 为 11111的值。
遇到的问题:
一、100 直接使用 redis-server 启动 采用默认的配置文件
1、在 101上 通过 redis-cli -h 192.168.2.100 -p 6379 连接成功后,使用而 get name 出现
(error) DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
可以通过在 100 机器的redis-cli 命令中 使用 CONFIG SET protected-mode no 后,在执行 get name 就可以获取值。但在100重启后就不行了。
二、100通过 $ /usr/local/redis-3.2.0# src/redis-server ./redis.conf 启动 redis ,不修改 redis.conf任何内容。
1、在 101上 使用 redis-cli -h 192.168.2.100 -p 6379 出现
Could not connect to Redis at 192.168.2.100:6379: Connection refused
注释掉 100上的 redis.conf 中的 bind 127.0.0.1 ,后可以连接。
2、可以连接后执行 get name 后出现上面1.1的问题。
修改100上的 redis.conf 中的 protected-mode,把 yes 改为 no,重启redis,后就可以获取到值了。
0 0
- 获取远程redis服务器上的值
- 【代码片】获取远程服务器上的文件并删除
- 获取远程服务器上 Java 进程的运行状态
- git clone后,如何从远程获取某一个远程服务器上的另外一个分支
- 无法使用jedis连接远程服务器上的redis解决方案ENIED Redis is running in protected mode because prot
- 查看远程Redis服务器的版本
- 查看远程Redis服务器的版本
- 查看远程Redis服务器的版本
- 本地java链接远程服务器Linux上redis出错解决方案
- redis连接远程服务器
- redis-cli远程连接redis-server服务器的问题
- redis-cli远程连接redis-server服务器的问题
- Android上使用camera拍照,把获取的照片上传到远程服务器
- Android上使用camera拍照,把获取的照片上传到远程服务器
- Android上使用camera拍照,把获取的照片上传到远程服务器
- Android上使用camera拍照,把获取的照片上传到远程服务器
- Android上使用camera拍照,把获取的照片上传到远程服务器
- jsp获取远程图片保存到本地服务器上方法
- basic file operations
- 2013蓝桥决赛C/C++B组
- java大杂烩
- 进程间通信--信号
- 数据库的原理
- 获取远程redis服务器上的值
- 从零开始配置redis主从同步
- Zepto.js
- 单一职责原则
- python *args,**kwargs使用
- 第12周项目1:实现复数类中的运算符重载(2)
- 多周期CPU设计
- CodeForces 492D Vanya and Computer Game(二分)
- [知其然不知其所以然-24] ioremap failure