46 lines
2.4 KiB
YAML
46 lines
2.4 KiB
YAML
# Elasticsearch 向量数据库 + IK 分词插件(核心中间件,start.sh 默认自动包含)
|
|
# 单独启动(在 deploy/docker 目录):docker compose --env-file .env -f compose/compose-elasticsearch.yaml up -d
|
|
# Logstash(日志采集)/ Kibana(日志查询)为独立文件:compose-logstash.yaml / compose-kibana.yaml
|
|
services:
|
|
bytedesk-elasticsearch:
|
|
# image: docker.elastic.co/elasticsearch/elasticsearch:9.4.2
|
|
# image: dockerproxy.net/library/elasticsearch:9.4.2
|
|
image: elasticsearch:9.4.2
|
|
container_name: elasticsearch-bytedesk
|
|
environment:
|
|
- node.name=bytedesk-es01
|
|
- cluster.name=bytedesk-es-cluster
|
|
- discovery.type=single-node
|
|
- bootstrap.memory_lock=true
|
|
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
|
- xpack.security.enabled=true
|
|
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
|
|
ulimits:
|
|
memlock:
|
|
soft: -1
|
|
hard: -1
|
|
entrypoint: ["bash", "-c", "IK_PLUGIN_DIR=/tmp/ik-plugin-cache; IK_PLUGIN_FILE=$$IK_PLUGIN_DIR/elasticsearch-analysis-ik-9.4.2.zip; IK_PLUGIN_TMP=$$IK_PLUGIN_FILE.tmp; mkdir -p $$IK_PLUGIN_DIR; if [ ! -d /usr/share/elasticsearch/plugins/analysis-ik ]; then if [ -f $$IK_PLUGIN_FILE ]; then echo 'Installing IK plugin from cache...'; /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch file://$$IK_PLUGIN_FILE; elif curl -fsSL -o $$IK_PLUGIN_TMP https://www.weiyuai.cn/download/elasticsearch-analysis-ik-9.4.2.zip; then mv $$IK_PLUGIN_TMP $$IK_PLUGIN_FILE; echo 'Installing IK plugin from download...'; /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch file://$$IK_PLUGIN_FILE; else echo 'WARNING: IK plugin not available, skipping...'; fi; fi; exec /usr/local/bin/docker-entrypoint.sh"]
|
|
volumes:
|
|
- elasticsearch_data:/usr/share/elasticsearch/data
|
|
# IK 分词插件缓存(可选:放入 elasticsearch-analysis-ik-9.4.2.zip 可离线安装)
|
|
- ./ik-plugin-cache:/tmp/ik-plugin-cache
|
|
ports:
|
|
- "19200:9200"
|
|
- "19300:9300"
|
|
networks:
|
|
- bytedesk-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -s -u elastic:${ELASTIC_PASSWORD} -f http://localhost:9200/_cluster/health?wait_for_status=yellow || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 60s
|
|
|
|
volumes:
|
|
elasticsearch_data:
|
|
name: bytedesk_elasticsearch_data
|
|
|
|
networks:
|
|
bytedesk-network:
|
|
driver: bridge
|