mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 10:36:28 +00:00
start-sandbox: If starting a cluster node that isn't the first one in the cluster, change the first's wsrep_cluster_address. This stops /tmp/12345/stop; /tmp/12345/start from creating a second cluster -- instead, it rejoins the original
This commit is contained in:
@@ -52,6 +52,10 @@ make_sandbox() {
|
||||
if [ -n "${master_port}" ]; then
|
||||
local master_listen_port=$(($master_port + 10))
|
||||
cluster_address="gcomm://$ip:$master_listen_port"
|
||||
|
||||
local this_listen_port=$(($port + 10))
|
||||
local this_cluster_address="gcomm://$ip:$this_listen_port"
|
||||
sed -e "s!gcomm://\$!$this_cluster_address!g" -i.bak "/tmp/$master_port/my.sandbox.cnf"
|
||||
fi
|
||||
|
||||
sed -e "s/ADDR/$ip/g" -i.bak "/tmp/$port/my.sandbox.cnf"
|
||||
@@ -118,7 +122,7 @@ make_sandbox() {
|
||||
debug_sandbox $port
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# If the sandbox is a slave, start the slave.
|
||||
if [ "$type" = "slave" ]; then
|
||||
/tmp/$port/use -e "change master to master_host='127.0.0.1', master_user='msandbox', master_password='msandbox', master_port=$master_port"
|
||||
|
@@ -299,6 +299,12 @@ case $opt in
|
||||
exit_status=$((exit_status | $?))
|
||||
|
||||
if [ "${2:-""}" = "cluster" ]; then
|
||||
# Bit of magic here. 'start-sandbox cluster new_node old_node'
|
||||
# changes old_node's my.sandbox.cnf's wsrep_cluster_address to
|
||||
# point to new_node. This is especially useful because otherwise,
|
||||
# calling stop/start like below on 12345 would create a new cluster.
|
||||
/tmp/12345/stop >/dev/null
|
||||
/tmp/12345/start >/dev/null
|
||||
echo -n "Checking that the cluster size is correct... "
|
||||
size=$(/tmp/12345/use -ss -e "SHOW STATUS LIKE 'wsrep_cluster_size'" | awk '{print $2}')
|
||||
if [ ${size:-0} -ne 3 ]; then
|
||||
|
Reference in New Issue
Block a user