The first component to bring up is the Global TopoServer. As mentioned before, this can be a zookeeper or etcd cluster. The servers will likely have to be distributed across data centers for resilience. Please refer to the corresponding documentation for instructions on how to configure and launch these servers.
Vitess will store global metadata like keyspaces, shards and cells in the topserver.
Choosing a TopoRoot #
Vitess allows you to share the same global toposerver for multiple clusters. For example, you may want to run separate testing, staging and production clusters.
To support this separation, we allow you to assign a root directory in the Topo for each cluster. This directory is known as the
topo_global_root and will need to be provided as a command line flag to every Vitess component.
The following command line options are required for every Vitess component:
--topo_implementation=etcd2 --topo_global_server_address=<comma_separated_addresses> --topo_global_root=/vitess/global
To avoid repetition we will use
<topo_flags> in our examples to signify the above flags.
Note that the topo implementation for etcd is
etcd2. This is because Vitess uses the v2 API of etcd.
--enable-v2=true, even though it is the default value. Also, you will need to set the
ETCDCTL_API=2environment variable before bringing up etcd.
Moving to a different TopoServer #
It is generally not recommended that you migrate from one type of toposerver to another. However, if absolutely necessary, you can use the topo2topo command line tool to perform this migration.
It is important to periodically backup the data in the TopoServer. Although most of the information in the TopoServer can be manually reconstructed, it is still a painful task. This can be avoided if a recent backup was readily available.
- Ensure toposerver is up, and that you can set and get values using their provided client tools.
- Ensure you have the mechanism to include the correct topo flags for all the components:
- If using zookeeper, ensure the global root path is created. It may be beneficial to do the same for etcd also.
- Ensure that the servers are reachable from other parts of the system where Vitess components will be launched.