Elastic Cloud Enterprise を本番環境を想定して構築する

2017.01.12

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

こんにちは、藤本です。

12月1日に Elastic Cloud Enterprise がリリースされました。

当ブログでも Elastic Cloud Enterprise の概要、AWS EC2 上へのシングルホストでの Elastic Cloud Enterprise の立ち上げのブログを書きました。

Elastic Cloud Enterprise を利用する規模の環境でシングルホストはまずないと思います。今回は本番環境を想定した複数ホストでのクラスタを構築します。今回はTopology Recomendationsに記載されている構成で構築します。

クラスタを構築してみた

環境

  • EC2 x 8台(3AZ)
    • Coodinator : 3台
    • Allocator : 3台
    • Proxy : 2台
    • インスタンスタイプ : r4.large
    • OS : Ubuntu 14.04(前回は CentOS、今回は Ubuntu で構築しています)
  • ELB
    • Elasticsearch、Kibana クラスタ用

絵にすると以下のような感じです。

complete

ホストのセットアップ

Elastic Cloud Enterprise を AWS 環境にデプロイしてみたOSセットアップをご参照ください。

1台目のインストール

1台目と、2台目以降では Elastic Cloud Enterprise のインストール方法が変わります。2台目以降はクラスタに組み込むために 1台目のホストのIPアドレスを指定します。

まずは 1台目です。前回は対話形式でインストールしましたが、今回はオプション指定します。ホスト名やインスタンス名、割り当てメモリは適宜環境に合わせてください。今回はインスタンスの Name を使って設定しています。

$ wget https://download.elasticsearch.org/cloud/elastic-cloud-enterprise-installer.sh
$ chmod u+x elastic-cloud-enterprise-installer.sh
$ CAPACITY=12288
$ INSTANCE_ID=$(curl 169.254.169.254/latest/meta-data/instance-id)
$ ZONE=$(curl 169.254.169.254/latest/meta-data/placement/availability-zone)
$ REGION=$(echo ${ZONE/%?/})
$ INSTANCE_NAME=$(aws --region ${REGION} ec2 describe-instances --instance-ids {INSTANCE_ID} --query "Reservations[0].Instances[0].Tags[?Key=='Name'].Value" --output text)
$ HOST_IP=$(curl 169.254.169.254/latest/meta-data/local-ipv4)

$./elastic-cloud-enterprise-installer.sh --installation-id ${INSTANCE_NAME} --public-host-name ${INSTANCE_NAME}.xxxxxxxxx.xyz --host-ip ${HOST_IP} --availability-zone ${ZONE} --capacity ${CAPACITY}
Unable to find image 'docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4' locally
1.0.0-alpha4: Pulling from cloud-enterprise/elastic-cloud-enterprise
3690ec4760f9: Pull complete
e75fbff20467: Pull complete
27452c761733: Pull complete
9d462f6fefc4: Pull complete
5a6f258d5a07: Pull complete
f7709a62228d: Pull complete
372c8e49d9d5: Pull complete
b842b3af6efd: Pull complete
4ddb19818ffc: Pull complete
612cacd1b411: Pull complete
086709959c54: Pull complete
00b2f98d0080: Pull complete
8658101ef634: Pull complete
353338694b4e: Pull complete
887b462d18ac: Pull complete
044091723e92: Pull complete
f3618ac16887: Pull complete
d2fe13c0d14a: Pull complete
Digest: sha256:afa84620f50ebee37ebaadd3c117d3dbfc0ea5c0602f4dd538cf14c238d4150a
Status: Downloaded newer image for docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elastic Cloud Enterprise Installer

Start setting up a new Elastic Cloud Enterprise installation by installing the software on your first host.
This first host becomes the initial coordinator and provides access to the Cloud UI, where you can manage your installation.
To learn more about the options you can specify, see the documentation.

NOTE: If you want to add this host to an existing installation, please specify the --coordinator-host flag
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- All configuration details have been supplied --

-- Verifying Prerequisites --
Checking host storage path... PASSED
Checking docker version... PASSED
Checking internal hostname connectivity... PASSED
Checking internal ip connectivity... PASSED
Checking OS settings... PASSED
-- Completed Verifying Prerequisites --

- Running Bootstrap container
- Monitoring bootstrap process
- Loaded bootstrap settings
- Starting local runner
- Started local runner
- Waiting for runner container node
- Runner container node detected
- Waiting for coordinator candidate
- Detected coordinator candidate
- Detected pending coordinator, promoting coordinator
- Coordinator accepted
- Storing current platform version: 1.0.0-alpha4
- Storing Elastic Stack versions: [2.4.1,5.0.2]
- Creating Admin Console Elasticsearch backend
- Applying Elasticsearch index template
- Updating dynamic Admin Console settings with Elasticsearch cluster information
- Starting reindexing Admin Console data
- Shutting down bootstrapper
- Exiting bootstrapper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elastic Cloud Enterprise Installer Completed Successfully

Administration Console Details:
URL: http://coodinator1.xxxxxx.xyz:12400 (See documentation for HTTPS details)
Username: root
Password: ECvS0WXay3wrqL954s2Qdd6QpwOwXSExsmtOtakep_M=

To add hosts to this Elastic Cloud Enterprise installation, include the following parameter when you install the software
on additional hosts: --coordinator-host 172.31.57.210
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error response from daemon: Unable to remove filesystem for 0d60aaa1b9e9c47ad886b4f8dbd5e136185c13d3d6f63f33e0ff3db874ced418: remove /mnt/data/docker/containers/0d60aaa1b9e9c47ad886b4f8dbd5e136185c13d3d6f63f33e0ff3db874ced418/shm: device or resource busy

1台目のホストは全てのロールを保持しているため、多くのコンテナが起動しています。WebUI、スケジューラ、アロケータ、プロキシ、Zookeeper、管理用Elasticsearchクラスタなど 15個のコンテナが起動しています。

$ CONTAINER ID        IMAGE                                                                      COMMAND                  CREATED             STATUS              PORTS                                                                                                  NAMES
78b7cc310d67        docker.elastic.co/cloud-enterprise/elasticsearch:2.4.1-1                   "/sbin/my_init --skip"   About an hour ago   Up About an hour    0.0.0.0:18526->18526/tcp, 0.0.0.0:19376->19376/tcp                                                     fac-0db6825fdb354c03baec8ba64435e81f-instance-0000000000
80cfff52a6be        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour    0.0.0.0:12400->5601/tcp, 0.0.0.0:12443->5643/tcp                                                       frc-cloud-uis-cloud-ui
5d4608bad0b3        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour    0.0.0.0:8764->8764/tcp, 0.0.0.0:12300->12300/tcp, 0.0.0.0:12343->12343/tcp                             frc-admin-consoles-admin-console
a82585df58a3        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour                                                                                                           frc-constructors-constructor
4676e9e5f380        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour                                                                                                           frc-upgraders-upgrader
1c52a3fdf8d4        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour                                                                                                           frc-services-forwarders-services-forwarder
07561fc3d81e        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour    0.0.0.0:2112->2112/tcp                                                                                 frc-directors-director
2a64829d052c        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour    0.0.0.0:12375->12375/tcp                                                                               frc-upgradables-upgradable
0169e04ce960        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour                                                                                                           frc-allocators-allocator
c30bd46d71dd        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour    0.0.0.0:9200->9200/tcp, 0.0.0.0:9243->9243/tcp, 0.0.0.0:9300->9300/tcp, 0.0.0.0:9343->9343/tcp         frc-proxies-proxy
44f1b3071c66        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour                                                                                                           frc-blueprints-blueprint
65c16b51a26f        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour                                                                                                           frc-runners-runner
22f107d90cb1        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour                                                                                                           frc-client-forwarders-client-forwarder
b7da56309ff1        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"          About an hour ago   Up About an hour    0.0.0.0:2191->2191/tcp, 0.0.0.0:12191->12191/tcp, 0.0.0.0:12898->12898/tcp, 0.0.0.0:13898->13898/tcp   frc-zookeeper-servers-zookeeper

2台目以降のインストール

続いて、2台目以降のインストールです。2台目以降は一台目のCoodinatorホストのクラスタに組み込むため、インストール実行結果に記載されているオプション--coordinator-host <<1台目のIPアドレス>>をインストールコマンドに追加します。こちらもホスト名、インスタンス名、割り当てメモリ値は環境に合わせてください。

$ wget https://download.elasticsearch.org/cloud/elastic-cloud-enterprise-installer.sh
$ chmod u+x elastic-cloud-enterprise-installer.sh
$ CAPACITY=12288
$ INSTANCE_ID=$(curl 169.254.169.254/latest/meta-data/instance-id)
$ ZONE=$(curl 169.254.169.254/latest/meta-data/placement/availability-zone)
$ REGION=$(echo ${ZONE/%?/})
$ INSTANCE_NAME=$(aws --region ${REGION} ec2 describe-instances --instance-ids ${INSTANCE_ID} --query "Reservations[0].Instances[0].Tags[?Key=='Name'].Value" --output text)
$ HOST_IP=$(curl 169.254.169.254/latest/meta-data/local-ipv4)
$ COODINATOR=$(aws --region ${REGION} ec2 describe-instances --filters "Name=tag:Name,Values=coodinator1" --query "Reservations[0].Instances[0].PrivateIpAddress" --output text)

$ ./elastic-cloud-enterprise-installer.sh --installation-id ${INSTANCE_NAME} --public-host-name ${INSTANCE_NAME}.fujimotoshinji.xyz --host-ip ${HOST_IP} --availability-zone ${ZONE} --capacity ${CAPACITY} --coordinator-host ${COODINATOR}
Unable to find image 'docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4' locally
1.0.0-alpha4: Pulling from cloud-enterprise/elastic-cloud-enterprise
3690ec4760f9: Pull complete
e75fbff20467: Pull complete
27452c761733: Pull complete
9d462f6fefc4: Pull complete
5a6f258d5a07: Pull complete
f7709a62228d: Pull complete
372c8e49d9d5: Pull complete
b842b3af6efd: Pull complete
4ddb19818ffc: Pull complete
612cacd1b411: Pull complete
086709959c54: Pull complete
00b2f98d0080: Pull complete
8658101ef634: Pull complete
353338694b4e: Pull complete
887b462d18ac: Pull complete
044091723e92: Pull complete
f3618ac16887: Pull complete
d2fe13c0d14a: Pull complete
Digest: sha256:afa84620f50ebee37ebaadd3c117d3dbfc0ea5c0602f4dd538cf14c238d4150a
Status: Downloaded newer image for docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elastic Cloud Enterprise Installer

Install Elastic Cloud Enterprise on this host to add its resources to an existing installation.
After installation is complete, the host becomes a runner that you can assign a role to in the Cloud UI.
To learn more about the options you can specify, see the documentation.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- All configuration details have been supplied --

-- Verifying Prerequisites --
Checking host storage path... PASSED
Checking docker version... PASSED
Checking internal hostname connectivity... PASSED
Checking internal ip connectivity... PASSED
Checking coordinator connectivity... PASSED
Checking OS settings... PASSED
-- Completed Verifying Prerequisites --

- Running Bootstrap container
- Monitoring bootstrap process
- Loaded bootstrap settings for additional host
- Core services started.
- Starting local runner
- Started local runner
- Waiting for runner container node
- Runner container node detected
- Updating containers (adding local client forwarder and runner)
- Updating containers (adding local client forwarder and runner)
- Shutting down additional host bootstrapper
- Exiting bootstrapper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elastic Cloud Enterprise Installer Completed Successfully

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error response from daemon: Unable to remove filesystem for 85e774c2b5dd904b29eece78559a7525ad7998dc5067765bee047af264ac4734: remove /mnt/data/docker/containers/85e774c2b5dd904b29eece78559a7525ad7998dc5067765bee047af264ac4734/shm: device or resource busy

2台目以降はサービスフォワーダー、アップダータのロールのみが割り当てられるため、4個のコンテナが起動しています。

docker ps
CONTAINER ID        IMAGE                                                                      COMMAND             CREATED             STATUS              PORTS                      NAMES
623b04f22ed8        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     8 minutes ago       Up 8 minutes        0.0.0.0:12375->12375/tcp   frc-upgradables-upgradable
246619f325e5        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     8 minutes ago       Up 8 minutes                                   frc-services-forwarders-services-forwarder
a39d0b48a9bb        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     8 minutes ago       Up 8 minutes                                   frc-runners-runner
0f1650470183        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     8 minutes ago       Up 8 minutes                                   frc-client-forwarders-client-forwarder

ロールを割り当てる

それでは 2台目以降のホストにそれぞれロールを割り当てていきましょう。

設定画面へ遷移

Coodinator の WebUI へアクセスします。

Platform から ece-region を選択します。

Regions_–_Elastic_Cloud

Runners を選択します。Runner は Docker が動作するホストを表します。インストール時に指定した InstallationID の名前でホストが表示されています。

Runners_–_Elastic_Cloud 2

Coodinator

まずは Coodinator ホストを設定します。Coodinator は管理系ホストとなります。WebUI、Zookeeperなどのコンテナが動作します。

Coodinator ホストを選択します。

Runners_–_Elastic_Cloud 3

Update roles を選択します。デフォルトではservices-forwarderupgradableがインストールされています。

Runner_roles_–_Elastic_Cloud 9

coodinatordirectorproxyをチェックし、Update roles をクリックします。

Runner_roles_–_Elastic_Cloud 10

Runner の一覧画面へ遷移します。

Runners_–_Elastic_Cloud_4

Coodinator ホストにcoodinatordirectorproxyが追加されました。

コンテナが 8個起動しました。

$ docker ps
CONTAINER ID        IMAGE                                                                      COMMAND             CREATED              STATUS              PORTS                                                                                                  NAMES
3925fe508024        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     About a minute ago   Up About a minute   0.0.0.0:2192->2192/tcp, 0.0.0.0:12192->12192/tcp, 0.0.0.0:12899->12899/tcp, 0.0.0.0:13899->13899/tcp   frc-zookeeper-servers-zookeeper
d1d997f1cbd9        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     About a minute ago   Up About a minute   0.0.0.0:2112->2112/tcp                                                                                 frc-directors-director
d2baba8ce060        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     About a minute ago   Up About a minute   0.0.0.0:8764->8764/tcp, 0.0.0.0:12300->12300/tcp, 0.0.0.0:12343->12343/tcp                             frc-admin-consoles-admin-console
b1b40d2d959a        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     About a minute ago   Up About a minute   0.0.0.0:12400->5601/tcp, 0.0.0.0:12443->5643/tcp                                                       frc-cloud-uis-cloud-ui
296e2a83e31c        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     About a minute ago   Up About a minute                                                                                                          frc-blueprints-blueprint
f8db624a3c46        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     About a minute ago   Up About a minute                                                                                                          frc-constructors-constructor
f2e260d8aa1b        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     About a minute ago   Up About a minute   0.0.0.0:9200->9200/tcp, 0.0.0.0:9243->9243/tcp, 0.0.0.0:9300->9300/tcp, 0.0.0.0:9343->9343/tcp         frc-proxies-proxy
0ce007270001        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     About a minute ago   Up About a minute                                                                                                          frc-upgraders-upgrader
a1796e66374d        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     3 minutes ago        Up 3 minutes                                                                                                               frc-services-forwarders-services-forwarder
f9d970c1074a        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     3 minutes ago        Up 3 minutes        0.0.0.0:12375->12375/tcp                                                                               frc-upgradables-upgradable
2734bd36c607        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     4 minutes ago        Up 4 minutes                                                                                                               frc-runners-runner
f5432e93bea9        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     4 minutes ago        Up 4 minutes                                                                                                               frc-client-forwarders-client-forwarder

Allocator

次は Allocator ホストを設定します。Allocator は Elasticsearch、Kibana クラスタが動作するホストとなります。

Allocator ホストを選択します。

Runners_–_Elastic_Cloud 4

Update roles を選択し、allocatorをチェックし、Update roles をクリックします。

Runner_roles_–_Elastic_Cloud 11

Runner の一覧画面へ遷移します。

Runners_–_Elastic_Cloud 5

Allocator ホストにallocatorが追加されました。

allocator コンテナが起動しました。

$ docker ps
CONTAINER ID        IMAGE                                                                      COMMAND             CREATED             STATUS              PORTS                      NAMES
b17b07f3d2b6        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     5 minutes ago       Up 5 minutes                                   frc-allocators-allocator
d8d6ae2788b3        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     7 minutes ago       Up 7 minutes        0.0.0.0:12375->12375/tcp   frc-upgradables-upgradable
e322f701e463        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     7 minutes ago       Up 7 minutes                                   frc-services-forwarders-services-forwarder
d1af48d0ce69        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     7 minutes ago       Up 7 minutes                                   frc-runners-runner
2ec947354c73        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     7 minutes ago       Up 7 minutes                                   frc-client-forwarders-client-forwarder

Proxy

次は Proxy ホストを設定します。Proxy は Elasticsearch、Kibana クラスタへのエンドポイントとなります。

Proxy ホストを選択します。

Runners_–_Elastic_Cloud 6

Update roles を選択し、allocatorをチェックし、Update roles をクリックします。

Runner_roles_–_Elastic_Cloud 12

Runner の一覧画面へ遷移します。

Runners_–_Elastic_Cloud 7

Proxy ホストにproxyが追加されました。

proxy コンテナが起動しました。

$ docker ps
CONTAINER ID        IMAGE                                                                      COMMAND             CREATED             STATUS              PORTS                                                                                            NAMES
900a02543538        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     6 minutes ago       Up 6 minutes        0.0.0.0:12375->12375/tcp                                                                         frc-upgradables-upgradable
20f04b1639bb        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     6 minutes ago       Up 6 minutes        0.0.0.0:9200->9200/tcp, 0.0.0.0:9243->9243/tcp, 0.0.0.0:9300->9300/tcp, 0.0.0.0:9343->9343/tcp   frc-proxies-proxy
2821cd77a0e7        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     6 minutes ago       Up 6 minutes                                                                                                         frc-services-forwarders-services-forwarder
2e8e6d867651        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     8 minutes ago       Up 8 minutes                                                                                                         frc-runners-runner
3da00e97e63d        docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-alpha4   "/sbin/my_init"     8 minutes ago       Up 8 minutes                                                                                                         frc-client-forwarders-client-forwarder

その他ホスト

その他ホストにも同様の手順でロールを割り当てます。

以下のようになればOKです。

Runners_–_Elastic_Cloud 8

一台目の Runner から Allocator の解除

一台目の Runner は全てのロールを割り当てられていますので、その他 Coodinator ホスト同様、Allocator 以外のロールとしたいため、Allocator ロールを外します。ただ一台目の Runner は Elastic Cloud Enterprise の管理用データがインデキシングされた Elasticsearch が動作しているため、そのまま Allocator を外すと、WebUI が正常に表示できなくなります。そのため、Allocator ロールを外す前に、Elasticsearch ノードが動作する Allocator を移動する必要があります。

Runners_–_Elastic_Cloud 9

Elasticsearch ノードの Allocator 間移動

Allocators を選択します。Elasticsearch ノードが乗っている coodinator1 を選択します。

Allocators_–_Elastic_Cloud

Move Nodes を選択します。Elasticsearch クラスタをチェックし、Move nodes をクリックします。

Move_Nodes_–_Elastic_Cloud 2

ステータス画面へ遷移します。

Activity_Feed_–_Elastic_Cloud

Allocator 一覧画面を確認してみると、allocator3のキャパシティが消費されており、ノードが立ち上がろうとしていることが推測できます。

Allocators_–_Elastic_Cloud 2

完了すると、coodinator1のキャパシティ消費がなくなります。

Allocators_–_Elastic_Cloud 3

これで、coodinator1から Elasticsearch ノードがなくなったので、Allocator ロールを外すことができます。

Allocator ロールの解除

ロールの解除は割り当て設定同様、チェックを外すだけです。

Runner_roles_–_Elastic_Cloud のコピー

Runner 一覧画面に戻ると、ロール毎に共通のロールが設定されていることがわかります。

Runners_–_Elastic_Cloud 2 のコピー

Proxy 用 ELB の作成

Proxy の可用性を高めるために、Proxy の前段に ELB を配置します。

  • インターナル ELB
  • リスナー:9243 -> 9243
  • インスタンス:proxy1、proxy2
  • ヘルスチェックパス:ヘルスチェックパスが分かりませんでした。。(一旦、coodinator を起動して、/:12300 をヘルスチェックパスとしました)

以上で、下記の構成の出来上がりです。

complete

動作確認

Elasticsearch クラスタ起動

左メニューの Clusters から Create Cluster をクリックします。

Clusters_–_Elastic_Cloud

Elasticsearch クラスタを設定します。シングルホストでは 1 zone しか選択できなかった Fault tolerance ですが、今回の 3 zone 構成だと、2 zones、3 zones を選択できるようになりました。ちなみに 2 zone 構成でも、2 zones は選択できません。Elastic Cloud Enterprise は Elasticsearch クラスタのスプリットブレイン対策で 2 zone 構成の場合も tiebreaker というコンテナを異なる zone への配置が必須となります。今回は 2 zones で設定します。その他はデフォルト設定のままとします。

Create_Cluster_–_Elastic_Cloud

Elasticsearch クラスタの作成を開始します。パスワードは同一セッション内でしか見れないので控えておいてください。

Cluster_plans_–_Elastic_Cloud

5分ほどで作成が完了します。

Cluster_plans_–_Elastic_Cloud 2

エンドポイントとなる URL を確認します。Overview を選択します。

screenshot_2017-01-09_11_30_31

Node に先ほど説明した tiebreaker が作成されています。

それでは ELB -> Proxy -> Allocator -> Elasticsearch へアクセスしてみましょう。アクセス URL は Endpoints のリンクの URL をご参照ください。

Elasticsearch クラスタへのアクセスは Proxy から名前ベースで対象インスタンスにアクセスするため、URL でのアクセスが必須です。本来は、Route 53 で設定するのがいいかと思います。今回は説明が長くなるので /etc/hosts で Elasticsearch クラスタのエンドポイントの FQDN と ELB の IPアドレスを紐付けます。curl コマンドでアクセスしてみます。

$ curl -k -u elastic:bgVjbYSfh60Q6sCooAgjGw== https://b3382af99309425bbfbbd2f71ee9e651.172.31.44.80.xip.io:9243/
{
  "name" : "instance-0000000001",
  "cluster_name" : "b3382af99309425bbfbbd2f71ee9e651",
  "cluster_uuid" : "OaxrbXpJR82twQ_Xx1fErA",
  "version" : {
    "number" : "5.0.2",
    "build_hash" : "f6b4951",
    "build_date" : "2016-11-24T10:07:18.101Z",
    "build_snapshot" : false,
    "lucene_version" : "6.2.1"
  },
  "tagline" : "You Know, for Search"
}

Elasticsearch ノードへアクセスできました。

まとめ

いかがでしたでしょうか?

ロール別、複数ホストによる構成を構築することができました。ドキュメントが英語で理解不足でかなり手こずりましたが、分かれば、構築するのは難しくありません。どういう風に動作しているのか分かっていないことがまだまだありますが。。次回からは色々な設定を少しづつご紹介していきます。