ログ解析のためにElasticsearch+Logstash+Kibanaを動かすためのdocker-compose.ymlを作成
# elasticsearch elasticsearch: image: khiraiwa/docker-elasticsearch:1.0.0 volumes: - /data_elasticsearch:/data_elasticsearch ports: - "9200:9200" - "9300:9300" # kibana kibana: image: khiraiwa/docker-kibana:1.0.0 volumes: - /data_kibana:/data_kibana ports: - "5601:5601" links: - elasticsearch:docker-elasticsearch # logstash logstash: image: khiraiwa/docker-logstash:1.0.0 volumes: - /data_logstash:/data_logstash links: - elasticsearch:docker-elasticsearch environment: - AWS_ACCESS_KEY_ID=dummy - AWS_SECRET_ACCESS_KEY=dummy # tdagent tdagent: image: khiraiwa/docker-tdagent:1.0.0 volumes: - /data_tdagent:/etc/td-agent links: - elasticsearch:docker-elasticsearch environment: - AWS_ACCESS_KEY_ID=dummy - AWS_SECRET_ACCESS_KEY=dummy
docker-compose実行
docker-compose up -d
あとはダウンロード、インストール、実行が終わるまで待つ
/vm/virtualmachine/docker/elasticsearch$ docker-compose up -d Removing elasticsearch_elasticsearch_1... Recreating a59fac6833_elasticsearch_elasticsearch_1... Recreating elasticsearch_tdagent_1... Pulling logstash (khiraiwa/docker-logstash:1.0.0)... 1.0.0: Pulling from khiraiwa/docker-logstash 9943fffae777: Already exists fb15e825cb68: Already exists b9583a207297: Already exists a3ed95caeb02: Pull complete d911ec1fa7cf: Pull complete f0c854dd1717: Pull complete 5380778f135e: Pull complete aed5c72d060f: Pull complete 08090ea0c159: Pull complete f37ecc1c5d68: Pull complete ed8769fe50aa: Pull complete 73e14b87d475: Pull complete Digest: sha256:bd50c6e4f09063e4b349838974478f03bd0e39271d378bbf30036a6fd6b3ec90 Status: Downloaded newer image for khiraiwa/docker-logstash:1.0.0 Creating elasticsearch_logstash_1... Pulling kibana (khiraiwa/docker-kibana:1.0.0)... 1.0.0: Pulling from khiraiwa/docker-kibana 8387d9ff0016: Pull complete 3b52deaaf0ed: Pull complete 4bd501fad6de: Pull complete a3ed95caeb02: Pull complete 6779bbe01753: Pull complete 0c358e156fc0: Pull complete cd518798f0c1: Pull complete c8c155b2eacb: Pull complete 5d565163900c: Pull complete 47aab7a97a6f: Pull complete 1286cc3f4894: Pull complete Digest: sha256:b568bb2f3d3ecd1d94589f5db0bdc0fadf1968dd0570673ab9c8627110928a97 Status: Downloaded newer image for khiraiwa/docker-kibana:1.0.0 Creating elasticsearch_kibana_1...
実行後の動作確認 Elasticsearch
/vm/virtualmachine/docker/elasticsearch$ curl localhost:9200 { "name" : "Grim Reaper", "cluster_name" : "elasticsearch", "version" : { "number" : "2.0.0", "build_hash" : "de54438d6af8f9340d50c5c786151783ce7d6be5", "build_timestamp" : "2015-10-22T08:09:48Z", "build_snapshot" : false, "lucene_version" : "5.2.1" }, "tagline" : "You Know, for Search" }
Kibana
“http://localhost:5601"へブラウザでアクセスする