2017년 2월 9일 목요일

Hortonworks 2.4 설치 - 1/2 - Ambari서버 설치까지

설치방법 4가지
1. Automated (with Ambari 2.2)
2. Manual (RPMs)
3. Cloud (with Cloudbreak 1.2)
4. Windows


Ambari를 활용한 Automated방식이 뭔가 가장 쉬워보인다... 이걸로 시작
참조: http://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_Installing_HDP_AMB/content/ch_Getting_Ready.html


OS 는 CentOS 7으로 선택 다운로드시 CentOS-7-x86_64-Everything-1611.iso 같이 everything이 들어있는 미디어로 받았다.
참조: https://www.centos.org/download/
설치는 일단 최소 설치로 하였다.

Software Requirements 가 있다.
yum and rpm (RHEL/CentOS/Oracle Linux)
scp, curl, unzip, tar, and wget
OpenSSL (v1.01, build 16 or later)
Python (For CentOS 7, Ubuntu 12, Ubuntu 14, and Debian 7: Python 2.7.*)

위 항목 설치를 위해 yum repository구축하였다.
https://drunkendwcraft.blogspot.kr/2017/02/ambari-local-repository.html

내부 yum repository를 가르키도록 설정
. etc에 내부 yum repository를 참조하도록 repo설정 파일을 해당 경로로 지정한다.
vi /etc/yum.repos.d /birepos.repo

[birepos]
name=birepos Internal Repository
baseurl=http://10.203.9.208/repos/centos/iso/
enabled=1
gpgcheck=0



. yum repolist 목록에 뜨면 성공!
# yum repolist
...
birepos                        birepos Internal Repository    9,363
...


# mkdir -p /etc/yum.repos.d/ ~/etc/yum.repos.d/
[root@bidevkylinm1 yum.repos.d]# mv C*  ~/etc/yum.repos.d/
[root@bidevkylinm1 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
repo id                                                                                                                   repo name                                                                                                                                      status
birepos                                                                                                                   birepos Internal Repository                                                                                                                    9,363
repolist: 9,363

. repolist를 한개만 남겨두고 지워버리자
mkdir -p /etc/yum.repos.d/ ~/etc/yum.repos.d/
mv C* ~/etc/yum.repos.d/
yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
repo id            repo name          status
birepos            birepos              Internal Repository       9,363
repolist: 9,363
참조: https://www.lesstif.com/pages/viewpage.action?pageId=7634963

. 필수 software 설치
yum -y install unzip
yum -y install wget
# yum -y install openssl*
# yum -y install bind-utils

. jdk 1.8과 jce설치
# mkdir -p /usr/java
# cd /usr/java
# tar zxf ~/jdk-8u121-linux-x64.tar.gz
# ln -s /usr/java/jdk1.8.0_121/ /usr/java/default
# vi /etc/bashrc

export JAVA_HOME=/usr/java/default
export PATH=$JAVA_HOME/bin:$PATH

# source /etc/bashrc
# java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

# cd ~
# unzip -o -j -q jce_policy-8.zip -d /usr/java/jdk1.8.0_121/jre/lib/security/
http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.3/bk_installing_manually_book/content/meet-min-system-requirements.html#oracle-jdk-17-getting-started
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

. 노드 간의 passwordless-ssh 통신 구축
step1. Ambari Server host(m2 노드)에서 SSH key 생성
# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
35:89:26:c7:0d:6e:1a:86:bd:d3:81:dc:f6:5b:d2:07 root@bidevkylinm1.bikylinclust
The key's randomart image is:
+--[ RSA 2048]----+
|        .        |
|     + = + .     |
|    . B @ = E    |
|     . @ + o .   |
|      + S o o .  |
|       .   + .   |
|          .      |
|                 |
|                 |
+-----------------+


step2. 타겟 호스트(m1~3, d1~d3)의 ~/.ssh폴더에 id_rsa.pub파일을 복사한 후 파일을 이름을 "authorized_keys"로 바꿔 복사하는 작업이 필요한데 ssh-copy-id 명령으로 가능하다.

# ssh-copy-id -i ~/.ssh/id_rsa.pub root@10.203.9.218
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@bidevkylind1's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@bidevkylind1'"
and check to make sure that only the key(s) you wanted were added.


step3. Ambari Server에서 ssh를 사용해서 클러스터 호스트에 암호입력없이 접속 가능 확인

[root@bidevkylinm2 ~]# ssh root@10.203.9.218
Last login: Thu Feb  2 00:13:38 2017 from 10.149.186.145
[root@bidevkylind3 ~]#

http://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_Installing_HDP_AMB/content/_set_up_password-less_ssh.html

. dns서버설정 및 정방향 역방향 조회 확인
dns서버 구축한 후
링크: https://drunkendwcraft.blogspot.kr/2017/02/centos-7-dns-nscd.html

dns1을 설정하고서 network재시작 후 정방향 역방향 조회가 되면 성공
vi /etc/sysconfig/network-scripts/ifcfg-eth0
...
DNS1=10.203.9.208
...

# systemctl restart network
# nslookup bidevkylinm1
Server:         10.203.9.208
Address:        10.203.9.208#53

Name:   bidevkylinm1.bikylinclust
Address: 10.203.9.209

# nslookup 10.203.9.209
Server:         10.203.9.208
Address:        10.203.9.208#53

209.9.203.10.in-addr.arpa       name = bidevkylinm1.bikylinclust.

. nscd 서비스 설치
# yum -y install nscd
# systemctl enable nscd
Created symlink from /etc/systemd/system/multi-user.target.wants/nscd.service to /usr/lib/systemd/system/nscd.service.
Created symlink from /etc/systemd/system/sockets.target.wants/nscd.socket to /usr/lib/systemd/system/nscd.socket.
# systemctl start nscd

. ntp 서비스 설치
# yum -y install ntp
# systemctl enable ntpd
# systemctl start ntpd

  .firewall 서비스 stop
# systemctl stop firewalld
# systemctl disable firewalld

  .firewall 서비스를 사용한다면 필요한 허용 포트를 아래와 같이 추가
# firewall-cmd --zone=public --add-port=1521/tcp


 .selinux 끄기
# setenforce 0
# vi /etc/selinux/config
SELINUX=disabled

 . umask 0022 먹이기 (기본 생성 파일권한 755) 
# vi /etc/profile
umask 0022

. Check the Maximum Open File Descriptors 10000개 이상
 # ulimit -Sn
1024
# ulimit -Hn
4096
# ulimit -n 10000
# ulimit -Sn
10000
# ulimit -Hn
10000

. 각종 metastore로 postgresql 9.2를 선택하여 설치
master 1~3번기 중 2번기에 설치하기로 했다.
설치:
9.2 https://drunkendwcraft.blogspot.kr/2017/04/centos-7-postgresql-92.html
9.4 https://drunkendwcraft.blogspot.kr/2017/06/centos-7-postgresql-94.html

. postgress jdbc 설치
# yum -y install postgresql-jdbc*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

Installed:
  postgresql-jdbc.noarch 0:9.2.1002-5.el7                          postgresql-jdbc-javadoc.noarch 0:9.2.1002-5.el7

Dependency Installed:
  copy-jdk-configs.noarch 0:1.2-1.el7                              fontconfig.x86_64 0:2.10.95-10.el7
  fontpackages-filesystem.noarch 0:1.44-8.el7                      giflib.x86_64 0:4.1.6-9.el7
  java-1.8.0-openjdk.x86_64 1:1.8.0.102-4.b14.el7                  java-1.8.0-openjdk-headless.x86_64 1:1.8.0.102-4.b14.el7
  javapackages-tools.noarch 0:3.4.1-11.el7                         libICE.x86_64 0:1.0.9-2.el7
  libSM.x86_64 0:1.2.2-2.el7                                       libX11.x86_64 0:1.6.3-3.el7
  libX11-common.noarch 0:1.6.3-3.el7                               libXau.x86_64 0:1.0.8-2.1.el7
  libXcomposite.x86_64 0:0.4.4-4.1.el7                             libXext.x86_64 0:1.3.3-3.el7
  libXfont.x86_64 0:1.5.1-2.el7                                    libXi.x86_64 0:1.7.4-2.el7
  libXrender.x86_64 0:0.9.8-2.1.el7                                libXtst.x86_64 0:1.2.2-2.1.el7
  libfontenc.x86_64 0:1.1.2-3.el7                                  libjpeg-turbo.x86_64 0:1.2.90-5.el7
  libpng.x86_64 2:1.5.13-7.el7_2                                   libxcb.x86_64 0:1.11-4.el7
  libxslt.x86_64 0:1.1.28-5.el7                                    lksctp-tools.x86_64 0:1.0.17-2.el7
  python-javapackages.noarch 0:3.4.1-11.el7                        python-lxml.x86_64 0:3.2.1-4.el7
  ttmkfdir.x86_64 0:3.0.9-42.el7                                   tzdata-java.noarch 0:2016g-2.el7
  xorg-x11-font-utils.x86_64 1:7.5-20.el7                          xorg-x11-fonts-Type1.noarch 0:7.5-9.el7

Complete!

# chmod 644 /usr/share/java/postgresql-jdbc.jar
# ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/share/java/postgresql-jdbc.jar
Using python  /usr/bin/python
Setup ambari-server
Copying /usr/share/java/postgresql-jdbc.jar to /var/lib/ambari-server/resources
JDBC driver was successfully initialized.
Ambari Server 'setup' completed successfully.


. Ambari용 디비, 사용자 생성 
# sudo -u postgres psql
psql (9.2.18)
Type "help" for help.

postgres=# CREATE DATABASE ambaridb;
CREATE DATABASE
postgres=# CREATE USER ambariuser WITH PASSWORD '<AMBARIPASSWORD>';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE ambaridb TO ambariuser;
GRANT
postgres=# \connect ambaridb;
You are now connected to database "ambaridb" as user "postgres".
ambaridb=# CREATE SCHEMA ambari AUTHORIZATION ambariuser;
CREATE SCHEMA
ambaridb=# ALTER SCHEMA ambari OWNER TO ambariuser;
ALTER SCHEMA
ambaridb=# ALTER ROLE ambariuser SET search_path to ‘ambari’, 'public';
ALTER ROLE


. Hive용 디비, 사용자 생성 
# sudo psql -U postgres
Password for user postgres:
psql (9.2.18)
Type "help" for help.

postgres=# CREATE DATABASE hivedb;
CREATE DATABASE
postgres=# CREATE USER hiveuser WITH PASSWORD '<HIVEPASSWORD>';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE hivedb TO hiveuser;
GRANT
postgres=# \connect hivedb;
You are now connected to database "hivedb" as user "postgres".
hivedb=# CREATE SCHEMA hive AUTHORIZATION hiveuser;
CREATE SCHEMA
hivedb=# ALTER SCHEMA hive OWNER TO hiveuser;
ALTER SCHEMA
hivedb=# ALTER ROLE hiveuser SET search_path to hive, 'public';
ALTER ROLE
참조: http://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_ambari_reference_guide/content/_using_hive_with_postgresql.html

. Oozie용 디비, 사용자 생성 
# sudo psql -U postgres
Password for user postgres:
psql (9.2.18)
Type "help" for help.

postgres=# CREATE DATABASE ooziedb;
CREATE DATABASE
postgres=# CREATE USER oozieuser WITH PASSWORD '<OOZIEPASSWORD>';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE ooziedb TO oozieuser;
GRANT
postgres=# \connect ooziedb;
You are now connected to database "ooziedb" as user "postgres".
ooziedb=# CREATE SCHEMA oozie AUTHORIZATION oozieuser;
CREATE SCHEMA
ooziedb=# ALTER SCHEMA oozie OWNER TO oozieuser;
ALTER SCHEMA
ooziedb=# ALTER ROLE oozieuser SET search_path to oozie, 'public';
ALTER ROLE
ooziedb=#
참조: http://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_ambari_reference_guide/content/_using_oozie_with_postgresql.html


. 인터넷 연결이 없을때 Ambari Repositories를 구축해야 한다.
참조: https://drunkendwcraft.blogspot.kr/2017/02/ambari-local-repository.html?zx=c4557801edaeb21b

. Ambari Server 설치
다음 파일을 다운로드 받는다
http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.2.0/ambari.repo

내용을 다음과 같이 편집
#VERSION_NUMBER=2.2.2.0-460

[Updates-ambari-2.2.2.0]
name=ambari-2.2.2.0 - Updates
#baseurl=http://<web.server>/ambari-2.2.2.0/<OS>
baseurl=http://10.203.9.208/ambari-2.2.2.0/centos7/2.2.2.0-460/
gpgcheck=1
gpgkey=http://10.203.9.208/ambari-2.2.2.0/centos7/2.2.2.0-460/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1


/etc/yum.repos.d/ambari.repo 위치에 복사하여 yum repolist에 뜨는지 살펴본다.

# yum repolist
Loaded plugins: fastestmirror
Updates-ambari-2.2.2.0                                                                                               | 2.9 kB  00:00:00
Updates-ambari-2.2.2.0/primary_db                                                                                    | 6.3 kB  00:00:00
Loading mirror speeds from cached hostfile
repo id                                                         repo name                                                             status
Updates-ambari-2.2.2.0                                          ambari-2.2.2.0 - Updates                                                  8
birepos                                                         birepos Internal Repository                                           9,363
repolist: 9,371




설치 시작하면 일단 postgresql도 같이 깔린다.... 무시
# yum install ambari-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package ambari-server.x86_64 0:2.2.2.0-460 will be installed
--> Processing Dependency: postgresql-server >= 8.1 for package: ambari-server-2.2.2.0-460.x86_64
--> Running transaction check
---> Package postgresql-server.x86_64 0:9.2.18-1.el7 will be installed
--> Processing Dependency: postgresql-libs(x86-64) = 9.2.18-1.el7 for package: postgresql-server-9.2.18-1.el7.x86_64
--> Processing Dependency: postgresql(x86-64) = 9.2.18-1.el7 for package: postgresql-server-9.2.18-1.el7.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql-server-9.2.18-1.el7.x86_64
--> Running transaction check
---> Package postgresql.x86_64 0:9.2.18-1.el7 will be installed
---> Package postgresql-libs.x86_64 0:9.2.18-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================
 Package                             Arch                     Version                        Repository                                Size
============================================================================================================================================
Installing:
 ambari-server                       x86_64                   2.2.2.0-460                    Updates-ambari-2.2.2.0                   409 M
Installing for dependencies:
 postgresql                          x86_64                   9.2.18-1.el7                   birepos                                  3.0 M
 postgresql-libs                     x86_64                   9.2.18-1.el7                   birepos                                  232 k
 postgresql-server                   x86_64                   9.2.18-1.el7                   birepos                                  3.8 M

Transaction Summary
============================================================================================================================================
Install  1 Package (+3 Dependent packages)




ambaridb db스키마 생성문을 수행한다.
# psql -U ambariuser -d ambaridb
Password for user ambariuser:
psql (9.2.18)
Type "help" for help.

ambaridb=> \i /var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql
참조: http://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_ambari_reference_guide/content/_using_ambari_with_postgresql.html

yum install 이 끝나면 setup을 시작한다.
#  ambari-server setup --java-home=$JAVA_HOME
Using python  /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'disabled'
Customize user account for ambari-server daemon [y/n] (n)? n
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Redirecting to /bin/systemctl status  iptables.service
Unit iptables.service could not be found.

Checking JDK...
WARNING: JAVA_HOME /usr/java/default must be valid on ALL hosts
WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? y
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
==============================================================================
Enter choice (1): 4
Hostname (localhost): 127.0.0.1
Port (5432):
Database name (ambaridb): ambaridb 
Postgres schema (ambari): ambari
Username (ambari): ambariuser
Enter Database Password (bigdata):
Configuring ambari database...
Configuring remote database connection properties...
WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql
Proceed with configuring remote database connection properties [y/n] (y)? y
Extracting system views...
ambari-admin-2.2.2.0.460.jar
......
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.



. Ambari서버 시작
postgresql을 metastore로 설정했으므로 start파라미터가 붙는다
# ambari-server start --jdbc-db=postgres --jdbc-driver=/path/to/postgres/postgresql.jar
Using python  /usr/bin/python
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
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....................
Ambari Server 'start' completed successfully.
# ambari-server status
Using python  /usr/bin/python
Ambari-server status
Ambari Server running
Found Ambari Server PID: 3661 at: /var/run/ambari-server/ambari-server.pid
브라우저에서 접근해보자 로그인 창이 뜨면 성공!
http://ambarihost:8080/
기본 관리자 계정: admin / admin




댓글 없음:

댓글 쓰기