Elasticsearch Kibana Docker
Elasticsearch Docker
Elasticsearch基本配置信息
$ mkdir -p /home/tester/data/docker/elasticsearch/config
$ mkdir -p /home/tester/data/docker/elasticsearch/data
$ echo "http.host: 0.0.0.0" >/home/tester/data/docker/elasticsearch/config/elasticsearch.yml
$ chmod -R 777 /home/tester/data/docker/elasticsearch/
$ docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms128m -Xmx1024m" \
-v /home/tester/data/docker/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /home/tester/data/docker/elasticsearch/data:/usr/share/elasticsearch/data \
-v /home/tester/data/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.17.6
验证Elasticsearch启动是否正常
tester@server01:~/data/docker$ curl 192.168.79.8:9200
{
"name" : "d08c3a4e044c",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "oGz-rI46SnaTW6_0kzsWvw",
"version" : {
"number" : "7.17.6",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "f65e9d338dc1d07b642e14a27f338990148ee5b6",
"build_date" : "2022-08-23T11:08:48.893373482Z",
"build_snapshot" : false,
"lucene_version" : "8.11.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
Kibana Docker
Kibana 基本配置信息
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6c98d2a349bc elasticsearch:7.17.6 "/bin/tini -- /usr/l…" 13 minutes ago Up 13 minutes 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp elasticsearch
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' 6c98
172.17.0.3
$ mkdir -p /home/tester/data/docker/kibana/config
$ cat > /home/tester/data/docker/kibana/config/kibana.yml <<EOF
server.name: kibana
server.host: "0.0.0.0"
server.shutdownTimeout: "5s"
#elasticsearch.hosts: [ "192.168.79.8:9200" ]
# 由于使用了Docker作为容器,需使用上面的elasticsearch docker IPAddress
# 否则会出现 `Kibana server is not ready yet`,而无法进入Kibana
elasticsearch.hosts: [ "172.17.0.3:9200" ]
monitoring.ui.container.elasticsearch.enabled: true
i18n.locale: "zh-CN"
EOF
$ docker run --name kibana -p 5601:5601 -d kibana:7.17.6
验证Kibana启动是否正常
请求 http://192.168.79.8:5601
注意Kibana配置
Elasticsearch 使用Docker 部署 及 Kibana 使用 Docker部署,需要注意 Kibana 配置文件中elasticsearch.hosts: [ “
${Elasticsearch_Docker_IPAddress}
:${Elasticsearch_port}
” ]