【问题标题】:couldn't start zookeeper server in vagrant ubuntu box due to insufficient memory error由于内存不足错误,无法在 vagrant ubuntu 框中启动 zookeeper 服务器
【发布时间】:2018-09-18 08:31:50
【问题描述】:

我有以下 ubuntu 配置的 vagrant box。

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:    16.04
Codename:   xenial

以下是内存详细信息 -

$ free -m
              total        used        free      shared  buff/cache   available
Mem:            488          43          92           1         351         414

我已经从here 下载了文件kafka_2.12-1.1.1.tgz

然后我尝试在使用以下命令提取存档后启动 Zookeeper 服务器。

$ sudo /home/vagrant/kafka/bin/zookeeper-server-start.sh  /home/vagrant/kafka/config/zookeeper.properties
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e0000000, 536870912, 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 536870912 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /home/vagrant/hs_err_pid5404.log

我已经提供了完整的错误日志here

我看到流浪机器总是有交换空间问题。 如何解决这个问题并在 vagrant 机器上成功安装。

【问题讨论】:

    标签: java java-8 apache-kafka vagrant apache-zookeeper


    【解决方案1】:

    您将需要显示您的 Vagrant 文件,但默认 VM 内存空间不足以启动 Zookeeper,更不用说 Kafka 和 Zookeeper。

    假设您的主机至少有 4G 内存,您可以查看我从 Confluent 分叉的 Vagrant + Ansible 存储库,默认情况下,它将在不同的机器上启动 Zookeeper 和 Kafka。

    https://github.com/cricket007/cp-ansible/blob/addVagrant/vagrant/README.md

    【讨论】:

    • cricket_007 - 我的配置看起来不错。我之前使用 ubuntu OS 实现平台时遇到了错误。当我将 ubuntu/xeniel 更改为 centos/7 时,它工作正常。我想我需要调整 ubuntu 的 swapiness 配置。但我不知道该怎么做。
    • 理想情况下,您不想在 Kafka 或 Zookeeper 中进行交换,而是像 config.vm.provision :shell, inline: "echo vm.swappiness = 1 >> /etc/sysctl.conf" 这样的东西。实际上,我只在 CentOS 中测试过我的代码,尽管我添加了对其他 Vagrant 盒子的支持
    猜你喜欢
    • 2019-04-06
    • 2015-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-30
    • 1970-01-01
    相关资源
    最近更新 更多