4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Apache Ambari でクラスタ構築

Posted at

こちらの記事の続きになります。
Apache Ambari を Docker でインストール

Ambari サーバーのコンテナにログインしているものとします。

事前準備

ssh のインストール

Ambari では各ノードへのアクセス時に ssh コマンドを使用するため、インストールしておきます。
(Docker イメージ作成時にインストールしておいた方がよかった)

yum -y install openssh-server
yum -y install openssh-clients
# パスワードなしで接続できるようにしておきます
ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -q -N "" -t rsa -f /root/.ssh/id_rsa
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
# ssh サービスを起動します
systemctl start sshd.service
https://[hostname]:8440 is not reachable の回避

このままセットアップを続けていくと、Ambari でのクラスタの登録時に以下のようなエラーに出くわす可能性があります。

INFO 2019-MM-dd 02:07:50,730 NetUtil.py:70 - Connecting to https://host01.blueskyarea:8440/ca
ERROR 2019-MM-dd 02:07:50,735 NetUtil.py:96 - EOF occurred in violation of protocol (_ssl.c:618)
ERROR 2019-MM-dd 02:07:50,735 NetUtil.py:97 - SSLError: Failed to connect. Please check openssl library versions. 
Refer to: https://bugzilla.redhat.com/show_bug.cgi?id=1022468 for more details.
WARNING 2019-MM-dd 02:07:50,736 NetUtil.py:124 - Server at https://host01.blueskyarea:8440 is not reachable, sleeping for 10 seconds...

この状況を避けるため、以下の対応しておきます。
certificate validation の無効化

vi /etc/python/cert-verification.cfg
# -> verify=diable

2. ambari-agent のコンフィグ設定

vi /etc/ambari-agent/conf/ambari-agent.ini
# -> [security]
# force_https_protocol=PROTOCOL_TLSv1_2

クラスタ構築を開始する

ambari サーバースタート

ambari サーバーをスタートします。

[root@host01 /]# 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...
(中略)
サインイン & Install Wizard 開始

起動後、http://[hostname or ipaddress]:8080/ にアクセスし、サインインします。
ambari-login.PNG

構築を開始します。"Launch Install Wizard" をクリックします。
ambari-start.PNG

クラスタ命名

好きなクラスタ名を付けます。(ここでは、MyCluster)
ambari-cluster-name.PNG

HDPバージョン選択

せっかくなので、ここで選べる最新版を選択します。
※そもそもインストールしたHDPのバージョンがこの執筆時点での最新ではないです
パブリックリポジトリからソフトウェアをインストールするため、"Use Public Repository"が選択されている状態で次に進みます。

ambari-select-version.PNG

インストール対象サーバーのホスト名および、秘密鍵の設定

とりあえず、1台構成でチャレンジしてみたいと思います。
host01.blueskyarea
秘密鍵は直接貼り付けています。
ambari-install-option.PNG

インストールが開始されたようです。
ambari-installing.PNG

しかしながら、失敗してしまいました。
ambari-confirm-failure.PNG

エラー対応

ambari-agent のログを見てみると、サーバーへの接続に失敗しているようです。

# cat /var/log/ambari-agent/ambari-agent.log
->
INFO 2019-MM-dd 13:14:10,449 NetUtil.py:70 - Connecting to https://host01.blueskyarea:8440/ca
ERROR 2019-MM-dd 13:14:10,466 NetUtil.py:96 - EOF occurred in violation of protocol (_ssl.c:618)
ERROR 2019-MM-dd 13:14:10,466 NetUtil.py:97 - SSLError: Failed to connect. Please check openssl library versions. 
Refer to: https://bugzilla.redhat.com/show_bug.cgi?id=1022468 for more details.
WARNING 2019-MM-dd 13:14:10,466 NetUtil.py:124 - Server at https://host01.blueskyarea:8440 is not reachable, sleeping for 10 seconds...

このエラーへの対策は、先に実施した ”certificate validation の無効化” で行ったはずですが、それだけでは足りなかったようです。
/etc/ambari-agent/conf/ambari-agent.ini を開き、[security]の項に以下の1行を追加します。

[security]
(中略)
force_https_protocol=PROTOCOL_TLSv1_2

ambari-agent を再起動します。

ambari-agent restart
Restarting ambari-agent
(中略)

Retry Failed ボタンをクリックしてリトライさせると、今度は Success が出ました。
ambari-confirm-success.PNG

サービスの選択

インストールしたいサービスを選択します。
HDFS と YARN(+MapReduce2)だけ選択しましたが、Zookeeper と Ambari Metrics も必須ということで強制的に選択されました。

Master のアサイン

これらのサービスの Master が1つのホスト(正確には Docker のコンテナ)にインストールされることになります。
※個人のローカルPCには負担が大きそうです
ambari-masters.PNG

Slave and Client のアサイン

Slave と Client も1つのホストにインストールされることになります。
※ますます個人のローカルPCには負担が大きそうです
ambari-slave.PNG

Customize Service

サービスによって、admin 用のパスワードの設定を要求されますので、適当に設定します。
ambari-customize.PNG

Review

Review 画面が表示されますが、特に問題はなければ、Deploy ボタンをクリックします。
admin-review.PNG

Install, Start and Test

各サービスのインストールが開始されました。
ambari-install-service.PNG

完了までに一時間ほど掛かりました。
ambari-install-service2.PNG
ambari-summary.PNG
ダッシュボードが起動されました。
ambari-dashboard2.PNG

HDFS へのアクセス

HDFS にアクセスしてみます。

[root@host01 ~]# hdfs dfs -ls /
Found 7 items
drwxrwxrwx   - yarn   hadoop          0 2019-12-29 14:17 /app-logs
drwxr-xr-x   - yarn   hadoop          0 2019-12-29 14:05 /ats
drwxr-xr-x   - hdfs   hdfs            0 2019-12-29 14:06 /hdp
drwxr-xr-x   - mapred hdfs            0 2019-12-29 14:05 /mapred
drwxrwxrwx   - mapred hadoop          0 2019-12-29 14:07 /mr-history
drwxrwxrwx   - hdfs   hdfs            0 2019-12-29 14:08 /tmp
drwxr-xr-x   - hdfs   hdfs            0 2019-12-29 14:04 /user

なんとか動作してくれているようです。
手間のかかる HDFS のインストールを Ambari を使用することで簡単に実現できました。
と言いたいところですが、Ambari のインストールからセットアップまでが個人的にはエラー続出で大変でした。
あと、PCスペックの懸念から、最小限のサービスしか起動していません。
本来の目的である HiveやSparkなどを試すことになった場合に果たして動作可能であるのか、引き続き試行していくつもりです。

4
3
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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?