博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Redis创建集群报错:[ERR] Sorry, can't connect to node 192.168.0.9:6380
阅读量:4280 次
发布时间:2019-05-27

本文共 1643 字,大约阅读时间需要 5 分钟。

一、问题描述

创建Redis集群,但是报错:

[root@bigdata mycluster]# redis-trib.rb  create  --replicas  1  192.168.0.9:6380   192.168.0.9:6381 192.168.0.9:6382 192.168.0.9:6383   192.168.0.9:6384 192.168.0.9:6385
>>> Creating cluster
[ERR] Sorry, can't connect to node 192.168.0.9:6380

二、问题原因

修改redis配置文件redis.conf的时候,修改bind后为本机ip,但是自己修改bind的位置错了,修改为:

# By default, if no "bind" configuration directive is specified, Redis listens

# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
bind 192.168.0.9

而实际应当修改位置为,如果修改错误,则创建集群时无法访问对应的端口,无法创建集群

# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the

# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 lookback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1

三、解决问题

解决问题很简单,修改正确bind参数位置为本机ip即可,

# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES

# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 192.168.0.9
 

转载地址:http://wjygi.baihongyu.com/

你可能感兴趣的文章
静态链接库设计
查看>>
与时间相关的函数编程
查看>>
Linux进程控制相关概念
查看>>
c标准中的预定义宏
查看>>
*(volatile unsigned long *) 语法
查看>>
Linux多进程程序设计
查看>>
Linux进程间通讯基础
查看>>
Linux信号通讯编程
查看>>
信号量同步编程
查看>>
共享内存通讯编程
查看>>
Linux消息队列通讯编程
查看>>
网络协议基础
查看>>
Linux网络编程模型
查看>>
TCP通讯程序设计
查看>>
UDP通讯程序设计
查看>>
并发服务器设计
查看>>
Linux守护进程设计
查看>>
SQLite数据库编程
查看>>
c/c++常见关键字
查看>>
C++内存地址分配和内存区划分简介
查看>>