一键部署 es程序员朱永胜2024-11-092024-11-12123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051services: elasticsearch: image: bitnami/elasticsearch:8.15.1 # 请根据需要选择合适的版本 container_name: elasticsearch healthcheck: test: ["CMD-SHELL", "curl --silent --fail -u elastic:$elastic_password localhost:9200/_cluster/health || exit 1"] interval: 30s timeout: 10s retries: 3 environment: - "ELASTICSEARCH_VOLUME_DIR=/bitnami/elasticsearch" - "ELASTICSEARCH_NODE_NAME=misaka-es01" - "ELASTICSEARCH_CLUSTER_NAME=misaka-cluster" - "ELASTICSEARCH_BIND_ADDRESS=0.0.0.0" - "ELASTICSEARCH_HTTP_PORT_NUMBER=9200" - "ELASTICSEARCH_TRANSPORT_PORT_NUMBER=9300" - "ELASTICSEARCH_ENABLE_SECURITY=true" - "ELASTICSEARCH_HEAP_SIZE=1024m" - "ELASTICSEARCH_MAX_ALLOWED_MEMORY=1536" - "ELASTICSEARCH_IS_DEDICATED_NODE=false" - "ELASTICSEARCH_ENABLE_REST_TLS=false" - "ELASTICSEARCH_SKIP_TRANSPORT_TLS=true" - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - "ELASTICSEARCH_PASSWORD=$elastic_password" volumes: - ./es/data:/bitnami/elasticsearch/data - ./es/plugins:/bitnami/elasticsearch/plugins - ./es/logs:/opt/bitnami/elasticsearch/logs ports: - 9200:9200 - 9300:9300 kibana: image: bitnami/kibana:8.15.1 # 确保 Kibana 版本与 Elasticsearch 版本兼容 container_name: kibana environment: - "KIBANA_ELASTICSEARCH_URL=elasticsearch" - "KIBANA_ELASTICSEARCH_PORT_NUMBER=9200" - "KIBANA_HOST=0.0.0.0" - "KIBANA_PORT_NUMBER=5601" - "KIBANA_CREATE_USER=true" - "KIBANA_PASSWORD=$kibana_password" - "KIBANA_ELASTICSEARCH_PASSWORD=$elastic_password" - "KIBANA_VOLUME_DIR=/bitnami/kibana" volumes: - ./es/kibana:/bitnami/kibana ports: - 5601:5601 depends_on: elasticsearch: condition: service_healthy