Docker部署Elasticsearch的坑

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:

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

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

你可能感兴趣的:(Docker部署Elasticsearch的坑)