Skip to content

Instantly share code, notes, and snippets.

@wakwanza
Last active May 24, 2019 03:29
Show Gist options
  • Save wakwanza/18e65d4f34e539390b9d7d210024869c to your computer and use it in GitHub Desktop.
Save wakwanza/18e65d4f34e539390b9d7d210024869c to your computer and use it in GitHub Desktop.
consul template to update db server in proxysql
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;
@wakwanza
Copy link
Author

"mydb" is the name of the service providing the database nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment