-
Notifications
You must be signed in to change notification settings - Fork 1
Pseudo distributed Hadoop(YARN) 설치
Jong cheol, Kim edited this page Aug 23, 2016
·
25 revisions
- Hadoop은 JDK가 설치되어 있어야 한다.
- Linux 서버에 JDK 설치는 Linux서버에 JDK 설치를 참고 한다.
-
Apache 다운로드 사이트에서 원하는 버전의 Hadoop 파일을 다운 받는다.
-
/usr/local/yarn 폴더를 생성한다. (root 권한)
- 설치 폴더는 원하는 곳에 따로 만들어도 된다.
sudo mkdir -p /usr/local/yarn
-
실행 계정 생성 (root 권한)
sudo groupadd hadoop sudo useradd -g hadoop yarn sudo useradd -g hadoop hdfs sudo useradd -g hadoop mapred
-
압축을 해제하고 소유자를 변경 한다.
- 아래 내용은 예시임.
cd /usr/local/yarn sudo tar zxvf /home1/testuser/hadoop-2.7.2.tar.gz sudo chown yarn:hadoop hadoop-2.7.2 -R sudo -u yarn mkdir -p hadoop-2.7.2/log sudo chmod g+w hadoop-2.7.2/log
-
데이터와 로그 디렉터리 생성 (root 권한 필요)
- 경로는 원하는곳을 따로 지정해도 된단.
- 아래 내용은 예시임.
sudo mkdir -p /data/hadoop/hdfs/nn sudo mkdir -p /data/hadoop/hdfs/snn sudo mkdir -p /data/hadoop/hdfs/dn sudo mkdir -p /log/hadoop/yarn sudo chown hdfs:hadoop /data/hadoop -R sudo chown yarn:hadoop /log/hadoop -R
-
core-site.xml 수정
- `fs.default.name' 속성은 HDFS의 메타데이터 서버인 네임노드(NameNode)의 호스트 이름과 포트를 나타냄
-
hadoop.http.staticuser.user
속성은 hdfs를 사용할 기본 사용자 이름을 나타냄 - 하둡 설치경로 (/usr/local/yarn/hadoop-2.7.2)의 etc/hadoop/core-site.xml 파일을 아래와 같이 수정한다.
- 전체 경로
/usr/local/yarn/hadoop-2.7.2/etc/hadoop/core-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>fs.defaultFS</name> <value>hdfs://localhost:9000</value> </property> <property> <name>hadoop.http.staticuser.user</name> <value>hdfs</value> </property> </configuration>
-
hdfs-site.xml 수정
- HDFS는 파일 시스템상의 각 파일에 대해 3개의 소본을 중복으로 갖고 있음.
- 단일 머신에는 중복으로 가지고 있을 이유가 없기 때문에 값을 1로 설정함.
- 하둡 설치경로 (/usr/local/yarn/hadoop-2.7.2)의 etc/hadoop/hdfs-site.xml 파일을 아래와 같이 수정한다.
- 전체 경로
/usr/local/yarn/hadoop-2.7.2/etc/hadoop/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.replication</name> <value>1</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/data/hadoop/hdfs/nn</value> </property> <property> <name>dfs.checkpoint.dir</name> <value>file:/data/hadoop/hdfs/snn</value> </property> <property> <name>dfs.checkpoint.edits.dir</name> <value>file:/data/hadoop/hdfs/snn</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/data/hadoop/hdfs/dn</value> </property> </configuration>
-
mapred-site.xml 수정
- 하둡 설치경로 (/usr/local/yarn/hadoop-2.7.2)의 etc/hadoop/mapred-site.xml.template 파일을 mapred-site.xml로 복사한다.
cp mapred-site.xml.template mapred-site.xml
- 전체 경로
/usr/local/yarn/hadoop-2.7.2/etc/hadoop/mapred-site.xml
<?xml version="1.0"?> <?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>mapreduce.framework.name</name> <value>yarn</value> </property> </configuration>
-
yarn-site.xml 수정
- 하둡 설치경로 (/usr/local/yarn/hadoop-2.7.2)의 etc/hadoop/yarn-site.xml 파일을 아래와 같이 수정한다.
- 전체 경로
/usr/local/yarn/hadoop-2.7.2/etc/hadoop/yarn-site.xml
<?xml version="1.0"?> <!-- 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. --> <configuration> <!-- Site specific YARN configuration properties --> <property> <name>yarn.nodemanager.aux-serivces</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.nodemanager.aux-serivces.mapreduce.shuffle.class</name> <value>org.apache.hadoop.mapred.ShuffleHandler</value> </property> </configuration>
-
hadoop 실행 환경 수정
- etc/hadoop/hadoop-env.sh 파일에서 Java 실행환경을 수정한다.
export HADOOP_HEAPSIZE="500" export HADOOP_NAMENODE_INIT_HEAPSIZE="500"
-
mapreduce 실행 환경 수정
- etc/hadoop/mapred-env.sh 파일에서 Java 실행환경을 수정한다.
export HADOOP_JOB_HISTORYSERVER_HEAPSIZE=256
-
yarn 실행 환경 수정
- etc/hadoop/yarn-env.sh 파일에서 Java 실행환경을 수정한다.
JAVA_HEAP_MAX=-Xmx500m
-
hdfs 포맷 (hdfs 계정)
- hdfs-site.xml의
dfs.namenode.name.dir
속성에 할당한 값의 디렉터리에 있는 모든 것을 포맷하고 새로운 파일 시스템을 구성
su - hdfs cd /usr/local/yarn/hadoop-2.7.2/bin ./hdfs namenode -format
- hdfs-site.xml의
-
NameNode, SecondaryNameNode, DataNode 시작 (hdfs 계정)
su - hdfs cd /usr/local/yarn/hadoop-2.7.2/sbin ./hadoop-daemon.sh start namenode ./hadoop-daemon.sh start secondarynamenode ./hadoop-daemon.sh start datanode
-
YARN 서비스 시작 (yarn 계정)
su - yarn cd /usr/local/yarn/hadoop-2.7.2/sbin ./yarn-daemon.sh start resourcemanager ./yarn-daemon.sh start nodemanager
/usr/local/java/jps
1330 NameNode
11394 Jps
11299 NodeManager
1446 SecondaryNameNode
10856 ResourceManager
10718 DataNode