1、echo “http.host: 0.0.0.0”>>/u01/elasticsearch/config/elasticsearch.yml
2、elasticsearch.yml中添加cluster_name,注意是"."
cluster.name: “jack-cluster”
3、获取镜像文件
docker pull elasticsearch:7.12.1
4、运行docker
docker run --name db_elasticsearch -p 9200:9200
-p 9300:9300
-e “discovery.type=single-node”
-e ES_JAVA_OPTS="-Xms256m -Xmx512m"
-v $PWD/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
-v $PWD/data:/usr/share/elasticsearch/data
-v $PWD/plugins:/usr/share/elasticsearch/plugins
-d elasticsearch:7.12.1
5、验证curl http://ip:9200/
{
"name" : "7623eb255f71",
"cluster_name" : "jack-cluster",
"cluster_uuid" : "45k-LUByRRmyGCJ61esgtQ",
"version" : {
"number" : "7.12.1",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "3186837139b9c6b6d23c3200870651f10d3343b7",
"build_date" : "2021-04-20T20:56:39.040728659Z",
"build_snapshot" : false,
"lucene_version" : "8.8.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}