Logo

Command Palette

Search for a command to run...

databases promote-replica

Promotes the specified replica database server to a standalone primary. The replica will be reconfigured as the new primary. Providing the database type is optional and is only necessary for shared servers where we can't automatically determine the target database type.

When you promote a flat replica (one that has no downstream replicas of its own), the existing primary and other replicas will need to be removed after the process — the new configuration will have only a single database. You can reconfigure replication afterwards by scaling up new servers.

When you promote an intermediate replica in a cascading chain (for example B in A → B → C), the downstream subtree is preserved: B is detached from its old upstream A and reconfigured as an independent primary, and C continues replicating from B unchanged.

In the case of any servers not being accessible during this time, those servers will remain unchanged. It is therefore important to stop/shut down those servers in this case (or to manually stop the DB service on those servers) as having multiple primaries in a cluster could cause problems throughout the cluster.

$ cx databases promote-replica --stack <stack name> [--dbtype <database type>] <replica server name>

Options

ArgumentRequired?DefaultDescription
--stack, -s <stack name>yesName of your application
--dbtype <database type>noThe database type (mysql,postgresql,redis)
<replica server name>yesName of replica server to promote to master

Examples

$ cx databases promote-replica -s My_Awesome_App my_redis_replication_replica
$ cx databases promote-replica --stack My_Awesome_App --dbtype=mysql my_replica_server_name