Hadoop 2.7.1基于QMJ高可用安装配置
1.修改主机名及hosts文件
10.205.22.185 nn1 (主)作用namenode,resourcemanager,datanode,zk,hive,sqoop
10.205.22.186 nn2 (备)作用namenode,resourcemanager,datanode,zk
10.205.22.187 dn1 作用datanode,zk
1.1配置ssh免密码登录
主节点能免密码登录各个从节点
ssh nn1
ssh nn2
ssh dn1
2. 安装jdk1.8和zookeeper,hive,sqoop可搭建成功后再安装
2.1修改profile文件,配置环境变量
export JAVA_HOME=/usr/java/jdk1.8.0_65
export JRE_HOME=/usr/java/jdk1.8.0_65/jre
export HADOOP_HOME=/app/hadoop-2.7.1
export HIVE_HOME=/app/hive
export SQOOP_HOME=/app/sqoop
export ZOOKEEPER_HOME=/app/zookeeper-3.4.6
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$ZOOKEEPER_HOME/bin:$HIVE_HOME/bin:$SQOOP_HOME/bin:$MAVEN_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
ulimit -SHn 65536
2.2 修改zookeeper配置文件zoo.cfg
添加:
server.1= nn1:2888:3888
server.2= nn2:2888:3888
server.3= dn1:2888:3888
3.安装hadoop-2.7.1,修改配置文件
创建相应的目录
mkdir -p /home/hadoop/tmp
mkdir -p /home/hadoop/hdfs/data
mkdir -p /home/hadoop/journal
mkdir -p /home/hadoop/name
修改slaves文件
nn1
nn2
dn1
修改hadoop-env.sh文件
export JAVA_HOME=/usr/java/jdk1.8.0_65
3.1配置hdfs-site.xml
<configuration>
<property>
<name>dfs.nameservices</name>
<value>masters</value>
</property>
<property>
<name>dfs.ha.namenodes.masters</name>
<value>nn1,nn2</value>
</property>
<property>
<name>dfs.namenode.rpc-address.masters.nn1</name>
<value>nn1:9000</value>
</property>
<property>
<name>dfs.namenode.http-address.masters.nn1</name>
<value>nn1:50070</value>
</property>
<property>
<name>dfs.namenode.rpc-address.masters.nn2</name>
<value>nn2:9000</value>
</property>
<property>
<name>dfs.namenode.http-address.masters.nn2</name>
<value>nn2:50070</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/home/hadoop/hdfs/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/home/hadoop/name</value>
</property>
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://nn1:8485;nn2:8485;dn1:8485/masters</value>
</property>
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/home/hadoop/journal</value>
</property>
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<property>
<name>dfs.client.failover.proxy.provider.masters</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
<property>
<name>dfs.ha.fencing.methods</name>
<value>sshfence</value>
</property>
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/root/.ssh/id_rsa</value>
</property>
<property>
<name>dfs.ha.fencing.ssh.connect-timeout</name>
<value>30000</value>
</property>
</configuration>
3.2配置core-site.xml文件