Java 不能';由于内存不足错误,无法在vagrant ubuntu框中启动zookeeper服务器

Java 不能';由于内存不足错误,无法在vagrant ubuntu框中启动zookeeper服务器,java,java-8,apache-kafka,vagrant,apache-zookeeper,Java,Java 8,Apache Kafka,Vagrant,Apache Zookeeper,我已经在下面的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

我已经在下面的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
我已经从下载了文件
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
我已经提供了完整的错误日志

我看到流浪者的机器总是有交换空间的问题。
如何解决此问题并在vagrant计算机中成功安装。

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

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


cricket_007-我的配置看起来不错。我在早些时候使用ubuntu操作系统实现平台时遇到了错误。当我将ubuntu/xeniel更改为centos/7时,它运行良好。我想我需要调整ubuntu的swapiness配置。但我不知道怎么做。理想情况下,您不希望在Kafka或Zookeeper中进行交换,而是类似于
config.vm.provision:shell,内联:“echo vm.swappiness=1>/etc/sysctl.conf”
。实际上,我只在CentOS中测试了我的代码,尽管我添加了对其他Vagrant Box的支持