1.elasticsearch.yml配置修改:
- cluster.name: "docker-cluster"
- network.host: 0.0.0.0
- http.port: 9200
- #discovery.seed_hosts: ["172.17.0.2"]
-
- #----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
- #
- # The following settings, TLS certificates, and keys have been automatically
- # generated to configure Elasticsearch security features on 09-09-2023 06:34:17
- #
- # --------------------------------------------------------------------------------
-
- # Enable security features
- xpack.security.enabled: true
-
- xpack.security.enrollment.enabled: true
-
- # Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
- xpack.security.http.ssl:
- enabled: false #这里一定要改成false,否则kinaba访问不同
- keystore.path: certs/http.p12
-
- # Enable encryption and mutual authentication between cluster nodes
- xpack.security.transport.ssl:
- enabled: true
- verification_mode: certificate
- keystore.path: certs/transport.p12
- truststore.path: certs/transport.p12
- #----------------------- END SECURITY AUTO CONFIGURATION -------------------------
-
-
- # 跨域
- http.cors.allow-origin: "*"
- http.cors.enabled: true
- http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
2.执行命令运行elasticsearch容器:
- docker run -d --name elasticsearch-dev \
- -p 9200:9200 \
- -p 9300:9300 \
- -e "discovery.type=single-node" \
- -e ES_JAVA_OPTS="-Xms64m -Xmx512m" \
- -e TAKE_FILE_OWNERSHIP=true \
- -v /Users/本地路径/work/software/elasticsearch/logs:/usr/share/elasticsearch/logs \
- -v /Users/本地路径/work/software/elasticsearch/data:/usr/share/elasticsearch/data \
- -v /Users/本地路径/work/software/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
- -v /Users/本地路径/work/software/elasticsearch/config:/usr/share/elasticsearch/config \
- elasticsearch:8.9.2
3.kibana.yml配置如下:
- #
- # ** THIS IS AN AUTO-GENERATED FILE **
- #
-
- # Default Kibana configuration for docker target
- server.host: 0.0.0.0
- server.shutdownTimeout: "5s"
- #172.17.0.2这个IP是es起来后分配的
- elasticsearch.hosts: [ "http://172.17.0.2:9200" ]
- monitoring.ui.container.elasticsearch.enabled: true
- i18n.locale: "zh-CN"
-
- elasticsearch.username: "kibana_system"
- #注意这里需要修改kibana_system用户的密码
- #进入bin目录后执行命令 ./elasticsearch-setup-passwords interactive
- #可以重置所有用户密码
- elasticsearch.password: "kibana_system"
4.执行命令运行kibana容器:
docker run -d --name kibana-dev -p 5601:5601 -v /Users/本地路径/work/software/kibana/config:/usr/share/kibana/config kibana:8.9.2
5.访问kinaba:
http://localhost:5601