canal因为内存原因在Linux无法运行启动(There is insufficient memory for the Java Runtime Environment to continue)

canal因为内存原因在Linux无法运行启动(There is insufficient memory for the Java Runtime Environment to continue),第1张

canal因为内存原因在Linux无法运行启动(There is insufficient memory for the Java Runtime Environment to continue)

遇到问题:
安装好canal后,在canal/bin目录中启动startup.sh 没有成功,也没有生成canal/logs文件夹中生成canal.log日志,在进程命令中ps -ef | grep canal也查不到canal进程。

解决方法: 1、查看日志文件里面的错误:

在目录canal/logs中查看文件canal_stdout.log,文件内容如下:

# `There is insufficient memory for the Java Runtime Environment to continue.`
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /usr/local/canal/bin/hs_err_pid13928.log

第一句话就能看出该错误问题:
内存不足,Java运行时环境无法继续。

There is insufficient memory for the Java Runtime Environment to continue.

更详细的错误日志在文件:/usr/local/canal/bin/hs_err_pid13928.log
复制一段内容:

There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2749), pid=13928, tid=0x00007f3dd30d1700
#
# JRE version:  (8.0_261-b12) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.261-b12 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

既然是内存原因,那就检查一下自己的内存free -h,发现可用内存仅为133M,应该是内存问题。

2、两种解决内存方法:
  • 杀死一些进程
  • 增加内存
    (我果断增加了虚拟机的内存,使原来的2G变为4G)
3、最终成功运行

成功运行后可以在canal/logs文件夹中生成canal.log日志。
成功的日志内容为:

2022-05-04 14:16:19.040 [main] INFO  com.alibaba.otter.canal.deployer.CanalLauncher - ## set default uncaught exception handler
2022-05-04 14:16:19.145 [main] INFO  com.alibaba.otter.canal.deployer.CanalLauncher - ## load canal configurations
2022-05-04 14:16:19.198 [main] INFO  com.alibaba.otter.canal.deployer.CanalStarter - ## start the canal server.
2022-05-04 14:16:19.313 [main] INFO  com.alibaba.otter.canal.deployer.CanalController - ## start the canal server[192.168.122.1(192.168.122.1):11111]
2022-05-04 14:16:22.988 [main] INFO  com.alibaba.otter.canal.deployer.CanalStarter - ## the canal server is running now ......

OK!问题解决!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/868218.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-13
下一篇 2022-05-13

发表评论

登录后才能评论

评论列表(0条)

保存