`
snrqtdhuqf
  • 浏览: 79266 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

apache zookeeper的安装、运行

 
阅读更多

进入http://zookeeper.apache.org/releases.html下载zookeeper的最新稳定版本,

当前稳定版本为zookeeper-3.4.6.tar.gz

 

解压到/usr/local/zookeeper

进入

[root@localhost conf]# pwd
/usr/local/zookeeper/zookeeper-3.4.6/conf

 修改zoo_sample.cfg为zoo.cfg

zoo.cfg文件内容为

[root@localhost conf]# cat zoo.cfg 
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# 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=/usr/local/zookeeper/data
# 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

 启动命令为

[root@localhost zookeeper-3.4.6]# bin/zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

 查看一下zookeeper的进程

[root@localhost zookeeper-3.4.6]# ps -ef|grep zookeeper
root      3360     1  7 07:51 pts/1    00:00:00 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /usr/local/zookeeper/zookeeper-3.4.6/bin/../build/classes:/usr/local/zookeeper/zookeeper-3.4.6/bin/../build/lib/*.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/netty-3.7.0.Final.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../zookeeper-3.4.6.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../src/java/lib/*.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
root      3381  2596  0 07:51 pts/1    00:00:00 grep zookeeper

 启动OK,

启动客户端连接服务

[root@localhost zookeeper-3.4.6]# bin/zkCli.sh -server 127.0.0.1:2181
Connecting to 127.0.0.1:2181
2014-05-12 07:51:32,888 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2014-05-12 07:51:32,896 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=localhost
2014-05-12 07:51:32,896 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.7.0_15
2014-05-12 07:51:32,904 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2014-05-12 07:51:32,904 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/java/jdk1.7.0_15/jre
2014-05-12 07:51:32,904 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/usr/local/zookeeper/zookeeper-3.4.6/bin/../build/classes:/usr/local/zookeeper/zookeeper-3.4.6/bin/../build/lib/*.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/netty-3.7.0.Final.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../zookeeper-3.4.6.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../src/java/lib/*.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../conf:
2014-05-12 07:51:32,904 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2014-05-12 07:51:32,905 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2014-05-12 07:51:32,907 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2014-05-12 07:51:32,907 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2014-05-12 07:51:32,907 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2014-05-12 07:51:32,907 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-279.el6.x86_64
2014-05-12 07:51:32,907 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
2014-05-12 07:51:32,908 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
2014-05-12 07:51:32,908 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/usr/local/zookeeper/zookeeper-3.4.6
2014-05-12 07:51:32,911 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=127.0.0.1:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@57830ec7
Welcome to ZooKeeper!
2014-05-12 07:51:32,968 [myid:] - INFO  [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@975] - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2014-05-12 07:51:32,996 [myid:] - INFO  [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@852] - Socket connection established to 127.0.0.1/127.0.0.1:2181, initiating session
[zk: 127.0.0.1:2181(CONNECTING) 0] 2014-05-12 07:51:33,172 [myid:] - INFO  [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@1235] - Session establishment complete on server 127.0.0.1/127.0.0.1:2181, sessionid = 0x145f0ea62770000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

 连接成功

 

分享到:
评论

相关推荐

    apache-zookeeper-3.6.3.zip

    1. **Java环境**:Zookeeper依赖Java运行环境,因此需要先安装JDK,并设置好`JAVA_HOME`环境变量。 2. **解压安装包**:使用`unzip apache-zookeeper-3.6.3.zip`命令将压缩包解压到一个合适的目录,如`/opt`或`/usr/...

    最新版windows apache-zookeeper-3.5.7-bin.tar.gz

    3. **lib** 目录:包含Zookeeper运行所需的JAR文件和其他依赖库。 4. **data** 目录:Zookeeper的数据存储位置,包括事务日志(log files)和快照(snapshots)。 5. **docs** 目录:可能包含用户手册、API参考等...

    apache-zookeeper-3.8.4-bin.tar

    1. **独立模式(Standalone)**:单个Zookeeper Server运行,适用于测试和学习,不适合生产环境。 2. **集群模式(Cluster)**:多个Zookeeper Server组成集群,提供高可用性和容错性。 3. **镜像模式(Mirror)**...

    apache-zookeeper-3.5.6-bin.tar

    安装 ZooKeeper 3.5.6 需要解压 `apache-zookeeper-3.5.6-bin.tar.gz`,然后配置 `conf/zoo.cfg` 文件,设置服务器节点的ID、ensemble的连接字符串(connectString)和其他配置参数。例如,`dataDir` 指定保存 ...

    apache-zookeeper-3.5.7-bin.tar.gz

    这个压缩包"apache-zookeeper-3.5.7-bin.tar.gz"是Zookeeper的可执行二进制文件包,用于在Linux或Unix类操作系统上部署和运行Zookeeper服务器。 **Zookeeper的基本概念:** 1. **节点(ZNode)**:Zookeeper的数据...

    apache-zookeeper-3.6.3-bin.zip

    六、验证Zookeeper运行状态 你可以通过`zkCli.cmd`命令启动Zookeeper的客户端,执行`stat`命令查看Zookeeper的状态。如果返回节点数、模式等信息,表示Zookeeper正在正常工作。 七、注意事项 - 安装过程中确保Java...

    zookeeper-3.8.0安装包下载

    1. 安装与配置:如何正确地安装 Zookeeper,包括修改配置文件、设置环境变量等。 2. 集群部署:如何配置多台机器组成 Zookeeper 集群,包括设置集群 ID、配置文件同步等。 3. 命令行操作:掌握基本的 zkCli.sh 命令...

    最新版linux apache-zookeeper-3.7.0-bin.tar.gz

    2. **Zookeeper的安装**: - 解压`apache-zookeeper-3.7.0-bin.tar.gz`到你选择的目录,例如 `/opt`. - 配置`conf/zoo.cfg`,设置数据目录(dataDir)和日志目录(dataLogDir),并根据需求调整其他配置。 - 初始...

    apache-zookeeper-3.7.0

    Apache ZooKeeper 是一个高度可靠的分布式协调服务,广泛应用于云原生环境中的服务发现、配置管理、锁服务等场景。ZooKeeper 的设计目标是简化分布式系统中的数据一致性问题,为分布式应用提供统一的服务目录和配置...

    apache-zookeeper-3.5.9-bin.tar.gz

    在"apache-zookeeper-3.5.9-bin.tar.gz"这个压缩包中,包含了Zookeeper 3.5.9版本的二进制发行版,用于在各种操作系统上部署和运行Zookeeper服务。 1. **Zookeeper基本概念** - **Znode**: Zookeeper中的数据存储...

    apache-zookeeper-3.5.8.tar.gz-Delete

    - 初始化数据目录,运行`bin/zkServer.sh start-foreground`启动ZooKeeper服务。 6. **Zookeeper在Hadoop和HBase中的应用:** - Hadoop中,Zookeeper用于NameNode的高可用,JobTracker的选举,以及HDFS的元数据...

    Apache ZooKeeper Essentials 2015

    值得一提的是,书中还强调了ZooKeeper的监控和管理,因为这些对于保证分布式系统的稳定运行至关重要。作者不仅介绍了ZooKeeper自身的监控工具,还讨论了如何集成外部监控系统。 此外,作者还分享了大量实际案例,...

    apache-zookeeper-3.5.8

    1. `apache-zookeeper-3.5.8-bin.tar.gz`:这是一个二进制包,包含了编译好的ZooKeeper可执行文件和其他运行所需的文件,如配置文件、日志文件等。用户解压后,可以按照官方文档的指示进行安装和配置。 2. `apache-...

    apache-zookeeper-3.6.0.tar.gz

    4. **容错策略**:了解 ZooKeeper 的故障恢复机制,以便在节点故障时能正常运行。 在部署和使用 Apache ZooKeeper 时,需要结合具体的业务场景和需求,对配置进行适当调整,以确保服务的稳定性和效率。同时,定期...

    apache-zookeeper-3.5.8-bin.tar.gz

    在Linux系统上安装Apache ZooKeeper 3.5.8版本,首先需要下载指定的压缩包文件"apache-zookeeper-3.5.8-bin.tar.gz"。这个文件包含了运行Zookeeper所需的所有二进制文件和配置文件。解压压缩包的命令通常为`tar -...

    最新版 apache-zookeeper-3.6.2-bin.tar.gz

    Apache ZooKeeper 是一个高度可靠的分布式协调系统,广泛应用于大数据、云计算和微服务等领域的服务发现、配置管理以及分布式锁等功能。3.6.2 版本是 Apache ZooKeeper 的一个重要更新,提供了诸多改进和修复,旨在...

    apache-zookeeper-3.5.10-bin.tar.gz

    12. **监控与维护**:定期检查ZooKeeper的日志和状态,确保所有服务器健康运行。可以使用JMX或ZooKeeper自带的监控接口进行监控。 通过以上步骤和知识点,你可以成功地在Linux环境下搭建和管理ZooKeeper集群,实现...

    apache-zookeeper-3.7.0-bin.zip

    2. 配置环境变量:在系统环境变量中添加ZOOKEEPER_HOME,值设定为解压后的目录(如“C:\Zookeeper\apache-zookeeper-3.7.0-bin”),并将Path环境变量追加%ZOOKEEPER_HOME%\bin,以便在命令行中直接运行Zookeeper...

Global site tag (gtag.js) - Google Analytics