使用docker 安装kafka时启动失败
查看报错日志
# 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
创建swapfile
# dd if=/dev/zero of=swapfile bs=1024 count=500000
count=空间大小 of空间名字
将swapfile设置为swap空间
# mkswap swapfile
启用交换空间,这个操作有点类似于mount操作
# swapon swapfile (删除交换空间 swapoff swapfile)
至此增加交换空间的操作结束了,可以使用free命令查看swap空间大小是否发生变化
kafka 安装成功~
参考博客:https://www.cnblogs.com/wang-yaz/p/9395005.html