栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

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

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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!问题解决!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/856771.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号