依次执行以下命令
docker pull elasticsearch:7.8.0 mkdir -p /mydata/elasticsearch/{config,data,plugins} echo "http.host: 0.0.0.0" > /mydata/elasticsearch/config/elasticsearch.yml #不给权限启动会报错 chmod -R 775 /mydata/elasticsearch/ docker run --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx128m" -v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /mydata/elasticsearch/data:/usr/share/elasticsearch/data -v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins -d elasticsearch:7.8.0
# 查看集群健康状态 curl 127.0.0.1:9200/_cat/health?v # 查看节点健康状态 curl 127.0.0.1:9200/_cat/nodes?v # 查看索引信息 curl 127.0.0.1:9200/_cat/indices?v
执行 curl http://127.0.0.1:9200/ 查看版本
{ "name" : "elasticsearch", "cluster_name" : "docker-cluster", "cluster_uuid" : "vkFxD09DQn6Uq9LZI4lGHQ", "version" : { "number" : "7.8.0", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65", "build_date" : "2020-06-14T19:35:50.234439Z", "build_snapshot" : false, "lucene_version" : "8.5.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }