HDFS 구성에 대하여
Hadoop 구성하기 위해 NameNode 이중화 구성
, 네트워크에 따른 구성
등을 고려할 필요가 있다.
참조 : https://www.popit.kr/hadoop-namenode-%EC%9D%B4%EC%A4%91%ED%99%94-%EC%8B%9C-fencing-%EC%97%AD%ED%95%A0/
-
별도의 DNS 서버를 두지 않으므로, /etc/hosts 에
내부 대역 IP와 FQDN
을 작성 -
DataNode 에는
JBOD
파일 포맷을 지정 -
=zookeeper는
master01
,master02
,master03
NameNode 에 설치 -
hdfs-site.xml 에서
dfs.namenode.rpc-bind-host
,dfs.namenode.http-address
,dfs.namenode.https-address
,dfs.datanode.http.address
,dfs.datanode.https.address
,dfs.datanode.address
,dfs.datanode.ipc.address
를 0.0.0.0 으로 둬서 외부 서비스 대응
아래는 core-site.xml
과 hdfs-site.xml
이다.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.client.failover.proxy.provider.clustername</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
<property>
<name>ha.zookeeper.quorum</name>
<value>master01:2181,master02:2181,master03:2181</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/hadoop/nn</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/data01/dfs/dn,/data02/dfs/dn,/data03/dfs/dn,/data04/dfs/dn,/data05/dfs/dn,/data06/dfs/dn</value>
</property>
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/hadoop/jn</value>
</property>
<property>
<name>dfs.nameservices</name>
<value>clustername</value>
</property>
<property>
<name>dfs.ha.namenodes.clustername</name>
<value>namenode148,namenode192</value>
</property>
<property>
<name>dfs.namenode.rpc-bind-host</name>
<value>0.0.0.0</value>
</property>
<property>
<name>dfs.namenode.rpc-address.clustername.namenode148</name>
<value>master01:8020</value>
</property>
<property>
<name>dfs.namenode.servicerpc-address.clustername.namenode148</name>
<value>master01:8022</value>
</property>
<property>
<name>dfs.namenode.http-address.clustername.namenode148</name>
<value>0.0.0.0:9870</value>
</property>
<property>
<name>dfs.namenode.https-address.clustername.namenode148</name>
<value>0.0.0.0:9871</value>
</property>
<property>
<name>dfs.namenode.rpc-address.clustername.namenode192</name>
<value>master01:8020</value>
</property>
<property>
<name>dfs.namenode.servicerpc-address.clustername.namenode192</name>
<value>master02:8022</value>
</property>
<property>
<name>dfs.namenode.http-address.clustername.namenode192</name>
<value>0.0.0.0:9870</value>
</property>
<property>
<name>dfs.namenode.https-address.clustername.namenode192</name>
<value>0.0.0.0:9871</value>
</property>
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://master01:8485;master02:8485;master03/clustername</value>
</property>
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<property>
<name>dfs.ha.fencing.methods</name>
<value>sshfence(user:22)</value>
</property>
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/home/user/.ssh/id_rsa</value>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
<property>
<name>dfs.datanode.http.address</name>
<value>0.0.0.0:9864</value>
</property>
<property>
<name>dfs.datanode.https.address</name>
<value>0.0.0.0:9865</value>
</property>
<property>
<name>dfs.datanode.address</name>
<value>0.0.0.0:9866</value>
</property>
<property>
<name>dfs.datanode.ipc.address</name>
<value>0.0.0.0:9867</value>
</property>
<property>
<name>dfs.client.use.datanode.hostname</name>
<value>true</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
</configuration>