TDSQL kafka 进程没启来

问题描述 : 查看kafka 三个节点,只起来2个 

问题分析 :
#查看进程: ps -ef | grep kafka

[root@huyidb03 log]#  ps -ef | grep kafka
tdsql    12316     1  0 08:52 ?        00:00:00 ./dcagent_tokafka ../conf/wagent_15001.xml
tdsql    12318 12316  0 08:52 ?        00:01:35 ./dcagent_tokafka ../conf/wagent_15001.xml
root     16943 32984  0 13:06 pts/0    00:00:00 grep --color=auto kafka
tdsql    56506     1  0 10:45 ?        00:00:00 ./dcagent_tokafka ../conf/wagent_15002.xml
tdsql    56509 56506  0 10:45 ?        00:00:50 ./dcagent_tokafka ../conf/wagent_15002.xml

进程果然没有启动起来:

查看错误日志: 


[root@huyidb03 logs]# cd /data/application/kafka_2.12-2.3.1/logs
[root@huyidb03 logs]# ls
kafkaServer-gc.log  kafkaServer.out
[root@huyidb03 logs]# 
[root@huyidb03 logs]# cat kafkaServer.out 
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000640000000, 6442450944, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 6442450944 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /data/application/kafka_2.12-2.3.1/bin/hs_err_pid90851.log 

继续查看 /data/application/kafka_2.12-2.3.1/bin/hs_err_pid90851.log 日志

[root@huyidb03 bin]# cat  /data/application/kafka_2.12-2.3.1/bin/hs_err_pid90851.log
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 6442450944 bytes for committing reserved memory.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   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:2640), pid=90851, tid=0x00007fb93817b700
#
# JRE version:  (8.0_152-b16) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.152-b16 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
#

---------------  T H R E A D  ---------------

Current thread (0x00007fb93000d800):  JavaThread "Unknown thread" [_thread_in_vm, id=90858, stack(0x00007fb93807c000,0x00007fb93817c000)]

Stack: [0x00007fb93807c000,0x00007fb93817c000],  sp=0x00007fb938179e10,  free space=1015k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
VM Arguments:



jvm_args: -Xmx6G -Xms6G -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true -Xloggc:/data/application/kafka_2.12-2.3.1/bin/../logs/kafkaServer-gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dkafka.logs.dir=/data/application/kafka_2.12-2.3.1/bin/../logs -Dlog4j.configuration=file:./../config/log4j.properties 



大楷看了一下: JVM 要用6G ,估计是内存不够  

[root@huyidb03 bin]# free -m
              total        used        free      shared  buff/cache   available
Mem:           7803        1934         114          60        5754        5459
Swap:             0           0           0
[root@huyidb03 bin]# 


处理办法:
修改启动参数:

 vi /data/application/kafka_2.12-2.3.1/bin/kafka-server-start.sh 
把     export KAFKA_HEAP_OPTS="-Xmx6G -Xms6G"
改为   export KAFKA_HEAP_OPTS="-Xmx2G -Xms2G"

本以为改了后   dcagent_tokafka 进程会自动把 kafka , 等了几分钟然后并没有

手动重启:
./kafka-server-start.sh  -daemon ../config/server.properties
在资检查状态正常:





原文地址:https://www.cnblogs.com/cqdba/p/14093486.html