使用docker 安装kafka时启动失败

1155330-20190715154319779-1681801176.png

查看报错日志

# docker logs --since 30m 71846a96e514
Excluding KAFKA_HOME from broker config
[Configuring] 'port' in '/opt/kafka/config/server.properties'
[Configuring] 'advertised.listeners' in '/opt/kafka/config/server.properties'
[Configuring] 'broker.id' in '/opt/kafka/config/server.properties'
Excluding KAFKA_VERSION from broker config
[Configuring] 'listeners' in '/opt/kafka/config/server.properties'
[Configuring] 'zookeeper.connect' in '/opt/kafka/config/server.properties'
[Configuring] 'log.dirs' in '/opt/kafka/config/server.properties'
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Out of memory' (errno=12)

查看内存使用情况

# free -m

1155330-20190715154607972-678106262.png

创建swapfile

# dd  if=/dev/zero  of=swapfile  bs=1024  count=500000  
count=空间大小 of空间名字

将swapfile设置为swap空间

# mkswap swapfile

启用交换空间,这个操作有点类似于mount操作

# swapon  swapfile (删除交换空间 swapoff swapfile)

至此增加交换空间的操作结束了,可以使用free命令查看swap空间大小是否发生变化
1155330-20190715154957213-451288053.png
kafka 安装成功~
1155330-20190715155018282-934521875.png

参考博客:https://www.cnblogs.com/wang-yaz/p/9395005.html

Logo

Kafka开源项目指南提供详尽教程,助开发者掌握其架构、配置和使用,实现高效数据流管理和实时处理。它高性能、可扩展,适合日志收集和实时数据处理,通过持久化保障数据安全,是企业大数据生态系统的核心。

更多推荐