Skip to main content

Elasticsearch Configs

Mac OS 基于 Docker 安装 Elasticsearch

Docker Pull

docker pull arm64v8/elasticsearch:8.4.2

Create Folders, and Re-config (Important)

ES 的某些安全性方面的配置需要进行修改,否则无法在本机上启动。日常开发不影响,但是如果需要进行生产搭建,就需要进行特定的修改。

... 

mkdir elastic-search
cd elastic-search/
# 新建三个文件夹
mkdir config
mkdir data
mkdir plugins

# 进入 config 目录,映射配置文件
cd config/
vim elasticsearch.yml
http: 
host: 0.0.0.0
xpack.security.enabled: false
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
enabled: false

Docker Run 启动容器

docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xmx512m" \
-v /Users/nedonion/Documents/Tools/elastic-search/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /Users/nedonion/Documents/Tools/elastic-search/data:/usr/share/elasticsearch/data \
-v /Users/nedonion/Documents/Tools/elastic-search/plugins:/usr/share/elasticsearch/plugins \
-d arm64v8/elasticsearch:8.4.2

检查是否启动成功

  • http://localhost:9200/