我是靠谱客的博主 俊逸小天鹅,最近开发中收集的这篇文章主要介绍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!问题解决!

最后

以上就是俊逸小天鹅为你收集整理的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)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(69)

评论列表共有 0 条评论

立即
投稿
返回
顶部