DbEnv::repmgr_add_remote_site()
Prev | Chapter 11. Replication Methods | Next

## DbEnv::repmgr_add_remote_site()

    #include <db_cxx.h>

    int
    DbEnv::repmgr_add_remote_site(const char *host, u_int port, int *eidp,
                                  u_int32_t flags);

The `DbEnv::repmgr_add_remote_site()` method adds a new replication site to the Replication Manager's list of known sites. It is not necessary for all sites in a replication group to know about all other sites in the group.

The database environment's replication subsystem may also be configured using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "repmgr_add_remote_site", one or more whitespace characters, and the host, port and optional peer parameters specified. For example, "repmgr_add_remote_site example.com 49201 peer".

The `DbEnv::repmgr_add_remote_site()` method may be called at any time during the life of the application.

The `DbEnv::repmgr_add_remote_site()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Parameters

#### host

The site's host identification string, generally a TCP/IP host name.

#### port

The port number on which the remote site is receiving.

#### eidp

If eidp is non-NULL, and the database environment has already been opened by calling DbEnv::open(), then the environment ID assigned to the remote site is returned in the memory location referenced by eidp.

#### flags

The flags parameter must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values:

- `DB_REPMGR_PEER`

  Specifying the `DB_REPMGR_PEER` flag configures client-to-client synchronization with the specified remote site.

  You can configure one or more remote sites as client peers. To remove a remote site as a possible client peer, call the `DbEnv::repmgr_add_remote_site()` method for that site with a flags value excluding the DB_REPMGR_PEER bit value.

### Errors

The `DbEnv::repmgr_add_remote_site()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

#### EINVAL

If this method is called from a base replication API application; or if an invalid flag value or parameter was specified.

### Class

DbEnv

### See Also

Replication and Related Methods

Prev | Up | Next
DbEnv::rep_sync() | Home | DbEnv::repmgr_get_ack_policy()