帝王谷资源网 Design By www.wdxyy.com

问题

docker安装并启动elasticsearch时内存不足

系统centos8(阿里云ecs服务器)

[root@iZ2zeczvvb79boy368xppwZ ~]# cat /etc/redhat-release
CentOS Linux release 8.1.1911 (Core)

安装过程

docker pull elasticsearch:6.4.0

修改虚拟机内存(貌似没有效果)

sysctl -w vm.max_map_count=262144

使用docker run命令跑容器

docker run -p 9200:9200 -p 9300:9300 --name elasticsearch -e "discovery.type=single-node" -e "cluster.name=elasticsearch" -v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins -v /mydata/elasticsearch/data:/usr/share/elasticsearch/data -d elasticsearch:6.4.0

docker ps查看容器并没有启动

[root@iZ2zeczvvb79boy368xppwZ ~]# docker ps
CONTAINER ID  IMAGE    COMMAND     CREATED    STATUS    PORTS                              NAMES
edfc400862eb  rabbitmq:3.7.15  "docker-entrypoint.s…" 14 hours ago  Up 14 hours   0.0.0.0:4369->4369/tcp, 0.0.0.0:5671-5672->5671-5672/tcp, 0.0.0.0:15671-15672->15671-15672/tcp, 0.0.0.0:25672->25672/tcp rabbitmq
2ae2f3f8dc1f  nginx:1.10   "nginx -g 'daemon of…" 2 weeks ago   Up 2 weeks   0.0.0.0:80->80/tcp, 443/tcp                        nginx
164e4e7561df  redis:3.2   "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks   0.0.0.0:6379->6379/tcp                          redis
eeabe57f1f21  mysql:5.7   "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks   0.0.0.0:3306->3306/tcp, 33060/tcp                       mysql

docker ps -a 查看容器确实创建了

[root@iZ2zeczvvb79boy368xppwZ ~]# docker ps -a
CONTAINER ID  IMAGE     COMMAND     CREATED    STATUS       PORTS                              NAMES
767829ae1d7c  elasticsearch:6.4.0 "/usr/local/bin/dock…" About a minute ago Exited (1) About a minute ago                                elasticsearch
edfc400862eb  rabbitmq:3.7.15  "docker-entrypoint.s…" 14 hours ago   Up 14 hours      0.0.0.0:4369->4369/tcp, 0.0.0.0:5671-5672->5671-5672/tcp, 0.0.0.0:15671-15672->15671-15672/tcp, 0.0.0.0:25672->25672/tcp rabbitmq
2ae2f3f8dc1f  nginx:1.10   "nginx -g 'daemon of…" 2 weeks ago   Up 2 weeks      0.0.0.0:80->80/tcp, 443/tcp                        nginx
164e4e7561df  redis:3.2    "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks      0.0.0.0:6379->6379/tcp                          redis
eeabe57f1f21  mysql:5.7    "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks      0.0.0.0:3306->3306/tcp, 33060/tcp                       mysql

查看日志docker logs -f elasticsearch命令查看日志发现jvm内存不足

[root@iZ2zeczvvb79boy368xppwZ ~]# docker logs -f elasticsearch
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007ebf15330000, 549668585472, 0) failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 549668585472 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid1.log

解决方法

修改jvm.options文件配置
首先查找jvm.options文件位置(每个服务器的位置可能不同)

[root@iZ2zeczvvb79boy368xppwZ ~]# find / -name jvm.options
/var/lib/docker/overlay2/d399872a3517b4d4acb0d2f70d0625c0f38251ffe5819a1cea00f8213de3e7f5/diff/usr/share/elasticsearch/config/jvm.options

vim进入文件修改虚拟机最小内存

[root@iZ2zeczvvb79boy368xppwZ ~]# vim /var/lib/docker/overlay2/d399872a3517b4d4acb0d2f70d0625c0f38251ffe5819a1cea00f8213de3e7f5/diff/usr/share/elasticsearch/config/jvm.options

找到-Xms属性,修改成512m(我的elasticsearch:6.4.0默认为1g)

## JVM configuration

################################################################
## IMPORTANT: JVM heap size
################################################################
##
## You should always set the min and max JVM heap
## size to the same value. For example, to set
## the heap to 4 GB, set:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms512m
-Xmx512m

保存并退出

vim中按i进入编辑模式,按ESC退出编辑模式,按:进入命令模式,然后在底部命令行输入w为保存,q为退出,q!为强制退出。
再次启动容器,docker ps查看容器启动成功

[root@iZ2zeczvvb79boy368xppwZ ~]# docker ps
CONTAINER ID  IMAGE     COMMAND     CREATED    STATUS    PORTS                              NAMES
f5c4ed61196b  elasticsearch:6.4.0 "/usr/local/bin/dock…" 15 minutes ago  Up 15 minutes  0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp                    elasticsearch
edfc400862eb  rabbitmq:3.7.15  "docker-entrypoint.s…" 15 hours ago  Up 15 hours   0.0.0.0:4369->4369/tcp, 0.0.0.0:5671-5672->5671-5672/tcp, 0.0.0.0:15671-15672->15671-15672/tcp, 0.0.0.0:25672->25672/tcp rabbitmq
2ae2f3f8dc1f  nginx:1.10   "nginx -g 'daemon of…" 2 weeks ago   Up 2 weeks   0.0.0.0:80->80/tcp, 443/tcp                        nginx
164e4e7561df  redis:3.2    "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks   0.0.0.0:6379->6379/tcp                          redis
eeabe57f1f21  mysql:5.7    "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks   0.0.0.0:3306->3306/tcp, 33060/tcp                       mysql

总结

标签:
docker启动elasticsearch内存不足,docker启动elasticsearch,docker启动elasticsearch失败

帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。