天天看點

Docker部署Elasticsearch的坑grep locked /proc/$(ps --no-headers -o pid -C dockerd | tr -d ' ')/limitsgrep locked /proc/$(ps --no-headers -o pid -C dockerd | tr -d ' ')/limits

Elasticsearch需要大量的機器,單機版上點資料就挂了,叢集版本最少也是3台機器。

在Docker上可以輕松的模拟出多台機器的場景,還能在雲主機上實作。阿裡雲的Elasticsearch 最少也是一年5k的價格。是以自己在Docker上搭建實在是經濟高效,适合業務剛剛起步的我們。

看起來很美好,這次更新最大的坑就是:

Unable to lock JVM Memory: error=12, reason=Cannot allocate memory

折騰了一天,最後還是在github上找到了答案,直接粘貼上來。

原文網址 If you look at your Docker daemon's limits, you will probably see this:

grep locked /proc/$(ps --no-headers -o pid -C dockerd | tr -d ' ')/limits

Max locked memory 65536 65536 bytes

When we would much prefer to see:

Max locked memory unlimited unlimited bytes

It depends on your system how to go about changing the limit, but on my fairly standard Ubuntu system I was able to do this:

echo -e "[Service]\nLimitMEMLOCK=infinity" | SYSTEMD_EDITOR=tee systemctl edit docker.service

systemctl daemon-reload

systemctl restart docker