docker启动elasticsearch常见问题

一、Error response from daemon: No such container: elasticsearch.yml

docker启动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.17.3

问题原因:为elasticsearch.yml所在目录的权限不够。

解决方法:调整目录权限

chmod -R 777 /mydata/elasticsearch/config
 
  

二、Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ElasticsearchParseException[malformed, expected settings to start with 'object', instead was [VALUE_STRING]];

问题原因:elasticsearch.yml内配置的格式不正确

http.host:0.0.0.0 (错误)
http.host: 0.0.0.0 (正确)

解决方法:仔细观察是否出现格式问题

你可能感兴趣的:(elasticsearch,docker,elasticsearch,运维)