docker elasticsearch mount host message java.nio.file.AccessDeniedException: / usr / share / elasticsearch / data / nodes

① docker start es examples

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.4.2

 

Special attention :

-e ES_JAVA_OPTS = - \ "Xms256m -Xmx256m  " test environment, set ES initial memory and maximum memory, otherwise result in excessive not start ES

 

② docker ps found elasticsearch does not start

 

③ docker ps -a discovery while es flew out of the instance starts

 

 

 

④ View docker's ID elasticsearch boot log docker logs es found here are host to mount an abnormality has occurred

  The data needed to mount and logs on the host when deploying elasticsearch, when docker container to prevent unplanned downtime, you can ensure security and facilitate data according to troubleshoot error logs.

Under the docker container / usr / share / elasticsearch / data mount to the host / mydata / elasticsearch / data, log empathy.

But the seemingly simple command, but being given java.nio.file.AccessDeniedException: / usr / share / elasticsearch / data / nodes, see this error when that is the container / usr / share / elasticsearch / data / nodes directory permissions is not enough, then began a variety of authorized, but not, toss a half time, finally found the real reason is / mydata on the host / elasticsearch / data due to insufficient directory permissions! ! !

But the reported error log is / usr / share / elasticsearch / data / nodes directory under the docker container! ! !

 

 

 

The position to mount its own folder mounted on modified host ⑤ (VM) different folder rights to modify permission to modify the same manner as the three folders

 

Method two: not recommended , because after a lot of places required a different folder permissions so too the Haoheng

 

 

 

 

⑥ restart elasticsearch test docker start esID   

⑦ at this time has been launched successfully

 

 

 

 

Guess you like

Origin www.cnblogs.com/718lubancantfly/p/12664229.html