4.安装zookeeper-3.4.2
下载zookeeper-3.4.2.tar.gz http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.2/zookeeper-3.4.2.tar.gz
将tar包解压到指定目录
tar zxvf zookeeper-3.4.2.tar.gz
修改zookeeper配置
将zookeeper安装目录下conf/zoo_sample.cfg重命名为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=/home/hadoop/zookeeper
# the port at which the clients will connect
clientPort=2181
server.1=hadoop01:2888:3888
server.2=hadoop02:2888:3888
server.3=hadoop03:2888:3888
#
# 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
在配置的dataDir目录下创建一个myid文件,里面写入一个0-255之间的一个随意数字,每个zookeeper上这个文件的数字要是不一样的
修改下面的内容变成你自己的服务器地址
server.1=hadoop01:2888:3888
server.2=hadoop02:2888:3888
server.3=hadoop03:2888:3888
分别启动所有的zookeeper
bin/zkServer.sh start
使用客户端连接zookeeper测试是否成功
bin/zkCli.sh -server ip地址:clientPort
2.修改hadoop安装目录下etc/hadoop/core-site.xml
加入以下内容
<!--fs.default.name for MRV1 ,fs.defaultFS for MRV2(yarn) -->
<property>
<name>fs.defaultFS</name>
<!--这个地方的值要和hdfs-site.xml文件中的dfs.federation.nameservices一致-->
<value>hdfs://dinglicom</value>
</property>
<property>
<name>ha.zookeeper.quorum</name>
<value>hadoop03:2181,hadoop04:2181,hadoop05:2181</value>
</property>
3.修改hdfs-site.xml