Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
SingleStore Managed Service does not support this command.
Starts or continues replicating a database from a remote host to the local host. The database on the remote host is the primary database and the database on the local host is its secondary. The primary database must be in a different cluster than the secondary database.
REPLICATE DATABASE db_name [WITH FORCE DIFFERENTIAL] FROM master_user[:'master_password']@master_host[:master_port][/master_db_name]
db_name
is the name of the target database on the secondary SingleStore DB instance. REPLICATE DATABASE
will attempt to create a new database named db_name
, unless the WITH FORCE DIFFERENTIAL
clause is used. The database name on the secondary does not need to match the name of its corresponding remote primary database.REPLICATE DATABASE
always replicates asynchronously.WITH FORCE DIFFERENTIAL
replicates only the contents of the primary database that are not already in the secondary database. Most often, you should use the WITH FORCE DIFFERENTIAL
clause to resume replication from the original primary database following a cluster failover or to upgrade clusters which are replicating/being replicated to. When you use this clause, a new database is not created, because the database already exists.master_user
and master_password
must grant access to the primary database. The password is assumed to be blank if master_password
is not specified explicitly. If you specify a password, enclose it in single quotes.master_host
is the host name or IPv4/IPv6 pointing to the remote database. It can be quoted to allow special characters (e.g. “-", among others). master_host
must be in a different cluster than the local host.master_db_name
is the name of the remote, primary database. If it is not specified explicitly, SingleStore DB attempts to replicate from db_name
on the master SingleStore DB instance.replicating
state (see Database States).CONTINUE REPLICATING
can be used to re-point a replica from one master to another.REPLICATE DATABASE ExampleDatabase FROM root@master-host:3306;
REPLICATE DATABASE ExampleDatabase FROM master_user:'master_password'@master-host:3306/MasterExampleDatabase;
WITH FORCE DIFFERENTIAL
The Replicating Data Across Clusters topic provides examples of using WITH FORCE DIFFERENTIAL
to replicate only the contents of the primary database that are not already in the secondary database.
Related Topics