Class DbResetRepGroup

A utility to reset the members of a replication group, replacing the group
with a new group consisting of a single new member as described by the
arguments supplied to the utility.

This utility is useful when a copy of an existing replicated environment
needs to be used at a different site, with the same data, but with a
different initial node that can be used to grow the replication group as
usual. The utility can also be used to change the group name associated with
the environment.

The reset environment has a different identity from the environment before
the reset operation although it contains the same application data. To avoid
confusion, the reset environment is assigned a new internal unique id. The
unique id is checked whenever nodes attempt to communicate with each other
and ensure that all nodes in a group are dealing with the same data.

The reset process is typically accomplished using the steps outlined below.
It's good practice to back up your environment before running any utilities
that modify an environment.

Use DbResetRepGroup to reset an existing environment.
DbResetRepGroup can be used as a command line utility, and must be
executed locally on the host specified in the -nodeHostPort argument. The
host must also contain the environment directory.
Alternatively, DbResetRepGroup may be used programmatically through
the provided APIs.

Once reset, the environment can be opened with a
ReplicatedEnvironment, using the same node configuration as the one
that was passed in to the utility. No helper host configuration is needed.
Since the group consists of a single node, it will assume the role of a
Master, so long as it is created as an electable node.

Additional nodes may now be created and can join the group as newly
created replicas, as described in ReplicatedEnvironment. Since these
new nodes are empty, they should be configured to use the new master as
their helper node, and will go through the
replication node lifecycle
to populate their environment directories. In this case, there will be data
in the converted master that can only be transferred to the replica through
a file copy executed with the help of a
NetworkRestore

For example:

// Run the utility on a copy of an existing replicated environment. Usually
// this environment will have originated on a different node and its
// replication group information will contain meta data referring to its
// previous host. The utility will reset this metadata so that it has a
// rep group (UniversalRepGroup) with a single node named nodeMars. The node
// is associated with the machine mars and will communicate on port 5001.
DbResetRepGroup resetUtility =
new DbResetRepGroup(envDirMars, // env home dir
"UniversalRepGroup", // group name
"nodeMars", // node name
"mars:5001"); // node host,port
resetUtility.reset();
// Open the reset environment; it will take on the role of master.
ReplicatedEnvironment nodeMars = new ReplicatedEnvironment(envDirMars, ...);
...
// Bring up additional nodes, which will be initialized from
// nodeMars. For example, from the machine venus you can now add a new
// member to the group(UniversalRepGroup) as below.
ReplicationConfig repConfig = null;
try {
repConfig = new ReplicationConfig("UniversalRepGroup", // groupName
"nodeVenus", // nodeName
"venus:5008"); // nodeHostPort
repConfig.setHelperHosts("mars:5001");
nodeVenus = new ReplicatedEnvironment(envDirB, repConfig, envConfig);
} catch (InsufficientLogException insufficientLogEx) {
// log files will be copied from another node in the group
NetworkRestore restore = new NetworkRestore();
restore.execute(insufficientLogEx, new NetworkRestoreConfig());
// try opening the node now that the environment files have been
// restored on this machine.
nodeVenus = new ReplicatedEnvironment(envDirVenus,
repConfig,
envConfig);
}
...