Add or Delete a Cell

Add

To add a cell after a cluster is up and running, you start off by creating one using the same steps previously performed to create the first cell:

  1. vtctldclient AddCellInfo \
  2. --root /vitess/cell2 \
  3. --server-address <cell2_topo_address> \
  4. cell2

Additionally, you will need to make the keyspace info visible in the cell. For every keyspace, issue the following:

  1. vtctldclient RebuildKeyspaceGraph --cells=cell2 <keyspace>

And finally, deploy the VSchema with

  1. vtctldclient RebuildVSchemaGraph --cells=cell2

If the cells option is not specified, the rebuild deploys to all cells.

Once these steps are done, you can bring up the necessary MySQLs, vttablets and vtgates under that cell.

Delete

To delete a cell, bring down all servers in that cell, and then remove its entry from the global topo with:

  1. vtctldclient DeleteCellInfo --force cell2

If --force is not used the command will error out if any keyspace was deployed to that cell. There is currently no clean way to undeploy a keyspace from a cell. So, --force will need to be used for most use cases.

VTGates and vtctlds do not refresh themselves after a cell is deleted or updated. It is recommended that you restart them.

Once the Vitess components are restarted, the final step will be to bring down the cell-specific topo server.

If you had deployed a cell-specific toposerver, that can now be brought down. The deployed info under the cell’s root (/vitess/cell2) will not be automatically deleted. You will have to manually delete that directory.