LoginSignup
7
10

More than 5 years have passed since last update.

HDPをAmbariでインストール

Last updated at Posted at 2016-04-19

HORTONWORKS DATA PLATFORM(HDP™)をApache Ambariで!

HDPをAmbariでインストールしてみます。
AmbariはHadoopの管理ツール、HDPはHORTONWORKSがリリースするHadoopディストリビューションの一つです。
前回は、Apacheがリリースしている素のHadoopをインストールしたのですが、比べると100倍ぐらい楽チンです。

今回も、まぁ、動いた!ぐらいまでなので、メモ程度です。

環境
 CentOS : 7.2 + 最新アップデート
   JAVA : jdk-8u77-linux-x64
  Cloud : IDCF Cloud
 Ambari : 2.2.1.1
    HDP : 2.4
MariaDB : mariadb-5.5.47-1.el7_2

※ AmbariはPostgreSQLを使うのですが、PostgreSQLそんなに知らないので、慣れているMySQLで構築しました。

ドキュメントはこちら

ドキュメントがかなり丁寧に書かれているので、手順に沿っていけば問題なくインストールできると思います。前述のMySQL使うなども、ちゃんと丁寧に記載されていました。なので、このドキュメントもあまり意味がなくて、メモ程度です。

ホストとデーモン

今回は、次のように割り振ろうと思います。

  • hdp1 : Ambari Server, MySQL Server, ZooKeeper Server, Metrics Collector
  • hdp2 : ZooKeeper Server, NameNode, WebHCat Server, Hive Metastore, HiveServer2
  • hdp3 : ZooKeeper Server, SNameNode, ResourceManager, MapReduce Job History Server, App Timeline Server
  • hdp4 : DataNode, NodeManager
  • hdp5 : DataNode, NodeManager
  • hdp6 : DataNode, NodeManager
  • hdp7 : Client

OSの準備

  • CentOS 7.2 + yum updateしておく。
  • JAVA8をインストールして置く。今回はOracleのJDKを利用しました。
  • localeを英語にしておく。localectl set-locale LANG=en_US.UTF-8
  • Ambari Serverをインストールするサーバから各サーバへsshでPassword-lessで入れるようにしておく。

※ 最初Localeが日本語のままではまりました。日本語のままだとAmbari-Agentが起動できません。

Ambariのレポジトリを登録

# wget -nv http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.2.0/ambari.repo -O /etc/yum.repos.d/ambari.repo

2016/11/21の最新は2.4.1.0です。(残りの手順はかわりありません。)

2.4.1.0
wget -nv http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.1.0/ambari.repo -O /etc/yum.repos.d/ambari.repo

Ambari Serverをインストール

# yum install ambari-server

※ PostgreSQLもインストールされますが、今回は使いません。

MariaDBのセットアップ

初期設定

# systemctl start mariadb
# mysql_secure_installation
/usr/bin/mysql_secure_installation: 行 379: find_mysql_client: コマンドが見つかりません

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
  • rootのパスワード以外は全部デフォルトでOK
  • 「行 379: find_mysql_client: コマンドが見つかりません」とか出てるけど、大丈夫みたいなので無視。

ユーザ作成

# mysql -u root -p

CREATE USER '<AMBARIUSER>'@'%' IDENTIFIED BY '<AMBARIPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<AMBARIUSER>'@'%';
CREATE USER '<AMBARIUSER>'@'localhost' IDENTIFIED BY '<AMBARIPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<AMBARIUSER>'@'localhost';
CREATE USER '<AMBARIUSER>'@'<AMBARISERVERFQDN>' IDENTIFIED BY '<AMBARIPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<AMBARIUSER>'@'<AMBARISERVERFQDN>';
FLUSH PRIVILEGES;
      <AMBARIUSER> : ambari
  <AMBARIPASSWORD> : 適当に
<AMBARISERVERFQDN> : Ambari ServerのFQDNを指定します。IDCF Cloudであれば、hostname -fで出てるFQDNを指定すればOKです。ex) hdp1.csdidcfcloud.internal

スキーマーの登録

# mysql -u root -p

CREATE DATABASE <AMBARIDATABASE>;
USE <AMBARIDATABASE>;
SOURCE /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
<AMBARIDATABASE> : ambari

Hive用のユーザも登録

Hiveも一緒にインストールかつ、Ambari用のMySQL(MariaDB)をそのまま使おうと思うので、Hive用のユーザも作っておく。

mysql -u root -p

CREATE USER '<HIVEUSER>'@'localhost' IDENTIFIED BY '<HIVEPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<HIVEUSER>'@'localhost';
CREATE USER '<HIVEUSER>'@'%' IDENTIFIED BY '<HIVEPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<HIVEUSER>'@'%';
CREATE USER '<HIVEUSER>'@'<HIVEMETASTOREFQDN>'IDENTIFIED BY '<HIVEPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<HIVEUSER>'@'<HIVEMETASTOREFQDN>';
FLUSH PRIVILEGES;
         <HIVEUSER> : hive
     <HIVEPASSWORD> : 適当に。
<HIVEMETASTOREFQDN> : Hive Metastore ServerのFQDNを指定します。IDCF Cloudであれば、hostname -fで出てるFQDNを指定すればOKです。ex) hdp2.csdidcfcloud.internal

AmbariもHiveもドキュメント通りですけど、%から受け入れだから、localhostとかFQDNとか意味ないんじゃ。。。

MySQL Connector/Jのインストール

# yum install mysql-connector-java

Ambariのセットアップ

# ambari-server setup
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...
Redirecting to /bin/systemctl status  iptables.service

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): 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/terms/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-8u60-linux-x64.tar.gz to /var/lib/ambari-server/resources/jdk-8u60-linux-x64.tar.gz
jdk-8u60-linux-x64.tar.gz... 100% (172.8 MB of 172.8 MB)
Successfully downloaded JDK distribution to /var/lib/ambari-server/resources/jdk-8u60-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...
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): 3
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):
Re-enter password:
Configuring ambari database...
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-MySQL-CREATE.sql
Proceed with configuring remote database connection properties [y/n] (y)?
Extracting system views...
ambari-admin-2.2.1.1.70.jar
......
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.

注意しなければならないのは、Enter advanced database configuration [y/n] (n)?yとして、MySQLをチョイスするところです。後はほぼ(パスワードとかDB名とかは作った物に合せる。)デフォルトでOKです。

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...
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へログイン

http://[your.ambari.server>]:8080
初期Username/Passwordはadmin/adminです。

※ IDCF Cloudの場合、Public IPアドレスとAmbari ServerのPrivateアドレスでポートフォワード(もしくはスタティックNAT)の設定をしてください。また、8080に対してファイアーフォールの許可の設定も必要です。

WizardでClusterをセットアップ

  1. Create a ClusterのLaunch Install Wizardをクリック。
  2. Name your clusterで適当なCluster名を指定。
  3. Select StackでHDP 2.4を指定。
  4. Target Hostsへhdp1からhdp7までのFQDNを改行区切りで指定。
  5. Provide your SSH Private Key to automatically register hostsでAmbari Serverから各サーバへPassword-lessでsshする為のPrivate Keyを指定
  6. 指定したホストが全台Successになるはず。Failedになる場合は、localの設定かPassword-lessでsshできないなどが考えられる。「Some warnings were encountered while performing checks against the 9 registered hosts above Click here to see the warnings.」でWarningが確認できるので、確認しましょう。おそらくntpdが起動してないと警告が出ていると思います。(CentOS7はntpdではなくchronyなので。)警告は解消して置いた方が良いと思います。
  7. Choose Servicesでは、今回はHDFS, YARN+MapReduce2, Tez, Hive, Pig, ZooKeeper, Ambari Metricsを選択します。
  8. Assign Mastersで、どのサービスをどのサーバへインストールするかを指定します。今回は、前述の通りで割当ます。
  9. Assign Slaves and ClientsでClientは全台、hdp4,hdp5,hdp6へDataNode,NFSGateway,NodeManagerを割当ます。
  10. Customize ServicesではHiveが赤くなっていると思いますので、Hive->AdvancedのHive DatabaseでExisting MySQL Databaseを選択、またDatabase Passwordを指定します。Test Connectionで接続チェックできます。(HDP-2.4.1.0の場合、予めデータベース(hive)を作っておかないと接続チェックに失敗します。あと、接続先も要注意。)ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jarをAmbari Server上で実行しておく必要があります。
  11. Reviewの後にDeployで各ノードへインストールが始まります。
  12. 全ノードがSuccessになれば完了です。

ということで、とっても簡単にHadoop Clusterを構築できます。
後はGUIからチクチク色々やってみましょう。(ノードの追加なんかもGUIから簡単にできます。)

PrestoもAmbariで

ambari-presto-serviceこれで、AmbariでPrestoもAmbariからインストールできます。

  • sudoの設定でrootの
7
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
10