博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ubuntu16.04安装zookeeper集群
阅读量:6814 次
发布时间:2019-06-26

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

root@node1:/usr/local/zookeeper-3.4.9# vim /etc/profile

#Zookeeper Home

export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.9

export PATH=$PATH:$ZOOKEEPER_HOME/bin

root@node1:/usr/local/zookeeper-3.4.9# mkidr data

root@node1:/usr/local/zookeeper-3.4.9# mkidr logs

root@node1:/usr/local/zookeeper-3.4.9# vim data/myid

1

root@node1:/usr/local/zookeeper-3.4.9# cp conf/zoo_sample.cfg conf/zoo.cfg

root@node1:/usr/local/zookeeper-3.4.9# vim conf/zoo.cfg 

dataDir=/usr/local/zookeeper-3.4.9/data

dataLogDir=/usr/local/zookeeper-3.4.9/logs

# the port at which the clients will connect

clientPort=2181

server.1=192.168.117.34:2888:3888

server.2=192.168.117.40:2888:3888

server.3=192.168.117.38:2888:3888

然后将配置文件复制到其它2个节点

root@node1:/usr/local/zookeeper-3.4.9# zkServer.sh start

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED

root@node1:/usr/local/zookeeper-3.4.9# zkServer.sh status

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg

Mode: follower

imokroot@node1:/usr/local/zookeeper-3.4.9# netstat -antlp | grep 2181

tcp        0      0 127.0.0.1:38052         127.0.0.1:2181          TIME_WAIT   -               

tcp6       0      0 :::2181                 :::*                    LISTEN      31064/java

root@node2:/usr/local/zookeeper-3.4.9# zkServer.sh start

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED

root@node2:/usr/local/zookeeper-3.4.9# zkServer.sh status

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg

Mode: leader

root@node3:/usr/local/zookeeper-3.4.9# zkServer.sh start

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED

root@node3:/usr/local/zookeeper-3.4.9# zkServer.sh status

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.9/bin/../conf/zoo.cfg

Mode: follower

连接Zookeeper集群

root@node1:/usr/local/zookeeper-3.4.9# zkCli.sh -server node1

Connecting to node1

2017-07-31 16:54:31,066 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT

2017-07-31 16:54:31,068 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=node1

2017-07-31 16:54:31,068 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_131

2017-07-31 16:54:31,069 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-8-openjdk-amd64/jre

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/usr/local/zookeeper-3.4.9/bin/../build/classes:/usr/local/zookeeper-3.4.9/bin/../build/lib/*.jar:/usr/local/zookeeper-3.4.9/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper-3.4.9/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper-3.4.9/bin/../lib/netty-3.10.5.Final.jar:/usr/local/zookeeper-3.4.9/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper-3.4.9/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper-3.4.9/bin/../zookeeper-3.4.9.jar:/usr/local/zookeeper-3.4.9/bin/../src/java/lib/*.jar:/usr/local/zookeeper-3.4.9/bin/../conf:.:/usr/lib/jvm/java-8-openjdk-amd64/lib://usr/lib/jvm/java-8-openjdk-amd64/jre/lib

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/local/cuda-8.0/lib64:/usr/local/cuda-8.0/lib64::/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=4.8.0-36-generic

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root

2017-07-31 16:54:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/usr/local/zookeeper-3.4.9

2017-07-31 16:54:31,071 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=node1 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@22d8cfe0

Welcome to ZooKeeper!

2017-07-31 16:54:31,084 [myid:] - INFO  [main-SendThread(node1:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server node1/192.168.117.34:2181. Will not attempt to authenticate using SASL (unknown error)

JLine support is enabled

2017-07-31 16:54:31,123 [myid:] - INFO  [main-SendThread(node1:2181):ClientCnxn$SendThread@876] - Socket connection established to node1/192.168.117.34:2181, initiating session

[zk: node1(CONNECTING) 0] 2017-07-31 16:54:31,196 [myid:] - INFO  [main-SendThread(node1:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server node1/192.168.117.34:2181, sessionid = 0x15d97c546110000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

[zk: node1(CONNECTED) 0]

本文转自    OpenStack2015 博客,原文链接:    http://blog.51cto.com/andyliu/1967311    如需转载请自行联系原作者

你可能感兴趣的文章
OpenJDK9 Hotspot:Zero 解释器 初探
查看>>
JS中bind方法与函数柯里化
查看>>
调查显示:明年容器企业级用户将出现井喷式增长
查看>>
官方实锤!微软宣布以 75 亿美元收购 GitHub
查看>>
一个Java架构进阶必修体系图(只要思想不滑坡,方法总比困难多) ...
查看>>
MySQL 是如何解决幻读的
查看>>
Some methods of deep learning and dimensionality reduction
查看>>
天马行空脚踏实地,阿里巴巴有群百里挑一的天才应届生 ...
查看>>
「镁客早报」高通称若没有苹果订单无需每年升级芯片;小米进行第二次回购 ...
查看>>
生产实践Kafka与ELK
查看>>
Eclipse的PropertiesEditor切换大小写
查看>>
Android多线程源码详解一:handler、looper、message、messageQueue
查看>>
SaaS加速器II 能力中心:互利互补 共享商业红利
查看>>
病毒木马防御与分析实战
查看>>
分布式工作流任务调度系统Easy Scheduler正式开源
查看>>
Flutter实战(一)写一个天气查询的APP
查看>>
Golang 入门系列(十) mysql数据库的使用
查看>>
Python零基础学习笔记(十二)—— 字符串及其常用方法
查看>>
数据脱敏平台-大数据时代的隐私保护利器
查看>>
区块链教程Fabric1.0源代码分析ledgerID数据库-兄弟连区块链教程
查看>>