这里是当初在三个ECS节点上搭建hadoop+zookeeper+hbase+solr的主要步骤,文章内容未通过润色,请参考的同窗搭配其余博客一同使用,并记得根据实际状况调整相关参数html
准备奇数台已经配置好jdk的节点 (奇数台避免选举leader时脑裂)centos
防火墙、ECS安全组安全
2. vi /etc/profile export ZK_HOME=/opt/zookeeper/zookeeper-3.5.5 export PATH=.:${JAVA_HOME}/bin:${SCALA_HOME}/bin:${SPARK_HOME}/bin:${ZK_HOME}/bin:$PATH source /etc/profile
vi /.../zookeeper-3.5.5/conf/zoo.cfg dataDir=/opt/zookeeper/data dataLogDir=/opt/zookeeper/dataLog server.1=Gwj:2888:3888 server.2=Ssj:2888:3888 server.3=Pyf:2888:3888 (主机名, 心跳端口、数据端口)
按照上面的路径(可自定义路径和文件名)建立对应文件夹
并进入建立的data文件夹建立myid,各个节点myid要不同ssh
bin目录下(zookeeper分布式时要在每一个节点都进行启动)curl
zkServer.sh start/stop/status
ZooKeeper QuorumPeerMain
1. Cannot open channel to 3 at election address Pyf/xxx.xxx.xxx.xxx:3888 在zoo.cfg中将本机用节点 用 0.0.0.0 IP代替主机名 测试后未解决 检查防火墙 查看防火墙状态---systemctl status firewalld 关闭防火墙---systemctl status firewalld 开机禁用---systemctl disable firewalld 集群须要修改成dead状态 firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1) 已是dead状态,进行下一步排查 centos集群时间同步 查看当前时区---timedatectl 发现一个节点的时间不对,使用timedatectl set-timezone "Asia/Shanghai"修正时间 从新启动zookeeper,发现该问题解决 更多有关centos时间的操做详见https://www.cnblogs.com/zhi-leaf/p/6282301.html
2. 从机启动日志connect timed out 查询本机公网ip---curl icanhazip.com 查看内网ip---(在第一行显示)ifconfig -a 注释掉 127.0.0.1 的配置 事物日志与快照日志的查看方法 (忘记贴了) sshd端口测试,例: ssh -v -p 2888 root@Gwj 添加监听端口(问题解决后我的感受应该是由于端口没有打通,因此ssh没有自动对2888进行监听,之后发现问题时能够) firewall-cmd --query-port=2888/tcp firewall-cmd --add-port=2888/tcp --permanent(no) firewall-cmd --reload firewall-cmd --reload*(yes)