To control replication when using the Berkeley DB SQL interface, you use the following PRAGMAs. For an example of how to use these, see Replication Usage Examples.
PRAGMA replication=ON|OFF
Enables the local environment to participate in replication. This PRAGMA must be invoked before BDB SQL initially creates the underlying BDB environment for a SQL database. That is, it must be invoked before you attempt to open, create or read any tables and before you create a SQL schema in a freshly created database.
Before invoking this PRAGMA, you must invoke the
replication_local_site
PRAGMA
and then either the
replication_initial_master
or
the replication_remote_site
PRAGMA. These actions define the way this site fits
into the replication group.
Use of this PRAGMA prior to environment creation affects environment creation and all subsequent opens such that replication will always be available for use with the environment. After the initial environment creation, you can invoke this PRAGMA to turn replication off or back on, but the effect of this action is deferred until the next time the environment is opened.
PRAGMA replication_initial_master=ON|OFF
Causes the local environment to start up as a master site. This PRAGMA must be used once and only once in the lifetime of a BDB SQL environment.
This PRAGMA must be invoked for the first site in a
new replication group before the
replication
PRAGMA is invoked
and before BDB SQL initially creates the underlying
BDB environment for a SQL database. Starting
replication on the initial master site establishes
the new replication group so that other sites can
join it.
Note that subsequent election activity can cause other sites in the replication group to become master. Do not assume that the initial master site will remain master indefinitely, or that it will rejoin the replication group as master after a shutdown.
PRAGMA replication_local_site="hostname:port"
Sets the local site information for replication.
PRAGMA replication_remote_site="hostname:port"
Sets information about a remote helper site in the replication group.
This PRAGMA is needed when a site first joins an
existing replication group to specify a site that
is already in the replication group. It must be
invoked before the replication
PRAGMA is invoked. This PRAGMA is not needed on
the initial master site or when restarting a site
that is already a member of the replication group.
However, supplying this PRAGMA in those situations
does no harm.
Note that the information provided to this PRAGMA can be superseded by normal replication activity over the course of the environment's lifetime.
PRAGMA replication_remove_site="host:port"
Removes the specified site from the replication group. Use this PRAGMA if you truly want to remove the site permanently from the group. It is not desirable to call this PRAGMA if a site has been temporarily shut down or disconnected from the rest of the replication group.
Removing a site from the replication group means that the site is no longer counted towards the total number of sites belonging to the group. This is important when the replication group requires knowledge about whether a quorum has been reached (such as when, for example, elections are held).
PRAGMA replication_verbose_output=ON|OFF
|
If set to TRUE, additional logging information specifically related to replication is created.
PRAGMA replication_verbose_file=filename
|
Indicates that verbose replication output should be sent to the specified file, as opposed to STDOUT.