【解决了一个小问题】alert manager中的cluster.advertise-address参数是什么意思?

如果在启动 alert manager的时候,不填写参数:

/usr/bin/alertmanager --config.file=/etc/alert_manager/alertmanager.yaml --storage.path=/var/alert_manager/data --data.retention=24h --web.listen-address=0.0.0.0:9093 --cluster.listen-address=0.0.0.0:9094

那么alert manager无法启动,出现以下错误:

level=warn ts=2021-12-15T09:38:52.058Z caller=cluster.go:177 component=cluster err="couldn't deduce an advertise address: no private IP found, explicit advertise addr not provided"
level=error ts=2021-12-15T09:38:52.059Z caller=main.go:250 msg="unable to initialize gossip mesh" err="create memberlist: Failed to get final advertise address: No private IP address found, and explicit IP not provided"

看了源码,cluster.advertise-address是需要填写本机的IP:port,在广播的时候,去掉这个地址。
因此这个参数应该这么填写:

/usr/bin/alertmanager --config.file=/etc/alert_manager/alertmanager.yaml --storage.path=/var/alert_manager/data --data.retention=24h --web.listen-address=0.0.0.0:9093 \
  --cluster.listen-address=0.0.0.0:9094  \
  --cluster.advertise-address="${POD_IP}:9094"

posted on 2021-12-15 17:54  ahfuzhang  阅读(1277)  评论(0编辑  收藏  举报