Linux搭建Zookeeper问题解决贴(合集)

1、防火墙没关

会导致java.net.NoRouteToHostException: 没有到主机的路由 (Host unreachable)

1.临时关闭防火墙

/etc/init.d/iptables stop

2.永久关闭防火墙

chkconfig iptables off 

3.查看关闭后的状态

/etc/init.d/iptables status

2、SELinux问题

会导致什么还没发现,不过我是关了,可能跟网络连接有关,还是关了吧

1.查看SELinux状态:(下面两条命令都可以)

/usr/sbin/sestatus -v

getenforce

2.修改配置文件需要重启机器

vi  /etc/selinux/config  将SELINUX=enforcing改为SELINUX=disabled

然后reboot重启

3.conf文件问题

会导致各种各样的问题,这里必须正确

下面是我自己的conf文件,提供参考

# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.(下面这个路径不要写错
dataDir=/opt/module/zookeeper-3.4.14/zkData
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
#######################下面ip地址不要写错,还有前面的编号也要对应myid的值##########################

server.2=192.168.248.131:2888:3888
server.3=192.168.248.132:2888:3888
server.4=192.168.248.133:2888:3888

4.查看zookeeper.out

一般error都查看这个文件,如果这个文件没有报错信息,但状态还是error,这时候应该是你分布式zookeeper只开了一台主机,开多一台就好了

zookeeper程序运行日志,跟java的控制台一样会打印所有信息,包括错误信息,像查java报错一样使用他吧

5、没有安装jdk

会导致各种各样的问题,这里必须正确

找教程安装

6、分布式zookeeper时,某主机有时候成功,有时候error

证明你配置是没错的,把所有主机的服务停掉,然后一个个开,耐心等一会,让所有服务完全起来了,再查状态

7、没有打开网络

会导致

java.net.BindException: 无法指定被请求的地址 (Bind failed)

java.net.ConnectException: 网络不可达 (connect failed)

8、分布式zookeeper没至少两台主机的zookeeper服务一起开启

会导致java.net.ConnectException: 拒绝连接 (Connection refused)

 

6.欢迎大家来补充答案。。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值