Elasticsearch7.X安装
单机模式
创建挂载目录文件夹
mkdir -p /home/elasticsearch/{config,data,plugins}
授权文件夹(不然无法启动)
chmod 777 /home/elasticsearch/*
编写docker-compose.yml文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| version: '3.5' services: es0: image: elasticsearch:7.17.8 container_name: dev-es0-19200-19300 restart: unless-stopped privileged: true environment: - discovery.type=single-node - ES_JAVA_OPTS=-Xms512m -Xmx512m ports: - 19200:9200 - 19300:9300 volumes: - /home/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - /home/elasticsearch/data:/usr/share/elasticsearch/data - /home/elasticsearch/plugins:/usr/share/elasticsearch/plugins
networks: default: external: name: dev
|
Es8 的docker配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| version: '3.5' services: es0: image: elasticsearch:8.12.2 container_name: es8-19200-19300 restart: unless-stopped privileged: true environment: - discovery.type=single-node - ES_JAVA_OPTS=-Xms102m -Xmx1024m ports: - 19200:9200 - 19300:9300 volumes: - /home/elasticsearch8/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - /home/elasticsearch8/data:/usr/share/elasticsearch/data - /home/elasticsearch8/plugins:/usr/share/elasticsearch/plugins
|
elasticsearch.yml
1 2 3
| http.host: 0.0.0.0 http.cors.enabled: true http.cors.allow-origin: "*"
|