Test enviroment : zoo1, zoo2, zoo3 cluster

1. Install zookeeper, package in kafka

[root@zoo1 ~]# pwd
/root
[root@zoo1 ~]# ls -l kafka_2.-1.1..tgz
-rw-r--r--. root root Mar : kafka_2.-1.1..tgz
[root@zoo2 ~]# pwd
/root
[root@zoo2 ~]# scp 192.168.1.51:/root/kafka_2.-1.1..tgz .
[root@zoo2 ~]# tar -xvf kafka_2.-1.1..tgz
[root@zoo2 ~]# mv kafka_2.-1.1. kafka
[root@zoo2 ~]# yum -y install java-1.8.-openjdk.x86_64

2.Configure hosts files

[root@zoo2 ~]#  vim /etc/hosts
192.168.1.51 zoo1
192.168.1.52 zoo2
192.168.1.53 zoo3

3.Create uniq myid

[root@zoo2 ~]#  vim /tmp/zookeeper/myid

4.Update zookeeper configuration files

[root@zoo2 ~]#  vim /root/kafka/config/zookeeper.properties
dataDir=/tmp/zookeeper
clientPort=
maxClientCnxns=
tickTime=
initLimit=
syncLimit=
server.=zoo1::
server.=zoo2::
server.=zoo3::

5.Start zookeeper services on zoo1, zoo2, zoo3

[root@zoo2 ~]#  systemctl stop firewalld
[root@zoo2 ~]# systemctl disable firewalld
[root@zoo2 ~]# /root/kafka/bin/zookeeper-server-start.sh /root/kafka/config/zookeeper.properties

6.Check Zookeeper running status

[root@zoo1 zookeeper]# ss -a -t |grep 192.168.1.51
ESTAB ::ffff:192.168.1.51:ciphire-serv ::ffff:192.168.1.52:
ESTAB ::ffff:192.168.1.51:ciphire-serv ::ffff:192.168.1.53:
ESTAB ::ffff:192.168.1.51:spcsdlobby ::ffff:192.168.1.53:
ESTAB ::ffff:192.168.1.51:spcsdlobby ::ffff:192.168.1.52:
[root@zoo1 zookeeper]# cat /etc/services |grep ciphire-ser
ciphire-serv /tcp # Ciphire Services
ciphire-serv /udp # Ciphire Services
[root@zoo1 zookeeper]# cat /etc/services |grep spcsd
spcsdlobby /tcp # SPCSDLOBBY
spcsdlobby /udp # SPCSDLOBBY

7.Repeat steps1-6 on zoo1, zoo2,zoo3

8.Check zookeeper cluster status by telnet server 2181 port

[root@zoo1 zookeeper]# telnet 192.168.1.51
Trying 192.168.1.51...
Connected to 192.168.1.51.
Escape character is '^]'.
conf
clientPort=
dataDir=/tmp/zookeeper/version-
dataLogDir=/tmp/zookeeper/version-
tickTime=
maxClientCnxns=
minSessionTimeout=
maxSessionTimeout=
serverId=
initLimit=
syncLimit=
electionAlg=
electionPort=
quorumPort=
peerType=
Connection closed by foreign host.
[root@zoo1 zookeeper]# telnet 192.168.1.52
Trying 192.168.1.52...
Connected to 192.168.1.52.
Escape character is '^]'.
conf
clientPort=
dataDir=/tmp/zookeeper/version-
dataLogDir=/tmp/zookeeper/version-
tickTime=
maxClientCnxns=
minSessionTimeout=
maxSessionTimeout=
serverId=
initLimit=
syncLimit=
electionAlg=
electionPort=
quorumPort=
peerType=
Connection closed by foreign host.
[root@zoo1 zookeeper]# telnet 192.168.1.53
Trying 192.168.1.53...
Connected to 192.168.1.53.
Escape character is '^]'.
conf
clientPort=
dataDir=/tmp/zookeeper/version-
dataLogDir=/tmp/zookeeper/version-
tickTime=
maxClientCnxns=
minSessionTimeout=
maxSessionTimeout=
serverId=
initLimit=
syncLimit=
electionAlg=
electionPort=
quorumPort=
peerType=
Connection closed by foreign host.

1 leader, 2 follower by default

[root@zoo1 zookeeper]# telnet 192.168.1.51
Trying 192.168.1.51...
Connected to 192.168.1.51.
Escape character is '^]'.
srvr
Zookeeper version: 3.4.-39d3a4f269333c922ed3db283be479f9deacaa0f, built on // : GMT
Latency min/avg/max: //
Received:
Sent:
Connections:
Outstanding:
Zxid: 0x100000000
Mode: leader
Node count:
Connection closed by foreign host.
[root@zoo1 zookeeper]# telnet 192.168.1.52
Trying 192.168.1.52...
Connected to 192.168.1.52.
Escape character is '^]'.
srvr
Zookeeper version: 3.4.-39d3a4f269333c922ed3db283be479f9deacaa0f, built on // : GMT
Latency min/avg/max: //
Received:
Sent:
Connections:
Outstanding:
Zxid: 0x1e5
Mode: follower
Node count:
Connection closed by foreign host.
[root@zoo1 zookeeper]# telnet 192.168.1.53
Trying 192.168.1.53...
Connected to 192.168.1.53.
Escape character is '^]'.
srvr
Zookeeper version: 3.4.-39d3a4f269333c922ed3db283be479f9deacaa0f, built on // : GMT
Latency min/avg/max: //
Received:
Sent:
Connections:
Outstanding:
Zxid: 0x100000000
Mode: follower
Node count:
Connection closed by foreign host.

Ctrl+c on zoo1, zoo3 change to leader auto(1 leader, 1 follower)

[root@zoo1 zookeeper]# telnet 192.168.1.51
Trying 192.168.1.51...
telnet: connect to address 192.168.1.51: Connection refused
[root@zoo1 zookeeper]# telnet 192.168.1.52
Trying 192.168.1.52...
Connected to 192.168.1.52.
Escape character is '^]'.
srvr
Zookeeper version: 3.4.-39d3a4f269333c922ed3db283be479f9deacaa0f, built on // : GMT
Latency min/avg/max: //
Received:
Sent:
Connections:
Outstanding:
Zxid: 0x100000000
Mode: follower
Node count:
Connection closed by foreign host.
[root@zoo1 zookeeper]# telnet 192.168.1.53
Trying 192.168.1.53...
Connected to 192.168.1.53.
Escape character is '^]'.
srvr
Zookeeper version: 3.4.-39d3a4f269333c922ed3db283be479f9deacaa0f, built on // : GMT
Latency min/avg/max: //
Received:
Sent:
Connections:
Outstanding:
Zxid: 0x200000000
Mode: leader
Node count:
Connection closed by foreign host.

ZooKeeper Commands: The Four Letter Words refer: http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_zkCommands

Kafka自我学习2-Zookeeper cluster的更多相关文章

  1. Kafka自我学习3-Scalable

    1.After created the zookeeper cluster, we found all broker cluster topic can be find in zoo1, zoo2, ...

  2. Kafka自我学习1-Multi-broker cluster

    ====================================Testing environment =========================================== ...

  3. Kafka自我学习-报错篇

    1. kafka启动出现:Unsupported major.minor version 52.0 错误,  具体的错误输出: Exception in thread "main" ...

  4. Why do Kafka consumers connect to zookeeper, and producers get metadata from brokers?

    Why do Kafka consumers connect to zookeeper, and producers get metadata from brokers? Ask Question u ...

  5. How to set an Apache Kafka multi node – multi broker cluster【z】

    Set a multi node Apache ZooKeeper cluster On every node of the cluster add the following lines to th ...

  6. kafka集群和zookeeper集群的部署,kafka的java代码示例

    来自:http://doc.okbase.net/QING____/archive/19447.html 也可参考: http://blog.csdn.net/21aspnet/article/det ...

  7. 安装 zookeeper cluster

    安装 zookeeper cluster zookeeper-3.4.5.tar.gz n0 10.69.10.193 n1 10.69.10.188 n2 10.69.10.192 n0 上解压 z ...

  8. UFLDL教程笔记及练习答案三(Softmax回归与自我学习***)

    :softmax回归 当p(y|x,theta)满足多项式分布,通过GLM对其进行建模就能得到htheta(x)关于theta的函数,将其称为softmax回归. 教程中已经给了cost及gradie ...

  9. CentOS7 搭建Kafka(一)zookeeper篇

    CentOS7 搭建Kafka(一)zookeeper篇 近几年当红小生Kafka备受各路英雄好汉追捧,一点不比老前辈RabbitMQ和ActiveMQ差,因为流行,所以你就得学啊:我这么懒,肯定是不 ...

随机推荐

  1. ABAP CDS ON HANA-(7)CDSビューでの集約

    Aggregate expression in CDS View An aggregate expression calculates a single value from an operand o ...

  2. javascript-es6学习笔记

    es6技术培训文档 第一阶段:1.let与const用法2.变量的解构赋值3.字符串的扩展4.正则的扩展5.数组的扩展6.函数的扩展7.对象的扩展8.Symbol9.Set和Map数据结构 第二阶段: ...

  3. 浅谈 kubernetes service 那些事 (下篇)

    欢迎访问网易云社区,了解更多网易技术产品运营经验. 五.K8s 1.8 新特性--ipvs ipvs与iptables的性能差异 随着服务的数量增长,IPTables 规则则会成倍增长,这样带来的问题 ...

  4. PowerMock简单使用

    网上有很多PowerMock的介绍,此处就不再罗列 下面给出一些资源地址以及几篇案例 mockito资源: (1)源码:https://github.com/mockito/mockito power ...

  5. react children技巧总结

    在使用该技巧时,建议先看一下相关的知识,点我查看 假如使用该属性时,想把父组件的所有属性及部分方法传递给子组件,该怎么办呢?看代码 const Child = ({ doSomething, valu ...

  6. MySQL高可用之MHA切换测试(switchover & failover)

      Preface       I've installed MasterHA yesterday,Now let's test the master-slave switch and failove ...

  7. 8.0 TochAction各种用法

    1.滑动---TouchAction  支持相对坐标.绝对坐标.Element 注意看顶部的导入TouchAction这个库.. #实例化 action = TouchAction(driver) # ...

  8. sqlserver2012 查询远程数据库

    EXEC sp_addlinkedserver 'LinkName','','SQLOLEDB','121.43.177.236'EXEC sp_addlinkedsrvlogin 'LinkName ...

  9. lintcode-119-编辑距离

    119-编辑距离 给出两个单词word1和word2,计算出将word1 转换为word2的最少操作次数. 你总共三种操作方法: 插入一个字符 删除一个字符 替换一个字符 样例 给出 work1=&q ...

  10. 【python】Python中给List添加元素的4种方法分享

    List 是 Python 中常用的数据类型,它一个有序集合,即其中的元素始终保持着初始时的定义的顺序(除非你对它们进行排序或其他修改操作). 在Python中,向List添加元素,方法有如下4种方法 ...