環境:
CentOS7
Elasticsearch:6.2.2
1、關閉防火牆,重新開機網絡
systemctl stop firewalld
service network restart
2、運作Docker
systemctl start docker
3、設定記憶體
sysctl -w vm.max_map_count=262144
4、拉取鏡像
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.2.2
5、啟動容器
docker run -d -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms256m -Xmx256m" --name ES622 docker.elastic.co/elasticsearch/elasticsearch:6.2.2
6、進入容器,并修改config目錄下的兩個檔案
①jvm.options檔案:将-Xms和-Xmx的值都改為2g:
docker exec -it ES622 /bin/bash
vi config/jvm.options
-Xms2g
-Xmx2g
②
elasticsearch.yml檔案,
增加或替換下面兩個配置:
vi config/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
最後退出并重新啟動容器:
exit
docker restart ES622
7、檢視啟動的容器
docker ps
8、通過網頁打開“http://主機位址:9200”
9、打開index.xml檔案(檔案夾連結:https://pan.baidu.com/s/1ZkxsnbQLz5Iv3Iy7oIZovg
提取碼:h187)