# DbEnv.rep_start

`

###

    import com.sleepycat.db.*;

    public void rep_start(Dbt cdata, int flags)
        throws DbException;

# Description

The DbEnv.rep_start method configures the database environment as a client or master in a group of replicated database environments. Replication master environments are the only database environments where replicated databases may be modified. Replication client environments are read-only as long as they are clients. Replication client environments may be upgraded to be replication master environments in the case that the current master fails or there is no master present.

The enclosing database environment must already have been opened by calling the DbEnv.open method and must already have been configured to send replication messages by calling the DbEnv.set_rep_transport method.

The cdata parameter is an opaque data item that is sent over the communication infrastructure when the client or master comes online (see Connecting to a new site for more information). If no such information is useful, cdata should be null.

The flags value must be set to one of the following values:

Db.DB_REP_CLIENT
  Configure the environment as a replication client.

Db.DB_REP_LOGSONLY
  Configure the environment as a log files-only client.

Db.DB_REP_MASTER
  Configure the environment as a replication master.

The DbEnv.rep_start method throws an exception that encapsulates a non-zero error value on failure.

# Errors

The DbEnv.rep_start method may fail and throw an exception encapsulating a non-zero error for the following conditions:

EINVAL
  An invalid flag value or parameter was specified.

  The environment was not already configured to communicate with a replication group by a call to DbEnv.set_rep_transport.

  The environment was not already opened.

The DbEnv.rep_start method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the DbEnv.rep_start method may fail and throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.

# See Also

DbEnv.rep_start, DbEnv.rep_elect, DbEnv.rep_process_message, and DbEnv.set_rep_transport.`

Copyright Sleepycat Software