使用Docker安装ElasticSearch(8.12.2)、Kibana(8.12.2)

1、创建 Docker 容器网络:

如果您还没有创建 Docker 容器网络,请使用以下命令创建一个网络。这个网络将用于 Elasticsearch 容器与其它容器之间的通信。

docker network create elastic-net
2、下载 Elasticsearch 镜像,并运行容器

(1)、elasticsearch配置文件:elasticsearch.yml

xpack.security.enabled:关闭安全模式

cluster.name: "docker-cluster"
network.host: 0.0.0.0

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically
# generated to configure Elasticsearch security features on 06-03-2024 02:11:12
#
# --------------------------------------------------------------------------------

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: false

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: false
#  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: false
#  verification_mode: certificate
#  keystore.path: certs/transport.p12
#  truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

(1)、拉取镜像

docker pull docker.elastic.co/elasticsearch/elasticsearch:8.12.2

(2)、运行容器(注意这里挂载了elasticsearch.yml文件)

docker run -d --restart=always --name elasticsearch --net elastic-net -v /usr/local/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -t docker.elastic.co/elasticsearch/elasticsearch:8.12.2

验证Elasticsearch是否能正常运行:
http://192.168.30.201:9200/

在这里插入图片描述

3、安装Kibana、并运行容器

(1)、Kibana 配置文件:kibana.yml

server.host: "0.0.0.0"
server.shutdownTimeout: "5s"
elasticsearch.hosts: [ "http://elasticsearch:9200" ]
elasticsearch.username: "kibana_system"
elasticsearch.password: "WGhf-wm6RIOFczaZjh+o"

(2)、获取 Kibana 镜像

docker pull docker.elastic.co/kibana/kibana:8.12.2

(3)、创建并运行 Kibana容器(注意这里挂载了kibana.yml文件)

docker run -d  --restart=always --name kibana --net elastic-net -v /usr/local/elasticsearch/kibana.yml:/usr/share/kibana/config/kibana.yml -p 5601:5601 -e "ELASTICSEARCH_HOSTS=http://elasticsearch:9200" docker.elastic.co/kibana/kibana:8.12.2

Kibana 访问地址: http://192.168.30.201:5601

在这里插入图片描述

上一篇:基于Spring Boot的心灵治愈交流平台设计与实现


下一篇:vue 3 —— 笔记(模板语法,响应式变量)