在hadoop集群下启动zookeeper

.Hive全部版本下载地址:
***/dist/hive/
.HADOOP全部版本下载地址:
***/dist/hadoop/common/
.zookeeper全部版本地址下载
***/dist/zookeeper/
1.hadoop安装

安装前注意:
安装版本
hostname
hadoop
Hadoop 3.1.3
hadoop1
hadoop2
hadoop3
安装java环境
ip:148
ip:149
ip:150
java
jdk-11.0.15_linux-x64_bin.tar.gz
### 1.1.下载hadoop3.1.3版本和jdk
wget ***/dist/hadoop/common/hadoop-3.1.3/hadoop-3.1.3.tar.gzwget ***/java/jdk/8u181-b13/jdk-8u181-linux-x64.tar.gz1.2.配置环境变量
export JAVA_HOME=/usr/local/jdkexport JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATHexport HADOOP_HOME=/usr/local/hadoopexport PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbinexport HDFS_NAMENODE_USER=rootexport HDFS_DATANODE_USER=rootexport HDFS_SECONDARYNAMENODE_USER=rootexport YARN_RESOURCEMANAGER_USER=rootexport YARN_NODEMANAGER_USER=root【在hadoop集群下启动zookeeper】2.配置文件
2.1. core.site.xml
<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://hadoop1:9000</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/usr/local/hadoop/tmp</value> </property> <property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property></configuration>2.2. mapred-site.xml
<configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property></configuration>2.3. yarn-site.xml
<configuration><!-- Site specific YARN configuration properties --> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.resourcemanager.hostname</name> <value>hadoop1</value> </property> <property> <name>yarn.nodemanager.env-whitelist</name> <value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value> </property> <property> <name>yarn.webapp.ui2.enable</name> <value>true</value> </property> <property> <name>yarn.nodemanager.vmem-check-enabled</name> <value>false</value> </property></configuration>2.4. hdfs-site.xml
<configuration> <property> <name>dfs.namenode.name.dir</name> <value>/usr/local/hadoop/hdfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>/usr/local/hadoop/hdfs/data</value> </property> <property> <name>dfs.replication</name> <value>3</value> </property> <property> <name>dfs.permissions</name> <value>false</value> </property></configuration>2.5.hadoop-env.sh
export JAVA_HOME=/usr/local/jdk
2.6. workers
hadoop1
hadoop2
hadoop3
2.7.格式化
hadoop namenode -format2.8 启动
start-all.sh
提示:记住分发配置文件
zookeeper配置
版本:zookeeper-3.4.10.tar.gz
上传软件包解压到指定目录:tar -xvf zookeeper-3.4.10.tar.gz -C /usr/local创建zk的存储目录:mkdir /usr/local/zookeeper-3.4.10/zkData创建myid:cd 到zkData目录下 echo 1 >myid myid三台的id要改hadoop1:myid 1hadoop2:myid 2hadoop3:myid 3
修改配置文件
cd /usr/local/zookeeper-3.4.10/confcp zoo_sample.cfg zoo.cfg vim zoo.cfg dataDir=/usr/local/zookeeper-3.4.10/zkData server.1=hadoop1:2888:3888 server.2=hadoop2:2888:3888 server.3=hadoop3:2888:3888
配置环境变量
vim /etc/profileexport ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.10export PATH=$PATH:$ZOOKEEPER_HOME/binsource /etc/profile
分发文件
scp -r /usr/local/zookeeper-3.4.10 centos02:/usr/localscp -r /usr/local/zookeeper-3.4.10 centos03:/usr/localscp -r /etc/profile hadoop2:/etcscp -r /etc/profile hadoop3:/etcsource /etc/profile 生效
启动
hadoop1:zkServer.sh starthadoop2:zkServer.sh starthadoop3:zkServer.sh startzkServer.sh status 查看状态显示:Mode: leader Mode: followerMode: follower 高可用安装完成


    推荐阅读