标签:=== ica 16px 独立 ping 不同 数据同步 dem 日志
NameNode 高可用
vim /usr/local/hadoop/etc/hadoop/core-site.xml
<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://nsdcluster</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/var/hadoop</value> </property> <property> <name>ha.zookeeper.quorum</name> <value>node1:2181,node2:2181,node3:2181</value> </property> <property> <name>hadoop.proxyuser.nsd1804.groups</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.nsd1804.hosts</name> <value>*</value> </property> </configuration>
vim /usr/local/hadoop/etc/hadoop/hdfs-site.xml
<configuration> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.nameservices</name> <value>nsdcluster</value> </property> <property> <name>dfs.ha.namenodes.nsdcluster</name> <value>nn1,nn2</value> </property> <property> <name>dfs.namenode.rpc-address.nsdcluster.nn1</name> <value>nn01:8020</value> </property> <property> <name>dfs.namenode.rpc-address.nsdcluster.nn2</name> <value>nn02:8020</value> </property> <property> <name>dfs.namenode.http-address.nsdcluster.nn1</name> <value>nn01:50070</value> </property> <property> <name>dfs.namenode.http-address.nsdcluster.nn2</name> <value>nn02:50070</value> </property> <property> <name>dfs.namenode.shared.edits.dir</name> <value>qjournal://node1:8485;node2:8485;node3:8485/nsdcluster</value> </property> <property> <name>dfs.journalnode.edits.dir</name> <value>/var/hadoop/journal</value> </property> <property> <name>dfs.client.failover.proxy.provider.nsdcluster</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.automatic-failover.enabled</name> <value>true</value> </property> </configuration>
vim /hadoop/etc/hadoop/mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>master:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>master:19888</value>
</property>
</configuration>
vim /usr/local/hadoop/etc/hadoop/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.ha.enabled</name>
<value>true</value>
</property>
<property>
<name>yarn.resourcemanager.ha.rm-ids</name>
<value>rm1,rm2</value>
</property>
<property>
<name>yarn.resourcemanager.recovery.enabled</name>
<value>true</value>
</property>
<property>
<name>yarn.resourcemanager.store.class</name>
<value>org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore</value>
</property>
<property>
<name>yarn.resourcemanager.zk-address</name>
<value>node1:2181,node2:2181,node3:2181</value>
</property>
<property>
<name>yarn.resourcemanager.cluster-id</name>
<value>yarn-ha</value>
</property>
<property>
<name>yarn.resourcemanager.hostname.rm1</name>
<value>nn01</value>
</property>
<property>
<name>yarn.resourcemanager.hostname.rm2</name>
<value>nn02</value>
</property>
</configuration>
#-----------------------------------------------------#
初始化启动集群
ALL: 所有机器
nodeX: node1 node2 node3
NN1: nn01
NN2: nn02
#-----------------------------------------------------#
ALL: 同步配置文件到所有集群机器
NN1: 初始化ZK集群 ./bin/hdfs zkfc -formatZK
nodeX: 启动 journalnode 服务
cd /usr/local/hadoop/
./sbin/hadoop-daemon.sh start journalnode
NN1: 格式化
./bin/hdfs namenode -format
NN2: 数据同步到本地 /var/hadoop/dfs
把NN1上 /var/hadoop/dfs 同步到 NN2上
./bin/hdfs namenode -initializeSharedEdits
./sbin/hadoop-daemon.sh stop journalnode
./sbin/start-all.sh
./sbin/yarn-daemon.sh start resourcemanager
./bin/hdfs haadmin -getServiceState nn1
./bin/hdfs haadmin -getServiceState nn2
./bin/yarn rmadmin -getServiceState rm1
./bin/yarn rmadmin -getServiceState rm2
./bin/hdfs dfsadmin -report
./bin/yarn node -list
./bin/hadoop fs -ls /
./bin/hadoop fs -mkdir hdfs://nsdcluster/input
./sbin/hadoop-daemon.sh stop namenode
./sbin/yarn-daemon.sh stop resourcemanager
./sbin/hadoop-daemon.sh start namenode
./sbin/yarn-daemon.sh start resourcemanager
标签:=== ica 16px 独立 ping 不同 数据同步 dem 日志
原文地址:https://www.cnblogs.com/zzc-log/p/9591917.html