Commit e4e851c8 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Added support for WSREP node address to be used on systems with multiple network interfaces

parent 085365b0
...@@ -148,6 +148,7 @@ define MARIADB_CONFIG ...@@ -148,6 +148,7 @@ define MARIADB_CONFIG
config wsrep 'galera' config wsrep 'galera'
option cluster_address '' option cluster_address ''
option cluster_options '' option cluster_options ''
option node_address ''
option server_id '' option server_id ''
option wsrep_gtid_domain_id '' option wsrep_gtid_domain_id ''
option gtid_domain_id '' option gtid_domain_id ''
......
...@@ -20,6 +20,7 @@ entry_execute_method_root_MySQL() { ...@@ -20,6 +20,7 @@ entry_execute_method_root_MySQL() {
common_execute_method_param "$DMROOT.MySQL.GaleraBootstrap" "1" "" "mysql_galera_bootstrap" "xsd:boolean" common_execute_method_param "$DMROOT.MySQL.GaleraBootstrap" "1" "" "mysql_galera_bootstrap" "xsd:boolean"
common_execute_method_param "$DMROOT.MySQL.GaleraClusterAddress" "1" "mysql_get_cluster_address" "mysql_set_cluster_address" common_execute_method_param "$DMROOT.MySQL.GaleraClusterAddress" "1" "mysql_get_cluster_address" "mysql_set_cluster_address"
common_execute_method_param "$DMROOT.MySQL.GaleraClusterOptions" "1" "mysql_get_cluster_options" "mysql_set_cluster_options" common_execute_method_param "$DMROOT.MySQL.GaleraClusterOptions" "1" "mysql_get_cluster_options" "mysql_set_cluster_options"
common_execute_method_param "$DMROOT.MySQL.GaleraNodeAddress" "1" "mysql_get_node_address" "mysql_set_node_address"
common_execute_method_param "$DMROOT.MySQL.ServerID" "1" "mysql_get_server_id" "mysql_set_server_id" common_execute_method_param "$DMROOT.MySQL.ServerID" "1" "mysql_get_server_id" "mysql_set_server_id"
common_execute_method_param "$DMROOT.MySQL.WSREPGTIDdomainID" "1" "mysql_get_wsrep_gtid_domain_id" "mysql_set_wsrep_gtid_domain_id" common_execute_method_param "$DMROOT.MySQL.WSREPGTIDdomainID" "1" "mysql_get_wsrep_gtid_domain_id" "mysql_set_wsrep_gtid_domain_id"
common_execute_method_param "$DMROOT.MySQL.GTIDdomainID" "1" "mysql_get_gtid_domain_id" "mysql_set_gtid_domain_id" common_execute_method_param "$DMROOT.MySQL.GTIDdomainID" "1" "mysql_get_gtid_domain_id" "mysql_set_gtid_domain_id"
...@@ -102,6 +103,20 @@ mysql_set_cluster_options() { ...@@ -102,6 +103,20 @@ mysql_set_cluster_options() {
fi fi
} }
mysql_get_node_address() {
echo `$UCI_GET mariadb.galera.node_address`
}
mysql_set_node_address() {
local address=`$UCI_GET mariadb.galera.node_address`
if [ "$address" != "$1" ]; then
$UCI_SET mariadb.galera.node_address="$1"
$UCI_COMMIT
wsrep-init
systemctl restart mariadb
fi
}
mysql_get_server_id() { mysql_get_server_id() {
echo `$UCI_GET mariadb.galera.server_id` echo `$UCI_GET mariadb.galera.server_id`
} }
......
...@@ -4,6 +4,7 @@ UCI_GET="/sbin/uci -q get" ...@@ -4,6 +4,7 @@ UCI_GET="/sbin/uci -q get"
ADDRESS=`$UCI_GET mariadb.galera.cluster_address` ADDRESS=`$UCI_GET mariadb.galera.cluster_address`
OPTIONS=`$UCI_GET mariadb.galera.cluster_options` OPTIONS=`$UCI_GET mariadb.galera.cluster_options`
NODE=`$UCI_GET mariadb.galera.node_address`
SERVER_ID=`$UCI_GET mariadb.galera.server_id` SERVER_ID=`$UCI_GET mariadb.galera.server_id`
WSREP_GTID=`$UCI_GET mariadb.galera.wsrep_gtid_domain_id` WSREP_GTID=`$UCI_GET mariadb.galera.wsrep_gtid_domain_id`
GTID=`$UCI_GET mariadb.galera.gtid_domain_id` GTID=`$UCI_GET mariadb.galera.gtid_domain_id`
...@@ -20,6 +21,9 @@ EOF ...@@ -20,6 +21,9 @@ EOF
if [ ! -z "$OPTIONS" ]; then if [ ! -z "$OPTIONS" ]; then
echo "wsrep_provider_options = $OPTIONS" >> /run/mysqld/wsrep.conf echo "wsrep_provider_options = $OPTIONS" >> /run/mysqld/wsrep.conf
fi fi
if [ ! -z "$NODE" ]; then
echo "wsrep_node_address = $NODE" >> /run/mysqld/wsrep.conf
fi
if [ ! -z "$SERVER_ID" ]; then if [ ! -z "$SERVER_ID" ]; then
echo "server_id = $SERVER_ID" >> /run/mysqld/wsrep.conf echo "server_id = $SERVER_ID" >> /run/mysqld/wsrep.conf
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment