Hadoop(HA)集群+Zookeeper实现高可用集群(2)

配置core-site.xml
在core-site.xml加入以下配置
master是整个服务的标识、以及配备了zookeeper的配置信息

<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://master</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/home/hadoopData/hdfs/temp</value> </property> <property> <name>io.file.buffer.size</name> <value>4096</value> </property> <!--zookeeper配置--> <property> <name>ha.zookeeper.quorum</name> <value>slave1:2181,slave2:2181,slave3:2181</value> </property> </configuration>

配置hdfs-site.xml

<configuration> <property> <name>dfs.namenode.name.dir</name> <value>/home/hadoopData/dfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>/home/hadoopData/dfs/data</value> </property> <property> <name>dfs.replication</name> <value>3</value> </property> <property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property> <property> <name>dfs.permissions.superusergroup</name> <value>staff</value> </property> <property> <name>dfs.permissions.enabled</name> <value>false</value> </property> <!-- NanmeNode主备切换核心配置 --> <property> <name>dfs.nameservices</name> <value>master</value> </property> <property> <name>dfs.ha.namenodes.master</name> <value>nn1,nn2</value> </property> <property> <name>dfs.namenode.rpc-address.master.nn1</name> <value>master:9000</value> </property> <property> <name>dfs.namenode.http-address.master.nn1</name> <value>master:50070</value> </property> <property> <name>dfs.namenode.rpc-address.master.nn2</name> <value>standby-master:9000</value> </property> <property> <name>dfs.namenode.http-address.master.nn2</name> <value>standby-master:50070</value> </property> <!-- 指定NameNode的元数据在JournalNode上的存放位置 --> <property> <name>dfs.namenode.shared.edits.dir</name> <value>qjournal://slave1:8485;slave2:8485;slave3:8485/master</value> </property> <!-- 指定JournalNode在本地磁盘存放数据的位置 --> <property> <name>dfs.journalnode.edits.dir</name> <value>/home/hadoopData/journal</value> </property> <!-- 开启NameNode故障时自动切换 --> <property> <name>dfs.ha.automatic-failover.enabled</name> <value>true</value> </property> <property> <name>dfs.client.failover.proxy.provider.master</name> <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value> </property> <property> <name>dfs.ha.fencing.methods</name> <value>sshfence</value> </property> <!--ssh免登陆 --> <property> <name>dfs.ha.fencing.ssh.private-key-files</name> <value>/root/.ssh/id_rsa</value> </property> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property> </configuration>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/ef3393dee93aa3571cf0067b5752555e.html