Hadoop的HA(ZooKeeper)安装与部署

非HA的步骤:

https://www.cnblogs.com/live41/p/15467263.html

 

一、部署设定

1.服务器

c1   192.168.100.105    zk、namenode、zkfc、datanode、nodemanager
c2   192.168.100.110    zk、namenode、zkfc、datanode、nodemanager、resourcemanager、journalnode
c3   192.168.100.115    zk、datanode、nodemanager、resourcemanager、journalnode
c4   192.168.100.120    zk、datanode、nodemanager、resourcemanager、journalnode

 

2.目录

hadoop namenode目录   /home/hadoop/hdfs/name
hadoop datanode目录     /home/hadoop/hdfs/data
hadoop临时目录           /home/hadoop/tmp
zookeeper数据目录     /home/zookeeper/data/
zookeeper日志目录     /home/zookeeper/logs/

 

二、系统配置

跟下面文章的第二点一样

https://www.cnblogs.com/live41/p/15467263.html

 

三、下载及配置环境变量

1.下载及解压

https://downloads.apache.org/hadoop/common/

http://zookeeper.apache.org/releases.html

解压到/home/目录

 

 

2.配置环境变量

vim ~/.bashrc

在末尾加入以下内容:

export HADOOP_HOME=/home/hadoop
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:/home/zookeeper/bin

export HADOOP_COMMON_HOME=/home/hadoop
export HADOOP_HDFS_HOME=/home/hadoop
export HADOOP_MAPRED_HOME=/home/hadoop
export HADOOP_CONF_DIR=/home/hadoop/etc/hadoop

export HDFS_DATANODE_USER=root
export HDFS_NAMENODE_USER=root
export HDFS_SECONDARYNAMENODE_USER=root

export YARN_HOME=/home/hadoop
export YARN_RESOURCEMANAGER_USER=root
export YARN_NODEMANAGER_USER=root

 

三、安装和配置ZooKeeper

1.创建data和logs目录

mkdir -pv /home/zookeeper/{data,logs} 

 

2.编辑zoo.cfg

cd /home/zookeeper/conf
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg

修改属性或添加内容:

tickTime=2000
initLimit=10
syncLimit=5
clientPort=2181

dataDir=/home/zookeeper/data/
dataLogDir=/home/zookeeper/logs

server.1=c1:2888:3888
server.2=c2:2888:3888
server.3=c3:2888:3888
server.4=c4:2888:3888

 

上一篇:配置文件格式化对齐


下一篇:2021-09-22 PAT甲级