ubuntu - 无法在 Ubuntu Bash 上使用 redis-cli 连接到 Sentinel

标签 ubuntu windows-10 redis-sentinel

我已经在 Windows 10 PC 上安装了 Ubuntu Bash。 之后使用 apt-get install 命令安装 Redis 我可以使用 redis-cli 命令连接到 redis,信息显示了详细信息

# Server
redis_version:2.8.4
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:a44a05d76f06a5d9
redis_mode:standalone

之后我创建了一个副本,我也可以连接到它

发布我使用从 /etc/redis/ 文件夹安装的默认配置文件启动 Sentinel。

我用来启动redis的命令是sudo redis-server/etc/redis/sentinel1.conf --sentinel

但是如果我尝试使用 redis-cli -p 26379 命令进行连接,我会收到此错误

laptop:~$ redis-cli -p 26379
Could not connect to Redis at 127.0.0.1:26379: Connection refused
not connected>

我检查了 sentinel.conf 文件,指定的端口是 26379

我什至尝试使用 redis-sentinel/path/to/sentinel.conf 启动哨兵 但同样的错误。

相同的设置在虚拟机上运行的 Ubuntu 上运行良好

编辑

我在 WIndows 10 Bash 上运行 Ubuntu 所以 netstat -tunlpa 命令显示了这一点

vipresh@VIPRESHJH:/etc/redis$ sudo netstat -tunlpa
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

还有 ps aux| grep redis 命令输出是这样的

vipresh@VIPRESHJH:/etc/redis$ ps aux| grep redis
redis       24  0.0  0.0      0     0 ?        Ssl   2432   0:00 /usr/bin/redis-server 127.0.0.1:6379
root        57  0.0  0.0      0     0 ?        Ssl   2432   0:00 redis-server *:26379
vipresh     61  0.0  0.0      0     0 ?        S     2432   0:00 grep --color=auto redis

它显示 Sentinel 正在端口 26379 上运行

最佳答案

检查服务是否正在监听

# netstat -tunlpa | grep redis
tcp        0      0 0.0.0.0:6379        0.0.0.0:*         LISTEN      xxxx
0/redis-server 

关于ubuntu - 无法在 Ubuntu Bash 上使用 redis-cli 连接到 Sentinel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39534968/

相关文章:

Redis哨兵与集群

reactjs - 服务器无法提供静态文件

postgresql - docker启动容器抛出cannot assign requested address错误

c# - VS 2015 RC - 尝试在 Windows 8 中创建 Windows 10 通用应用程序时不会加载 Xaml 设计器

c++ - Visual Studio 2017 C++ 项目中的 Libavcodec "the procedure entry point for av_frame_alloc could not be located"错误

redis - 使用 Sentinels 升级 Redis 的最佳实践?

Redis 哨兵 docker 镜像/Dockerfile

ubuntu - sendmail:如何在 ubuntu 上配置 sendmail?

android-studio - 具有高密度显示的 Android Studio 上的微小字体

mysql - 如何在Windows 10 命令提示符下正确执行MySQL 中的SQL 文件?