Elasticsearch7.X安装(docker)
南江烂柯人 JAVA劝退师

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
# 根据现有docker network配置
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: "*"
  • 本文标题:Elasticsearch7.X安装(docker)
  • 本文作者:南江烂柯人
  • 创建时间:2023-08-23 09:57:14
  • 本文链接:https://www.mattjia.com/2023/08/23/installation/Elasticsearch7.X安装(docker)/
  • 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
 评论