You are viewing an older version of this section. View current production version.

Changing an IP Address min read


This topic describes how to change an IP addresses for one or more hosts in a MemSQL cluster.

  1. Ensure you have a restorable backup of your cluster.

  2. 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
    
  3. Enable manual cluster control.

  4. Re-IP the desired hosts(s).

  5. For each Child Aggregator, update the master-aggregator line in the memsql.cnf file to point to the new Master Aggregator. The default path to this file is:

    /var/lib/memsql/<ROLE>-<PORT>-MI<HASH>/memsql.cnfor
    /path/to/node-directory/memsql.cnf

  6. For each Child Aggregator, rename the data directory (such as data-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.cnfor
    /path/to/node-directory/memsql.cnf

  7. Restart MemSQL.

    memsql-ops memsql-start --all
    
  8. 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;
    
  9. 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>]
    
  10. Confirm that all nodes are now up and running.

    memsql-ops memsql-list
    
  11. 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
    
  1. Ensure you have a restorable backup of your cluster.

  2. 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
    
  3. Re-IP the desired host(s).

  4. For each Child Aggregator, update the master-aggregator line in the memsql.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

  5. For each Child Aggregator, rename the data directory (such as data-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.

  6. Restart MemSQL.

    memsql-admin start-node --all
    
  7. 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;
    
  8. 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
    
  9. Confirm that all nodes are now up and running.

    memsql-admin list-nodes