Skip to content

Instantly share code, notes, and snippets.

@yimeng
Last active April 25, 2023 05:58
Show Gist options
  • Save yimeng/cc27b38036e8e6904d8d05046df06082 to your computer and use it in GitHub Desktop.
Save yimeng/cc27b38036e8e6904d8d05046df06082 to your computer and use it in GitHub Desktop.
consul
/etc/systemd/system/consul.service
[Unit]
Description=Consul service discovery agent
Requires=network-online.target
After=network-online.target
[Service]
EnvironmentFile=-/etc/sysconfig/consul
Restart=on-failure
ExecStart=/usr/bin/consul agent -config-dir=/etc/consul.d
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
User=consul
Group=consul
[Install]
WantedBy=multi-user.target
/etc/consul.d/consul.hcl
datacenter = "beijing-office"
data_dir = "/opt/consul"
client_addr = "0.0.0.0"
ui_config{
enabled = true
}
server = true
bind_addr = "192.168.10.xxx" # Listen on all IPv4
bootstrap_expect=3
retry_join = ["192.168.10.xxx","192.168.10.xxx","192.168.10.xxx"]
agent consul
datacenter = "beijing-office"
data_dir = "/opt/consul"
client_addr = "0.0.0.0"
server = false
bind_addr = "192.168.10.xxx" # Listen on all IPv4
retry_join = ["192.168.10.xxx","192.168.10.1xx","192.168.10.eee"]
node_name = "test123"
encrypt = "JHxhz9aXCY="
enable_script_checks = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment