본문 바로가기
Tech/Cloud

[Hadoop] ambari를 이용한 hadoop 설치

by 타이호 2018. 5. 9.
반응형

Hadoop을 설치 하기 위해서는 다양한 툴들이 있다. 여기서는 Hortonworks의 Ambari라는 툴을 이용하여 Hadoop을 구성해 본다. Ambari는 UI를 통해서 손 쉽게 구성을 할 수 있도록 지원해 준다.


사전 준비

  • VMWare(esxi)에 5개의 VM을 생성하고 Ubuntu 16.04 설치

  • Ambari 서버가 hadoop1번 서버에 설치가 될 예정이고, hadoop1 서버는 ssh를 통해 나머지 호스트에 비밀번호 없이 접근되어야 한다. (각 서버의 .ssh/authorized_keys 에 hadoop1에서 생성한 id_rsa.pub 키가 등록되어야 한다.)

  • Hadoop은 FQDN 기반이므로 각 서버의 /etc/hosts 파일에 동일하게 설정한다.

$ cat /etc/hosts

127.0.0.1 localhost


192.168.76.81 hadoop1.kangtaeho.com

192.168.76.82 hadoop2.kangtaeho.com

192.168.76.83 hadoop3.kangtaeho.com

192.168.76.84 hadoop4.kangtaeho.com

192.168.76.85 hadoop5.kangtaeho.com

  • /etc/hostname을 수정하여 hostname이 FQDN 형식으로 될 수 있도록 한다. (hostname -F /etc/hostname)

# hostname

hadoop1.kangtaeho.com

  • NTP로 시간이 동기화 되어 있어야 한다. ( sudo apt install ntp )

  • Python 2.7이 설치되어 있어야 한다.


Installation

설치는 Hortonworks에서 제공해주는 대로 설치하면 Ambari는 쉽게 설치가 된다.

https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.1.5/bk_ambari-installation/content/download_the_ambari_repo_debian7.html

  • Repository 설정 및 Key 등록

wget -O /etc/apt/sources.list.d/ambari.list http://public-repo-1.hortonworks.com/ambari/debian7/2.x/updates/2.6.1.5/ambari.list

apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD


  • Ambari 설치

sudo apt update && sudo apt install ambari-server


Setup

아래 명령어로 ambari server를 셋팅한다.

ambari-server setup

https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.1.5/bk_ambari-installation/content/set_up_the_ambari_server.html

기존의 db를 사용한다던지, custom 설정을 할게 아니면 그냥 default로 설치 한다.


# ambari-server setup

Using python  /usr/bin/python

Setup ambari-server

Checking SELinux...

WARNING: Could not run /usr/sbin/sestatus: OK

Customize user account for ambari-server daemon [y/n] (n)?

Adjusting ambari-server permissions and ownership...

Checking firewall status...

Checking JDK...

[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8

[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7

[3] Custom JDK

==============================================================================

Enter choice (1):

To download the Oracle JDK and the Java Cryptography Extension (JCE) Policy Files you must accept the license terms found at http://www.oracle.com/technetwork/java/javase/te

rms/license/index.html and not accepting will cancel the Ambari Server setup and you must install the JDK and JCE files manually.

Do you accept the Oracle Binary Code License Agreement [y/n] (y)?

Downloading JDK from http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-8u112-linux-x64.tar.gz to /var/lib/ambari-server/resources/jdk-8u112-linux-x64.tar.gz

jdk-8u112-linux-x64.tar.gz... 71% (124.1 MB of 174.7 MB)

jdk-8u112-linux-x64.tar.gz... 100% (174.7 MB of 174.7 MB)

Successfully downloaded JDK distribution to /var/lib/ambari-server/resources/jdk-8u112-linux-x64.tar.gz

Installing JDK to /usr/jdk64/

Successfully installed JDK to /usr/jdk64/

Downloading JCE Policy archive from http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-8.zip to /var/lib/ambari-server/resources/jce_policy-8.zip


Successfully downloaded JCE Policy archive to /var/lib/ambari-server/resources/jce_policy-8.zip

Installing JCE policy...

Checking GPL software agreement...

GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html

Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? Completing setup...

Configuring database...

Enter advanced database configuration [y/n] (n)?

Configuring database...

Default properties detected. Using built-in database.

Configuring ambari database...

Checking PostgreSQL...

Configuring local database...

Configuring PostgreSQL...

Restarting PostgreSQL

Creating schema and user...

done.

Creating tables...

done.

Extracting system views...

........ambari-admin-2.6.1.5.3.jar

...

Adjusting ambari-server permissions and ownership...

Ambari Server 'setup' completed successfully.


설치가 끝나고 나면 ambari-server를 시작해준다.

# ambari-server start

Using python  /usr/bin/python

Starting ambari-server

Ambari Server running with administrator privileges.

Organizing resource files at /var/lib/ambari-server/resources...

Ambari database consistency check started...

Server PID at: /var/run/ambari-server/ambari-server.pid

Server out at: /var/log/ambari-server/ambari-server.out

Server log at: /var/log/ambari-server/ambari-server.log

Waiting for server start...................................

Server started listening on 8080


DB configs consistency check: no errors and warnings were found.

Ambari Server 'start' completed successfully.


성공적으로 시작이 되면 해당 호스트의 8080 포트로 접속이 된다. ( admin / admin )


Hadoop 설치

Launch Install Wizard 를 이용하여 설치 한다.

  • Step0

Cluster 이름을 정의한다.

  • Step1

Hadoop의 버전을 선택하고, 사용할 Repository를 설정한다.

  • Step2

Target Hosts에는 FQDN으로 설치할 서버들의 정보를 넣어주고, Ambari서버의 .ssh/id_rsa 를 SSH Private Key에 넣어준다.

  • Step3

Ambari가 해당 호스트에 Ambari Agent를 설치하고 구성한다.

  • Step4

설치할 Hadoop 서비스들을 선택해서 설치 할 수 있다.

  • Step5

선택을 하고 나면 Ambari가 알아서 어느 호스트에 어떤 서비스를 설치할 것인지 정리를 해준다. 각 서비스에 들어가서 다른 호스트로 지정도 가능하다.

  • Step6

DataNode와 Client를 설치하는 것을 설정한다.

  • Step7

각 서비스 별로 필요한 설정은 빨간색으로 표시 된다. 보통 DB 비밀번호 등이 셋팅을 해야 하는 부분들이다.

  • Step8

최종 설치될 내용을 리뷰하는 부분이다. Deploy를 누르게 되면 각 호스트별로 서비스가 설치 된다.

  • Step9

각 서비스들이 설치 되는 과정을 보여준다

  • Step10

Hadoop 설치 시 ubuntu repository 문제로 인해  fail이 되었다.

E: Failed to fetch http://public-repo-1.hortonworks.com/HDP/ubuntu16/2.x/updates/2.6.4.0/pool/main/h/hadoop/hadoop-2-6-4-0-91_2.7.3.2.6.4.0-91_all.deb  Connection failed [IP: 54.230.249.68 80]




Trouble Shooting

Ubuntu는 repository가 문제가 있어서, Centos 7으로 설치를 진행한다.

설치를 진행하기 전에 ambari에서 mysql connector를 설정을 해준다. (안해주면 나중에 설치 할 때 에러가 난다)

yum install mysql-connector-java

ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar


Mysql-connector-java.jar는 수동으로 받아서 rpm으로 설치 하면 /usr/share/java/ 아래에 생성된다.


그리고 설치 시 아래와 같이 mysql 문제가 있는데,

resource_management.core.exceptions.ExecutionFailed: Execution of '/usr/bin/yum -d 0 -e 0 -y install mysql-community-release' returned 1. Error: Nothing to do

이 부분은 아래와 같이 수동으로 설치를 해준다

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm


Mysql-connector는 KST를 인식을 못해서 아래와 같은 에러가 발생한다.

Underlying cause: java.sql.SQLException : The server time zone value 'KST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

해결방법은 타임존을 Asia/Seoul로 지정하거나 mysql-connector-java 버전을 5.1.x 버전을 낮추어 사용한다.

타임존 변경은 timedatectl set-timezone UTC 으로 변경이 가능하다.


Customize Services 항목에서 Hive의 Tez 메모리는 512로 수정한다.




최종 설치 결과



반응형