ElasticSearch7:使用docker-compose一键启动ES&Kibana服务

ElasticSearch7:使用docker-compose一键启动ES&Kibana服务

Compose方式

创建文件夹es-kibana/docker-compose.yml ,注意📢📢📢:yml文件时空格,不是tab制表符。
docker-compose.yml
version: "1.0" volumes: data: config: plugin: networks: # 声明使用网络 es: services: elasticsearch: image: elasticsearch:8.1.2 ports: - "9200:9200" - "9300:9300" networks: - "es" environment: - "discovery.type=single-node" - "ES_JAVA_OPTS=-Xms512m -Xmx512m" volumes: - ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - data:/usr/share/elasticsearch/data - config:/usr/share/elasticsearch/config - plugin:/usr/share/elasticsearch/plugins kibana: image: kibana:8.1.2 ports: - "5601:5601" networks: - "es" volumes: - ./kibana.yml:/usr/share/kibana/config/kibana.yml
elasticsearch.yml 复制一份到本地自己创建的es-kibana目录件,修改xpack.security.enabled: false
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 14-04-2022 06:42:54 # # -------------------------------------------------------------------------------- # Enable security features xpack.security.enabled: false xpack.security.enrollment.enabled: true # Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents xpack.security.http.ssl: enabled: true 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 -------------------------
notion image
kibana.yml 复制一份到本地自己创建的es-kibana目录件
# # ** THIS IS AN AUTO-GENERATED FILE ** # # Default Kibana configuration for docker target server.host: "0.0.0.0" server.shutdownTimeout: "5s" elasticsearch.hosts: [ "http://elasticsearch:9200" ] monitoring.ui.container.elasticsearch.enabled: true
 
启动
# docker compose启动 root@redis01:~/es-kibana# docker compose up -d # 查看docker root@redis01:~/es-kibana# docker ps
notion image
 
访问9200端口(启动有一个过程,稍微等待一小会儿)
访问5601端口
notion image
 

关闭

root@redis01:~/es-kibana# docker compose down

启动

root@redis01:~/es-kibana# docker compose up -d