在使用lua集成kafka的时候,出现 fined to resolve slave2(我的主机名称)
我的borkerlist配置如下
local broker_list = { {host="192.168.13.130",port=9092},{host="192.168.13.131",port=9092},{host="192.168.13.132",port=9092}}
原因:nginx 不带有域名解析 我的ip在访问kafka会转换成hostnam返回给nginx nginx不能识别 因此修改kafka配置文件
/usr/local/software/kafka/config/server.properties 文件中的内容:如下
# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
# FORMAT:
# listeners = listener_name://host_name:port
# EXAMPLE:
# listeners = PLAINTEXT://your.host.name:9092
listeners=PLAINTEXT://192.168.13.131:9092
# Hostname and port the broker will advertise to producers and consumers. If not set,
# it uses the value for "listeners" if configured. Otherwise,