LoginSignup
1

More than 5 years have passed since last update.

virtualbox上のVMでkibanaとelasticsearchを動かす

Posted at

概要

この記事通り行うと、virtualbox上で作成したCentOS7で
elasticsearchとkibanaを動かせます。

この記事を書いたきっかけ

公式のチュートリアル をみるとサクッとできそうなのに
サクッとできなくて、困ったから書きました。

具体的にはmacに直接インストールしたり、クラウドサービス上の
サーバでやったときはサクッとできたのに、
virtualbox上のVMで行ったらconfigファイルを書き換えないと
アクセスできなかったので、解決方法を記載します。

前提

  • インターネットに接続できるVMが起動していること
  • ホストオンリーアダプタで疎通が取れること

バージョンとか諸設定

  • ホストOS:macOS sierra 10.12.5
  • ゲストOS:CentOS Linux release 7.3.1611 (Core)
  • elasticsearch:elasticsearch-5.4.1
  • kibana:kibana-5.4.1
  • virtualboxの設定
    • ネットワークアダプタ
      • NAT:DHCP
      • ホストオンリーアダプタ:DHCP
        (ゲストOSには192.168.56.101が割り振られています。)

準備

elasticsearchのダウンロードと展開

公式ホームページからcurlでダウンロードしてtarで展開する。
curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.tar.gz | tar zxf -

kibanaのダウンロードと展開

公式ホームページからcurlでダウンロードしてtarで展開する。

curl 'https://artifacts.elastic.co/downloads/kibana/kibana-5.4.1-linux-x86_64.tar.gz' | tar xzf -

configファイルの書き換え

elasticsearchのconfig.ymlの書き換え

  • 書き換えの対象ファイル

展開したディレクトリ/elasticsearch-5.4.1/config/elasticsearch.yml

  • 書き換え内容
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
network.host: 192.168.56.101  <- ホストオンリーアダプタのインターフェイスのIPアドレスを入力。
(中略
#
# Set a custom port for HTTP:
#
#http.port: 9200
http.port: 9200  <- コメントアウトを外す。
#
# For more information, consult the network module documentation.
#

kibanaのconfig.ymlの書き換え

  • 書き換えの対象ファイル
    展開したディレクトリ/kibana-5.4.1-linux-x86_64/config/kibana.yml
  • 書き換え内容
# Kibana is served by a back end server. This setting specifies the port to use.
#server.port: 5601
server.port: 5601  <- コメントアウトを外す。
# To allow connections from remote users, set this parameter to a non-loopback address.
#server.host: "localhost"
server.host: "192.168.56.101"  <- localhostをホストオンリーアダプタのインターフェイスのIPアドレスに書き換え。
(中略
# The URL of the Elasticsearch instance to use for all your queries.
#elasticsearch.url: "http://localhost:9200"
elasticsearch.url: "http://192.168.56.101:9200"  <- localhostをホストオンリーアダプタのインターフェイスのIPアドレスに書き換え。

elastiscsearch の実行

展開したディレクトリ/elasticsearch-5.4.1/ に移動して、
以下のコマンドで実行。
bin/elasticsearch &

kibana の実行

展開したディレクトリ/kibana-5.4.1-linux-x86_64/ に移動して
以下のコマンドで実行。
bin/kibana &

ブラウザでアクセスする。

http://192.168.56.101:5601 でアクセスすればOK。

おまけ:elasticsearchへのデータの登録

公式のチュートリアル をみるのがヨイヨイ!

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
1