千家信息网

kafka启动报错怎么解决

发表于:2024-11-17 作者:千家信息网编辑
千家信息网最后更新 2024年11月17日,本篇内容主要讲解"kafka启动报错怎么解决",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"kafka启动报错怎么解决"吧!kafka启动过程报错,配置没有
千家信息网最后更新 2024年11月17日kafka启动报错怎么解决

本篇内容主要讲解"kafka启动报错怎么解决",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"kafka启动报错怎么解决"吧!

kafka启动过程报错,配置没有问题,这就懵了!!

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0130000, 986513408, 0) failed; error='Cannot allocate memory' (errno=12)

说是内存不足,没办法,请教同学之后了解到kafka默认内存是1g,然后直接vim为100m就好了,具体就是:

{$KAFKA_HOME}/bin下,直接

vim kafka-server-start.sh

然后更改其中的export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
为export KAFKA_HEAP_OPTS="-Xmx100m -Xms100m"
看图:

#!/bin/bash# Licensed to the Apache Software Foundation (ASF) under one or more# contributor license agreements.  See the NOTICE file distributed with# this work for additional information regarding copyright ownership.# The ASF licenses this file to You under the Apache License, Version 2.0# (the "License"); you may not use this file except in compliance with# the License.  You may obtain a copy of the License at##    ## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.
if [ $# -lt 1 ];then        echo "USAGE: $0 [-daemon] server.properties"        exit 1fibase_dir=$(dirname $0)export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties"export KAFKA_HEAP_OPTS="-Xmx100m -Xms100m"
EXTRA_ARGS="-name kafkaServer -loggc"
COMMAND=$1case $COMMAND in  -daemon)    EXTRA_ARGS="-daemon "$EXTRA_ARGS    shift    ;;  *)    ;;esac
exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka $@

到此,相信大家对"kafka启动报错怎么解决"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

0