2. 启动 ES7
docker run --name es7 \
--net network-common \
-p 9200:9200 -p 9300:9300 \
--privileged=true \
-e "discovery.type=single-node" \
-v /elf/es/.cache:/usr/share/elasticsearch/.cache \
-v /elf/es/data:/usr/share/elasticsearch/data \
-v /elf/es/logs:/usr/share/elasticsearch/logs \
-itd docker.elastic.co/elasticsearch/elasticsearch:7.17.18
3. 访问ES7
{
"name" : "516266baebb4",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "7GMURjAVRZinou21XMNYpQ",
"version" : {
"number" : "7.17.15",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "0b8ecfb4378335f4689c4223d1f1115f16bef3ba",
"build_date" : "2023-11-10T22:03:46.987399016Z",
"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"
}
4. 启动 ES8
docker run --name es8 \
-m 1GB \
-e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" \
--net network-common \
-p 9200:9200 -p 9300:9300 \
--privileged=true \
-e "discovery.type=single-node" \
-v /elf/es/.cache:/usr/share/elasticsearch/.cache \
-v /elf/es/data:/usr/share/elasticsearch/data \
-v /elf/es/logs:/usr/share/elasticsearch/logs \
-itd docker.elastic.co/elasticsearch/elasticsearch:8.12.2
5. 设置密码
docker exec -it es8 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic --interactive
y
# passwords must be at least [6] characters long
# Enter password for [elastic]:
# Re-enter password for [elastic]:
# Password for the [elastic] user successfully reset.
es8es8 - es8es8
6. 访问ES8
-
elastic -
es8es8
{
"name" : "f7308049be08",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "YcdyuNUVSkuJuFzLXbpIFg",
"version" : {
"number" : "8.11.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "76013fa76dcbf144c886990c6290715f5dc2ae20",
"build_date" : "2023-12-05T10:03:47.729926671Z",
"build_snapshot" : false,
"lucene_version" : "9.8.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
7. Kibana
docker run --name kibana \
--net network-common \
-p 5601:5601 \
--privileged=true \
-itd docker.elastic.co/kibana/kibana:8.12.2
8. Kibana Token
docker exec -it es8 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
eyJ2ZXIiOiI4LjEyLjIiLCJhZHIiOlsiMTcyLjE4LjAuMjo5MjAwIl0sImZnciI6IjRjZDc0MWVhYzdkMzczZTJiMTdjNGQ1YjNjNTg5N2ZlMjhjNzE1MDRiNDc0OGI2Njc4OWFjYTZhODVmMjRiNDIiLCJrZXkiOiJfeE54R0k0QlVHTVI1WXB1S2hXSzpIV0FEWUlvN1RXTzFiYm8xSTd1SHlnIn0=
-
控制台获取验证码:
docker logs kibana
;
http://0.0.0.0:5601/?code=686936; -
粘贴Enrollment Token,Configure Elastic;
-
使用
elastic - es8es8
登录; -
http://192.168.0.123:5601/app/integrations/browse
http://192.168.0.123:5601/app/home#/ -
进入开发工具:控制台:
http://192.168.0.123:5601/app/dev_tools#/console