Last active
May 24, 2019 03:29
-
-
Save wakwanza/18e65d4f34e539390b9d7d210024869c to your computer and use it in GitHub Desktop.
consul template to update db server in proxysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT OR REPLACE INTO mysql_servers | |
(hostgroup_id,hostname,port,comment) | |
VALUES {{ range $i, $s := service "mydb"}}{{if $i }},{{end}} | |
(1,'{{.Address}}',{{.Port}},'{{.Node}}'){{end}}; | |
SAVE MYSQL SERVERS TO DISK; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"mydb" is the name of the service providing the database nodes.