This topic describes how to change an IP addresses for one or more hosts in a MemSQL cluster.
-
Ensure you have a restorable backup of your cluster.
-
Shut down MemSQL.
memsql-ops memsql-stop --all
Note: If fixing a cluster after one or more IP addresses were already changed, perform a
kill -9 PID
on each host for each node.ps -aux | grep memsqld
Locate the PID in the result of the command above.
sudo kill -9 PID
-
Enable manual cluster control.
-
Re-IP the desired hosts(s).
-
For each Child Aggregator, update the
master-aggregator
line in thememsql.cnf
file to point to the new Master Aggregator. The default path to this file is:/var/lib/memsql/<ROLE>-<PORT>-MI<HASH>/memsql.cnf
– or –
/path/to/node-directory/memsql.cnf
-
For each Child Aggregator, rename the
data
directory (such asdata-bak
). This will allow the Child Aggregator to contact the Master Aggregator and re-replicate. The default path for the data directory is:/var/lib/memsql/<ROLE>-<PORT>-MI<HASH>/memsql.cnf
– or –
/path/to/node-directory/memsql.cnf
-
Restart MemSQL.
memsql-ops memsql-start --all
-
For each leaf in the cluster, remove and re-add the leaf from the Master Aggregator via the following SQL.
REMOVE LEAF '<old-ip>':port FORCE; ADD LEAF root@'<new-ip>':port;
-
On the host of the MemSQL Ops primary agent, re-monitor all nodes.
memsql-ops memsql-unmonitor <old-memsql-id>
memsql-ops memsql-monitor [-h <HOST>] [-P <PORT>]
-
Confirm that all nodes are now up and running.
memsql-ops memsql-list
-
Disable manual cluster control. If manual control is not disabled, MemSQL Ops will neither automatically start nor attach nodes if they fail.
memsql-ops cluster-manual-control --disable
-
Ensure you have a restorable backup of your cluster.
-
Shut down MemSQL.
memsql-admin stop-node --all
Note: If fixing a cluster after one or more IP addresses were changed, perform a
kill -9 PID
on each host for each node.ps -aux | grep memsqld
Locate the PID in the result of the command above.
sudo kill -9 PID
-
Re-IP the desired host(s).
-
For each Child Aggregator, update the
master-aggregator
line in thememsql.cnf
file to point to the new Master Aggregator. As the default path includes the version of MemSQL, which changes depending on which version you are on, this file resides in:
/path/to/node-directory/memsql.cnf
-
For each Child Aggregator, rename the
data
directory (such asdata-bak
). This will allow the Child Aggregator to contact the Master Aggregator and re-replicate. As the default path includes the version of MemSQL, which changes depending on which version you are on, this file resides in:/path/to/node-directory/memsql.cnf
. -
Restart MemSQL.
memsql-admin start-node --all
-
For each leaf in the cluster, remove and re-add the leaf from the Master Aggregator via the following SQL.
REMOVE LEAF '<old-ip>':port FORCE; ADD LEAF root@'<new-ip>':port;
-
On the MemSQL Toolbox host, re-register hosts with the new IP for MemSQL Toolbox. Note that this has no impact on the cluster itself, just the cluster management tools.
memsql-admin stop-node --memsql-id
memsql-toolbox-config unregister-host --host <host-IP-or-name>
memsql-toolbox-config register-host --host <host-IP-or-name>
memsql-admin start-node --memsql-id
-
Confirm that all nodes are now up and running.
memsql-admin list-nodes