2020년 11월 30일 월요일

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


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

. jdk 1.8 설치
Oracle JDK 경우
# 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

# cd ~
# unzip -o -j -q jce_policy-8.zip -d /usr/java/jdk1.8.0_121/jre/lib/security/
# 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)

OpenJDK 경우
# yum install java-1.8.0-openjdk-devel

# vi /etc/bashrc

export JAVA_HOME=/usr/lib/jvm/java
export PATH=$JAVA_HOME/bin:$PATH

# source /etc/bashrc
# java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)


. 노드 간의 passwordless-ssh 통신 구축
참조: http://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_Installing_HDP_AMB/content/_set_up_password-less_ssh.html
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.

# ssh root@bidevdruidm1.bidevclust
The authenticity of host 'bidevdruidm1.bidevclust (10.203.9.209)' can't be established.
ECDSA key fingerprint is a8:9b:e1:5f:9b:7e:ec:4b:fe:41:b6:c2:62:c6:38:04.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bidevdruidm1.bidevclust' (ECDSA) to the list of known hosts.
Last login: Wed Jun 14 22:04:51 2017 from 10.149.186.145
# exit
logout
Connection to bidevdruidm1.bidevclust closed.
# ssh root@bidevdruidm1.bidevclust
Last login: Thu Jun 15 13:46:53 2017 from bidevdruidm2.bidevclust
#

step3. root계정이 아닌 경우 해당 계정이 sudo명령으로 모든 명령을 수행할 수 있도록 설정하여야 한다.


# visudo -f /etc/sudoers.d/dwsnap
dwsnap ALL=(ALL) NOPASSWD:ALL
# exit

cat /etc/sudoers.d/dwsnap
cat: /etc/sudoers.d/dwsnap: Permission denied


$ sudo cat /etc/sudoers.d/dwsnap
dwsnap ALL=(ALL) NOPASSWD:ALL


. dns서버설정 및 정방향 역방향 조회 확인
참조: https://drunkendwcraft.blogspot.kr/2017/02/centos-7-dns-nscd.html
dns서버 구축 후 dns1을 설정하고서 network재시작 후 정방향 역방향 조회가 되면 성공

[root@bidevdruidm2 security]# nslookup bidevdruidd1.bidevclust
Server:         10.203.9.210
Address:        10.203.9.210#53

Name:   bidevdruidd1.bidevclust
Address: 10.203.9.216

[root@bidevdruidm2 security]# nslookup 10.203.9.210
Server:         10.203.9.210
Address:        10.203.9.210#53

210.9.203.10.in-addr.arpa       name = bidevdruidm2.bidevclust.
210.9.203.10.in-addr.arpa       name = www.bidevclust.
210.9.203.10.in-addr.arpa       name = ns.bidevclust.

[root@bidevdruidm2 security]#

. 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

내부 ntp가 있는 경우
# vi /etc/ntp.conf

# server 0.centos.pool.ntp.org iburst
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst
server 10.203.9.208
# systemctl start ntpd

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

.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로 postgres 10.5를 선택하여 설치
설치는 다음링크 참조
링크: https://drunkendwcraft.blogspot.kr/2017/06/centos-7-postgresql-94.html

그리고 모든 노드에 클라이언트 다음 2개를 설치한다.
postgresql10 - PostgreSQL client programs and libraries
postgresql10-libs - The shared libraries required for any PostgreSQL clients
그리고 모든 노드에 jdbc driver도 설치한다.
# sudo yum install postgresql-jdbc* 

# sudo find /usr -depth -name postgres*.jar

# ls -al /usr/share/java/postgresql-jdbc.jar
chmod 644 확인

. ambari server 설치
step 1. repository구축
repository가 구축되면 m2 서버에 repo파일을 만든다.
# vi /etc/yum.repos.d/ambari.repo
[ambari-2.7]
name=ambari repository
baseurl=http://10.203.9.208/ambari-2.7.1.0/centos7/2.7.1.0-169/
gpgcheck=1
gpgkey=http://10.203.9.208/ambari-2.7.1.0/centos7/2.7.1.0-169/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

step 2. ambari server yum설치
yum install을 하면 원래 postgresql 9.2가 같이 설치되는데 9.4가 설치되어 있으므로 dependency check를 통과했다.
# yum install ambari-server
Loaded plugins: fastestmirror
ambari-2.7                                                                                                                                                                                                                               | 2.9 kB  00:00:00   
ambari-2.7/primary_db                                                                                                                                                                                                                    |  25 kB  00:00:00   
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package ambari-server.x86_64 0:2.7.1.0-169 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================================================================================
 Package                                                          Arch                                                      Version                                                         Repository                                                     Size
================================================================================================================================================================================================================================================================
Installing:
 ambari-server                                                    x86_64                                                    2.7.1.0-169                                                     ambari-2.7                                                    353 M

Transaction Summary
================================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 353 M
Installed size: 419 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/ambari-2.7/packages/ambari-server-2.7.1.0-169.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 07513cad: NOKEY==========================================================================-    ]  65 MB/s | 339 MB  00:00:00 ETA
Public key for ambari-server-2.7.1.0-169.x86_64.rpm is not installed
ambari-server-2.7.1.0-169.x86_64.rpm                                                                                                                                                                                                     | 353 MB  00:00:06   
Retrieving key from http://10.203.9.208/ambari-2.7.1.0/centos7/2.7.1.0-169/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
Importing GPG key 0x07513CAD:
 Userid     : "Jenkins (HDP Builds) <jenkin@hortonworks.com>"
 Fingerprint: df52 ed4f 7a3a 5882 c099 4c66 b973 3a7a 0751 3cad
 From       : http://10.203.9.208/ambari-2.7.1.0/centos7/2.7.1.0-169/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ambari-server-2.7.1.0-169.x86_64                                                                                                                                                                                                             1/1
  Verifying  : ambari-server-2.7.1.0-169.x86_64                                                                                                                                                                                                             1/1

Installed:
  ambari-server.x86_64 0:2.7.1.0-169                                                                                                                                                                                                                          

Complete!



. Ambari, Ranger, Hive, Druid, Superset용 사용자 생성
# sudo -u postgres psql
Password:
psql (9.4.12)
Type "help" for help.

postgres=# 
CREATE DATABASE ambaridb;
CREATE USER ambariuser WITH PASSWORD '<PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE ambaridb TO ambariuser;
\connect ambaridb;
CREATE SCHEMA ambari AUTHORIZATION ambariuser;
ALTER SCHEMA ambari OWNER TO ambariuser;
ALTER ROLE ambariuser SET search_path to ambari, 'public';

CREATE DATABASE rangerdb;
CREATE USER rangeruser WITH PASSWORD '<PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE rangerdb TO rangeruser;


CREATE DATABASE hivedb;
CREATE USER hiveuser WITH PASSWORD '<PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE hivedb TO hiveuser;
\connect hivedb;
CREATE SCHEMA hive AUTHORIZATION hiveuser;
ALTER SCHEMA hive OWNER TO hiveuser;
ALTER ROLE hiveuser SET search_path to hive, 'public';

CREATE DATABASE druiddb;
CREATE USER druiduser WITH PASSWORD '<PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE druiddb TO druiduser;


CREATE DATABASE supersetdb;
CREATE USER supersetuser WITH PASSWORD '<PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE supersetdb TO supersetuser;
\connect supersetdb;
CREATE SCHEMA superset AUTHORIZATION supersetuser;
ALTER SCHEMA superset OWNER TO supersetuser;
ALTER ROLE supersetuser SET search_path to superset, 'public';

. Ambari용 데이터베이스 생성
ambariuser로 로그인하여 스크립트를 수행한다.
DDL문서는 Ambari서버 설치 후에 /var/lib/ambari-server/resources/ 경로에 있다.
# psql -h 127.0.0.1 -U ambariuser -d ambaridb
Password for user ambariuser:
psql (9.4.12)
Type "help" for help.

ambaridb=> \i /var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql
CREATE TABLE
...
ambaridb=> select count(1) from pg_tables where schemaname = 'ambari';
 count
-------
   111
(1 row)


. ambari-serversetup
postgresql로 metastore를 설정하는 부분만 설정해준다.
설정후 ambari-server가 사용할 postgresql jdbc driver경로를 지정해준다.

# ambari-server setup --java-home=$JAVA_HOME
/usr/sbin/ambari-server: line 74: /var/lib/ambari-server/ambari-env.sh: Permission denied
Using python  /usr/bin/python
Setup ambari-server
Traceback (most recent call last):
  File "/usr/sbin/ambari-server.py", line 30, in <module>
    from ambari_commons.exceptions import FatalException, NonFatalException
ImportError: No module named ambari_commons.exceptions
[scom@bidevsnapshotm2 /]$ sudo 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)?
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
WARNING: JAVA_HOME /usr/lib/jvm/java 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.
Check JDK version for Ambari Server...
JDK version found: 8
Minimum JDK version is 8 for Ambari. Skipping to setup different JDK for Ambari Server.
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)? y
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 / MariaDB
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
[7] - BDB
==============================================================================
Enter choice (1): 4
Hostname (localhost):
Port (5432):
Database name (ambari): ambaridb
Postgres schema (ambari):
Username (ambari): ambariuser
Enter Database Password (bigdata):
Re-enter password:
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.7.1.0.169.jar
....
Ambari repo file doesn't contain latest json url, skipping repoinfos modification
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.

# find -name postgres*.jar
/usr/lib/ambari-server/postgresql-42.2.2.jar
/usr/share/java/postgresql-jdbc.jar
/usr/share/java/postgresql-jdbc2.jar
/usr/share/java/postgresql-jdbc2ee.jar
/usr/share/java/postgresql-jdbc3.jar

# ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/lib/ambari-server/postgresql-42.2.2.jar
Using python  /usr/bin/python
Setup ambari-server
Copying /usr/lib/ambari-server/postgresql-42.2.2.jar to /var/lib/ambari-server/resources/postgresql-42.2.2.jar
Creating symlink /var/lib/ambari-server/resources/postgresql-42.2.2.jar to /var/lib/ambari-server/resources/postgresql-jdbc.jar
If you are updating existing jdbc driver jar for postgres with postgresql-42.2.2.jar. Please remove the old driver jar, from all hosts. Restarting services that need the driver, will automatically copy the new jar to the hosts.
JDBC driver was successfully initialized.
Ambari Server 'setup' completed successfully.

# 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.

. 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.
브라우저에서 접근해보자 로그인 창이 뜨면 성공!
http://ambarihost:8080/
기본 관리자 계정: admin / admin

댓글 없음:

댓글 쓰기