无法在UbuntuBash

时间:2016-09-16 15:18:10

标签: 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上运行

1 个答案:

答案 0 :(得分:0)

检查服务是否正在侦听

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