由于经常使用,可以使用Docker Compose一键启动Elasticsearch和Kibana
※此篇文章已轉移到個人部落格中。
以下是不使用Docker Compose来单独启动的方法。
执行环境
$ uname -v
Darwin Kernel Version 15.6.0: Thu Sep 1 15:01:16 PDT 2016; root:xnu-3248.60.11~2/RELEASE_X86_64
$ docker --version
Docker version 1.12.1, build 6f9534c
$ docker-compose --version
docker-compose version 1.8.0, build f3628c7
集群的定义
kibana:
image: kibana
links:
- elasticsearch:elasticsearch
ports:
- 5601:5601
elasticsearch:
image: elasticsearch
ports:
- 9200:9200
- 9300:9300
启动集群(分离模式)
$ docker-compose up -d
Creating kibanacluster_elasticsearch_1
Creating kibanacluster_kibana_1
确认启动状态
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eecb811cb144 kibana "/docker-entrypoint.s" 17 minutes ago Up 17 minutes 0.0.0.0:5601->5601/tcp kibanacluster_kibana_1
1c60a47ffd10 elasticsearch "/docker-entrypoint.s" 17 minutes ago Up 17 minutes 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp kibanacluster_elasticsearch_1
确认连接
$ curl localhost:9200
{
"name" : "shyHA8G",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "9I82GX3XSRCaPzRwXwD04A",
"version" : {
"number" : "5.0.0",
"build_hash" : "253032b",
"build_date" : "2016-10-26T05:11:34.737Z",
"build_snapshot" : false,
"lucene_version" : "6.2.0"
},
"tagline" : "You Know, for Search"
}
$ open http://localhost:5601
停止集群
$ docker-compose stop
Stopping kibanacluster_kibana_1 ... done
Stopping kibanacluster_elasticsearch_1 ... done
删除容器
$ docker-compose rm
Going to remove kibanacluster_kibana_1, kibanacluster_elasticsearch_1
Are you sure? [yN] y
Removing kibanacluster_kibana_1 ... done
Removing kibanacluster_elasticsearch_1 ... done