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)

遇到问题:
安装好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!问题解决!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值