首页 > 数据库 >执行redis-cli命令创建redis集群时报错“Could not connect to Redis at IP:端口: No route to host”

执行redis-cli命令创建redis集群时报错“Could not connect to Redis at IP:端口: No route to host”

时间:2023-04-10 19:32:40浏览次数:49  
标签:src cli No redis 192.168 slots 8001 8002

问题描述:执行redis-cli命令创建redis集群时报错“Could not connect to Redis at IP:端口: No route to host”,如下所示:
数据库:redis 6.2.6
系统:rhel 7.9
1、异常重现
[root@leo-redis626-a src]# /usr/local/src/redis-6.2.6/src/redis-cli --cluster create --cluster-replicas 1 \
> 192.168.133.100:8001 192.168.133.100:8002 \
> 192.168.133.101:8001 192.168.133.101:8002 \
> 192.168.133.102:8001 192.168.133.102:8002
Could not connect to Redis at 192.168.133.101:8001: No route to host
2、异常原因
该问题是在远程访问redis时出现,原因为服务器防火墙开启导致.
3、解决方案
--此处关闭三台服务器防火墙.
[root@leo-redis626-a src]# systemctl stop firewalld
[root@leo-redis626-a src]# systemctl disable firewalld
[root@leo-redis626-b src]# systemctl stop firewalld
[root@leo-redis626-b src]# systemctl disable firewalld
[root@leo-redis626-c src]# systemctl stop firewalld
[root@leo-redis626-c src]# systemctl disable firewalld
--此后重新执行redis-cli命令创建集群.
[root@leo-redis626-a src]# /usr/local/src/redis-6.2.6/src/redis-cli --cluster create --cluster-replicas 1 \
> 192.168.133.100:8001 192.168.133.100:8002 \
> 192.168.133.101:8001 192.168.133.101:8002 \
> 192.168.133.102:8001 192.168.133.102:8002
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.133.101:8002 to 192.168.133.100:8001
Adding replica 192.168.133.102:8002 to 192.168.133.101:8001
Adding replica 192.168.133.100:8002 to 192.168.133.102:8001
M: c036f0322c2f8bdd04b1f156f8ff7c29804eb28b 192.168.133.100:8001
   slots:[0-5460] (5461 slots) master
S: 6bf0eff5c1874da48cb64df57accac8eaf7aa57d 192.168.133.100:8002
   replicates 81c45df99418144728954cda61dfa9fb3e1c5b3f
M: 6d9ca761fc09c83b6a3c2273a36b565c4c525ac3 192.168.133.101:8001
   slots:[5461-10922] (5462 slots) master
S: 9f2b2480fecb0a193fdb2feed8c507c7c664cd74 192.168.133.101:8002
   replicates c036f0322c2f8bdd04b1f156f8ff7c29804eb28b
M: 81c45df99418144728954cda61dfa9fb3e1c5b3f 192.168.133.102:8001
   slots:[10923-16383] (5461 slots) master
S: 5d9ff4989ef75877c6683ece2cc39f22fa4160e6 192.168.133.102:8002
   replicates 6d9ca761fc09c83b6a3c2273a36b565c4c525ac3
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
.
>>> Performing Cluster Check (using node 192.168.133.100:8001)
M: c036f0322c2f8bdd04b1f156f8ff7c29804eb28b 192.168.133.100:8001
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
S: 5d9ff4989ef75877c6683ece2cc39f22fa4160e6 192.168.133.102:8002
   slots: (0 slots) slave
   replicates 6d9ca761fc09c83b6a3c2273a36b565c4c525ac3
S: 6bf0eff5c1874da48cb64df57accac8eaf7aa57d 192.168.133.100:8002
   slots: (0 slots) slave
   replicates 81c45df99418144728954cda61dfa9fb3e1c5b3f
M: 6d9ca761fc09c83b6a3c2273a36b565c4c525ac3 192.168.133.101:8001
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
M: 81c45df99418144728954cda61dfa9fb3e1c5b3f 192.168.133.102:8001
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
S: 9f2b2480fecb0a193fdb2feed8c507c7c664cd74 192.168.133.101:8002
   slots: (0 slots) slave
   replicates c036f0322c2f8bdd04b1f156f8ff7c29804eb28b
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

说明:如上所示,redis集群成功创建.

标签:src,cli,No,redis,192.168,slots,8001,8002
From: https://blog.51cto.com/u_12991611/6181364

相关文章

  • Redis集群添加master到当前集群,并重新分槽
    文档课题:Redis集群添加master到当前集群,并重新分槽.操作系统:rhel7.964位数据库:redis6.2.6环境说明:第1台机器:主机名leo-redis626-a192.168.133.1008001端口8002端口第2台机器:主机名leo-redis626-b192.168.133.1018001端口8002端口第3台机器:主机名leo-redis626-c192.......
  • Qt for Android QtQuick应用程序 USB连接手机调试运行错误:adb: failed to *.apk: No s
    1.场景Windows11、Qt6.5.0QtQuick应用程序USB连接手机调试运行。2.错误信息adb:failedto*.apk:NosuchfileordirectoryInstallingtodevicefailed!进程"C:\Users\Administrator\Qt\6.5.0\mingw_64\bin\androiddeployqt.exe"退出,退出代码16。安装应用失败,发生未知错......
  • Redis之缓存穿透、缓存击穿、缓存雪崩及其解决方法
    原文地址:https://mp.weixin.qq.com/s?__biz=MzU2MDY0NDQwNQ==&mid=2247483949&idx=1&sn=6c643858d50cee4f9a2cac8ce838baff&chksm=fc05aa77cb722361dc3e3eb2b74f4d68308f7dc1d12e04dc4444a0d2595dc9e484ef318e93ce&scene=27 什么是缓存穿透缓存穿透是指查询一个缓存中和数据......
  • Hanoi - plus
    题目描述如果将课本上的汉诺塔问题稍做修改:给定N只盘子,3根柱子,但是允许每次最多移动相邻的M只盘子(当然移动盘子的数目也可以小于M),最少需要多少次? 输入格式输入数据仅有一行,包括两个数N和M(0<=M<=N<=8) 输出格式仅输出一个数,表示需要移动的最少次数 样例输入......
  • 编辑大量文本的情况vscode比notepad++性能更好
    尝试操作几十万行的文本的时候Notepad++直接卡死了二十多万行的文本选中需要卡几秒,剪切粘贴文本需要卡几秒文本替换需要跑几十秒,再多一些的话容易卡崩 使用vscode进行剪切粘贴批量替换之类的操作基本是不卡秒执行的 一次性选中多行的方法:使用ctrl+G可以跳转到指定行ct......
  • 'T' must be a non-abstract type with a public parameterless constructor
    虽然工作10多年,但是真正使用框架的项目很少很少...所以对接口,方法等约束毫无经验今天做了个动态代理dispatchproxy的类,但是在调用时却一直提示如下错误: ErrorCS0310'T'mustbeanon-abstracttypewithapublicparameterlessconstructorinordertouseitas......
  • 安装python第三方库报:is not a supported wheel on this platform
    1,在cmd中输入pipdebug--verbose,如下图圈红的就是当前python使用的标签,所以可以把cryptography-40.0.1-pp39-pypy39_pp73-win_amd64.whl改成cryptography-40.0.1-py39-none-any.whl就能安装成功 ......
  • 腾讯技术专家解读《FinOps,从上云到上好云》
    3月30日,由优维联合FinOps产业推进方阵、云原生社区举办的第2期UGeek大咖说如期开播,本期主题为“FinOps,从上云到上好云”,邀请了腾讯技术产品经理王孝威做客直播间,为大家带来了一场FInOps技术盛宴。下面,将从四个方面带大家共同回顾本次直播活动的主要内容。1.云上资源效能挑战2.云原......
  • ScreenSaverNow for Mac(菜单栏防休眠工具) 1.75激活版
    想要一款菜单栏屏幕工具?推荐您使用ScreenSaverNowMac中文版,安装后可自定义的全局热键或鼠标单击立即激活您的屏幕保护程序。当您离开Mac时但仍需要保持工作状态时,ScreenSaverNowforMac将屏幕保护程序与密码一起使用很可能是保护您的信息免受他人侵害的唯一方法。ScreenSaverNow......
  • 【HMS Core】应用内支付FAQ 6-unknownException、订单编号传入
     【关键字】应用内支付、报错 【问题描述1】收到华为的支付回调通知后,通过通知里面的purchaseToken,调用Order服务验证购买Token时报错​【解决方案】1、报错“6-unknownException”有可能是因为请求头里带的认证token有问题,请检查Authorization字段https://developer.hu......