Elastic Cloud Enterprise のベースとなる AMI が提供されるようになりました

2017.03.17

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

こんにちは、藤本です。

現地時間 3/2、Elastic{ON}17 前に Elastic Cloud Enterprise の Beta バージョンがリリースされました。

触ろう、触ろう、と思っていたけどブログが忙しくてなかなか触れませんでした。

本日、ドキュメントを読んでいたところ、Elastic Cloud Enterprise を AWS 環境に展開することが簡単になったようなので早速試してみました。

Elastic Cloud Enterprise と AMI

Alpha バージョンでは Elastic Cloud Enterprise は Ubuntu 14.04、もしくは CentOS 7 上での動作をサポートしていました。Elastic Cloud Enterprise のインストール自体はシェルスクリプトで容易にインタラクティブにインストールできましたが、Docker インストールや、Kernel パラメータの設定など事前準備となる設定が若干面倒でした。インストールは下記をご参照ください。

そんな事前準備が Elastic Cloud Enterprise Beta バージョンから AWS 環境では不要となりました。AWS は AMI というイメージから OS を展開することができます。Elastic 社として、インストールの事前準備が整った AMI が提供されることとなりました。また AWS だけではなく、GCP でも提供を開始したようです。

試してみた

それではその AMI を利用して、Elastic Cloud Enterprise のインストール、および Elasticsearch クラスタの立ち上げを試してみましょう。

インスタンスを作成する

Launch Instance からコミュニティ AMI から「elastic-cloud-enterprise」で検索します。現在は Ubuntu 14.04、Ubuntu 16.04、CentOS 7 の 3種類が提供されています。

EC2_Management_Console

  • Ubuntu 14.04 : elastic-cloud-enterprise-trusty-20170302
  • Ubuntu 16.04 : elastic-cloud-enterprise-xenial-20170302
  • CentOS 7 : elastic-cloud-enterprise-centos-20170302

今回は東京リージョンにある Ubuntu 16.04 ベースの「elastic-cloud-enterprise-xenial-20170302 ami-b7b2e6d0」を利用してみます。通常通り、EC2 インスタンスを起動します。一点注意点として、インストール要件を満たしたインスタンスタイプを選択してください。今回は「r4.large」を利用しています。

SSH接続する

Elastic Cloud Enterprise のインスタンスは elastic ユーザーでログインすることが可能です。

$ ssh elastic@54.64.72.128
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-65-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

3 packages can be updated.
0 updates are security updates.


Last login: Thu Mar  2 12:09:59 2017 from 89.131.62.89

Elastic Cloud Enterprise をインストールする

ドキュメントに記載があるシェルスクリプトをダウンロードして、実行するだけでインストールできます。

$ bash <(curl -fsSL https://download.elastic.co/cloud/elastic-cloud-enterprise-installer.sh)
Unable to find image 'docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-beta1' locally
1.0.0-beta1: Pulling from cloud-enterprise/elastic-cloud-enterprise
0a8490d0dfd3: Pull complete
11afd5e53501: Pull complete
2263f0795d24: Pull complete
84de3c94b6b2: Pull complete
bcb47a4b8e33: Pull complete
f8eb98e8c10e: Pull complete
a49fd0ddd5fd: Pull complete
94afa918052f: Pull complete
f3d3b1be1887: Pull complete
b782c1cc5e27: Pull complete
ddf35dd9a7cc: Pull complete
5feb279d633f: Pull complete
c9cb84efca41: Pull complete
e6358940296d: Pull complete
c3d2ea8d24f3: Pull complete
f2f91c315212: Pull complete
Digest: sha256:d35a5bb72300b582d72a2d0dea215be061efc7ba05dd106cb05005734c618dea
Status: Downloaded newer image for docker.elastic.co/cloud-enterprise/elastic-cloud-enterprise:1.0.0-beta1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- Verifying Prerequisites --
Checking host storage path... PASSED
Checking docker version... PASSED
Checking internal ip connectivity... PASSED
Checking OS settings... PASSED
Checking OS kernel version... PASSED
Checking Minimum required memory... PASSED
-- Completed Verifying Prerequisites --

- Running Bootstrap container
- Monitoring bootstrap process
- Loaded bootstrap settings {}
- Pulling Elastic Stack images {}
- 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-beta1 {}
- Storing Elastic Stack versions: [2.4.4,5.2.0] {}
- Creating Admin Console Elasticsearch backend {}
- Applying Elasticsearch index template {}
- Updating dynamic Admin Console settings with Elasticsearch cluster information {}
- Starting reindexing Admin Console data {}
- Creating Logging and Metrics Cluster {}
- Enabling Kibana for Logging and Metrics Cluster {}
- Shutting down bootstrapper {}
- Exiting bootstrapper {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elastic Cloud Enterprise installation completed successfully

Administration Console Details:
Cloud UI URL: http://172.31.29.78:12400
Cloud UI URL: https://172.31.29.78:12443
Username: root
Password: hVDTyZ662Mt3jYCm1OSyruGzfoFsWcJs2EhYo0bSnzL

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.29.78
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

インストールはこれだけです。対話式のセットアップも必要なくなりました。

動作確認(Elastic Cloud Enterprise)

それでは Elastic Cloud Enterprise の Web管理コンソールへログインしてみます。インストールスクリプトの結果に記載された Cloud UI URL へアクセスします。インストールスクリプトは自動でhostip にローカルIPアドレスを取得するため、URL がプライベートIPアドレスになっていますが、EC2 インスタンスが持つパブリックIPアドレスでも接続可能です。Webブラウザからアクセスするとログイン画面が表示されます。同じくスクリプトの結果に記載されたユーザー名、パスワードを入力して、ログインします。

Log_in_–_Elastic_Cloud

EULA が表示されるますので、読んで、Agree します。

Clusters_–_Elastic_Cloud

Elastic Cloud Enterprise の管理画面が表示されました。Elasticsearch クラスタの一覧画面が表示されます。以前は Web管理コンソール用の Elasticsearch クラスタのみが動作していましたが、「logging-and-metrics」というのが新しく追加されています。Monitoring 用ですかね。こちらは後日調べてみます。

Clusters_–_Elastic_Cloud 2

Elasticsearch クラスタを作成する

続いて、Elasticsearch クラスタを起動します。右上の Create cluster ボタンをクリックします。

Clusters_–_Elastic_Cloud 2

Cluster Name を入力し、Create cluster をクリックします。Elasticsearch Cluster の作成が開始されます。

Create_Cluster_–_Elastic_Cloud

Elastic Cluod Enterprise 環境下で作成される Elasticsearch クラスタは X-Pack が導入されており、Security は有効化された状態で上がってきます。そのため、ユーザー名、パスワードは忘れずにメモっておきましょう。

Cluster_plans_–_Elastic_Cloud

完了しました。なんかオシャレな画面になってる。

Cluster_–_Elastic_Cloud

動作確認(Elasticsearch)

Elasticsearch Cloud Enterprise は名前ベースで接続する Elasticsearch クラスタの Endpoint でアクセスする名前でアクセスするように /etc/hosts を書き換えます。

Clusters_–_Elastic_Cloud

# echo '54.64.72.128 377914305741400dafa52d69e7ecf5a5.172.31.29.78.ip.es.io' >> /etc/hosts

Endpoint にアクセスしてみます。ベーシック認証でメモったユーザー名、パスワードをセットします。

# curl -u elastic:ozPsYS1XPIcOyzVnRAtHfHRJ 377914305741400dafa52d69e7ecf5a5.172.31.29.78.ip.es.io:9200
{
  "name" : "instance-0000000000",
  "cluster_name" : "377914305741400dafa52d69e7ecf5a5",
  "cluster_uuid" : "2oOCHFoaSd2goYltZJawkQ",
  "version" : {
    "number" : "5.2.0",
    "build_hash" : "24e05b9",
    "build_date" : "2017-01-24T19:52:35.800Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.0"
  },
  "tagline" : "You Know, for Search"
}

まとめ

いかがでしたでしょうか? Elastic 社が提供する AMI を利用することで Elastic Cloud Enterprise を容易にインストールすることができました。クラスタ環境を作成する時もElastic Cloud Enterprise を本番環境を想定して構築するのようにベースとなるコーディネータを指定することでクラスタに参加することが可能です。

参考リンク