From a9a9d04f3005b2369ee8983e266f3aaf9115f742 Mon Sep 17 00:00:00 2001 From: Hugh Saunders Date: Tue, 28 Oct 2014 13:54:25 +0000 Subject: [PATCH] Specialize galera client config For reliable operation, the mysql client configuration must point to the local instance, within galera containers. However this prevents the mysql client from working on other constainers (eg utility). This patch defaults the mysql connection to the VIP, then overrides that to 127.0.0.1 for galera containers. Related: #413 --- rpc_deployment/inventory/group_vars/galera.yml | 5 +++++ .../roles/galera_client_cnf/templates/client_my.cnf | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rpc_deployment/inventory/group_vars/galera.yml b/rpc_deployment/inventory/group_vars/galera.yml index 8f72b35ca3..958afba9a2 100644 --- a/rpc_deployment/inventory/group_vars/galera.yml +++ b/rpc_deployment/inventory/group_vars/galera.yml @@ -15,6 +15,11 @@ service_name: mysql +# Defaults to mysql_address (VIP) when unset. +# Should only be set for the galera group so that they always connect to +# their own instance. +mysql_client_host: 127.0.0.1 + container_lvm_fstype: ext4 container_lvm_fssize: 5GB diff --git a/rpc_deployment/roles/galera_client_cnf/templates/client_my.cnf b/rpc_deployment/roles/galera_client_cnf/templates/client_my.cnf index a310c1261f..7fd81e0bbb 100644 --- a/rpc_deployment/roles/galera_client_cnf/templates/client_my.cnf +++ b/rpc_deployment/roles/galera_client_cnf/templates/client_my.cnf @@ -1,4 +1,4 @@ [client] -socket=/var/run/mysqld/mysqld.sock +host={{ mysql_client_host|default(mysql_address) }} user=root password={{ mysql_password }}