为什么 consul systemd 服务失败了?

为什么 consul systemd 服务失败了?

这是我的 consul.service 文件。

[Unit]
Description="HashiCorp Consul - A service mesh solution"
Documentation=https://www.consul.io/
Requires=network-online.target
After=network-online.target

[Service]
Type=simple
User=consul
Group=consul
LimitNOFILE=1024
ExecStart=/usr/bin/consul agent  -config-dir=/etc/consul.d/
ExecReload=/bin/kill --signal HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=5
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target

我执行了 sudo chown -R consul:consul /etc/consul.d/ 因为我也创建了一个 consul 用户。

这是我的/etc/config.d目录:

$ tree /etc/consul.d/
/etc/consul.d/
├── bootstrap
│   └── config.json
├── client
└── server
    └── config.json

这是服务器配置。 /etc/consul.d/server/config.json

{
    "bootstrap": false,
    "server": true,
    "datacenter": "lon",
    "advertise_addr": "192.168.0.16",
    "client_addr": "0.0.0.0",
    "bind_addr": "{{GetInterfaceIP \"eth0\"}}",
    "data_dir": "/var/consul/",
    "log_level": "INFO",
    "enable_syslog": true,
    "retry_join": ["192.168.0.16"]
}

/etc/consul.d/bootstrap/config.json

{
    "bootstrap": true,
    "server": true,
    "datacenter": "lon",
    "advertise_addr": "192.168.0.16",
    "client_addr": "0.0.0.0",
    "bind_addr": "{{GetInterfaceIP \"eth0\"}}",
    "data_dir": "/var/consul/",
    "log_level": "INFO",
    "enable_syslog": true,
    "retry_join": ["192.168.0.16"]
}

我已经验证了服务器和引导程序配置的领事配置。

consul validate  /etc/consul.d/server/config.json 
Configuration is valid!

但我一直收到错误消息:

 consul[21711]: ==> Multiple private IPv4 addresses found. Please configure one with 'bind' and/or 'advertise'.

我也尝试过这个命令

~/go/bin$ ./sockaddr eval GetPrivateIP
192.168.0.16

我错过了什么?

相关内容