部署最新版的elasticsearch和kibana,前提时已经部署docker
设置用户密码
shell
export ELASTIC_PASSWORD="<ES_PASSWORD>" # 设置elastic用户密码
export KIBANA_PASSWORD="<KIB_PASSWORD>" # 设置kibana_system密码
创建docker网络
保证elasticsearch和kibana是可以互相访问
shell
docker network create elastic-net
部署elasticsearch
shell
docker run -p 9200:9200 -d --name elasticsearch --network elastic-net \
-e ELASTIC_PASSWORD=$ELASTIC_PASSWORD \
-e "discovery.type=single-node" \
-e "xpack.security.http.ssl.enabled=false" \
-e "xpack.license.self_generated.type=trial" \
docker.elastic.co/elasticsearch/elasticsearch:8.14.1
--network elastic-net
引用之前创建的网络
-e ELASTIC_PASSWORD=$ELASTIC_PASSWORD
引用之前创建密码
-e "discovery.type=single-node"
设置为单节点
-e "xpack.security.http.ssl.enabled=false"
设置不开启安全模式,我们知识开发实验环境
-e "xpack.license.self_generated.type=trial"
设置license,还可以设置为basic
部署kibana
设置kibana和es交互的用户名(kibana_system)和密码
shell
curl -u elastic:$ELASTIC_PASSWORD \
-X POST \
http://192.168.163.13:9200/_security/user/kibana_system/_password \
-d '{"password":"'"$KIBANA_PASSWORD"'"}' \
-H 'Content-Type: application/json'
shell
docker run -p 5601:5601 -d --name kibana --network elastic-net \
-e ELASTICSEARCH_URL=http://elasticsearch:9200 \
-e ELASTICSEARCH_HOSTS=http://elasticsearch:9200 \
-e ELASTICSEARCH_USERNAME=kibana_system \
-e ELASTICSEARCH_PASSWORD=$KIBANA_PASSWORD \
-e "xpack.security.enabled=false" \
-e "xpack.license.self_generated.type=trial" \
docker.elastic.co/kibana/kibana:8.14.1
配置说明同elasticsearch
注意
kibana的登录账户是elastic而不是kibana_system,kibana_system用户是es和kibana交互的账户,并不是登录kibana的账户