1.安装jdk1.7,配置环境变量
下载jdk http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html
tar -zxvf ./jdk-7u71-linux-x64.tar.gz
配置环境变量
进入/etc/profile, 粘贴以下脚本到文件,保存文件。
export PATH=/usr/jdk1.7.0_71/bin:$PATH
export classpath=/usr/jdk1.7.0_71/lib
export JAVA_HOME=/usr/jdk1.7.0_7
2.下载zookeeper-3.4.6.tar.gz
http://apache.fayea.com/zookeeper/zookeeper-3.4.6/
3.解压zookeeper-3.4.6.tar.gz
tar -zvxf zookeeper-3.4.6.tar.gz
4.修改zookeeper-3.4.6/conf目录,修改zookeeper_sample.cfg为 zoo.cfg
cp zoo_sample.cfg zoo.cfg
5.配置zoo.cfg dataDir目录和log目录
# 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=/home/user/software/zookeeper-3.4.6/data
dataLogDir=/home/user/software/zookeeper-3.4.6/log
# 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.
#
# 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
参数说明:
tickTime:ZK中的一个时间单元。ZK所有时间都是以这个时间单元为基础,进行整数倍配置。例如session的最小超时时间是2*ticktime。
dataDir:zookeeper的工作目录,注释写得很清楚,只有测试环境才使用tmp目录,否则都建议进行专门的设置。
dataLogDir:zookerper日志输出的目录
clientPort:客户端的连接端口
maxClientCnxns:客户端最大连接数
clientport:客户端连接server的端口,即对外服务端口,一般设置为2181
6.启动zookeeper,进入bin目录
./zkServer.sh start
7.检查zookeeper是否启动成功,采用jps命令即可
出现如下内容说明启动成功
3129 Jps
2973 QuorumPeerMain
QuorumPeerMain这个进程就是zookeeper的进程。至此,zookeeper的单节点安装就成功了。
8.查看后台的zookeeper节点信息,进入bin目录执行如下命令
./zkCli.sh
相关推荐
通过右键单击类文件,选择"Run As" -> "Java Application"来运行Zookeeper服务器。 9. 测试你的改动:在修改了源代码后,你可以通过运行Zookeeper服务器并连接到它,测试你的改动是否按预期工作。 在深入研究源...
本文档主要讲述了使用 VMware 搭建伪分布式环境的步骤,包括虚拟机的安装、网络配置、JDK 的安装、Hadoop、HBase 和 Zookeeper 的安装等。 描述解读 该文档是根据老师讲的笔记记录的环境搭建笔记,供以后使用。该...
在实际的分布式系统中,Zookeeper作为一个可靠的中间件,帮助解决分布式环境下的数据一致性问题。本文将深入探讨Zookeeper的管理工具——ZooInspector。 **一、Zookeeper的概述** Zookeeper的设计目标是简化分布式...
云原生Java研讨会该研讨会的随附代码设置不论好坏,微服务都涉及很多活动部分... 转到Spring Initializr并选择每个复选框(与AWS,Zookeeper或Consul相关的复选框除外),然后单击Generate 。 在外壳程序中,运行mvn -
- **Apache Zookeeper**:Solr 使用 Zookeeper 进行集群管理,支持分布式环境下的高可用性和负载均衡。 - **企业级功能**:与 Lucene 不同的是,Solr 提供了更多的企业级功能,如高级全文搜索、模式和无模式配置支持...