public class ReplicationGroupAdmin
extends java.lang.Object
Constructor and Description |
---|
ReplicationGroupAdmin(java.lang.String groupName,
java.util.Set<java.net.InetSocketAddress> helperSockets)
Constructs a group admin object.
|
Modifier and Type | Method and Description |
---|---|
ReplicationNode |
ensureMonitor(RepNodeImpl monitor) |
ReplicationGroup |
getGroup()
Returns the current composition of the group from the Master.
|
java.lang.String |
getGroupName()
Returns the name of the replication group.
|
java.util.Set<java.net.InetSocketAddress> |
getHelperSockets()
Returns the helper sockets being used to contact a replication group
member, in order to query for the information.
|
java.lang.String |
getMasterNodeName()
Returns the node name associated with the master
|
NodeState |
getNodeState(ReplicationNode repNode,
int socketConnectTimeout)
Returns the
state of a replicated
node and state of the application where the node is
running in. |
void |
removeMember(java.lang.String nodeName)
Removes this node from the group, so that it is no longer a member of
the group.
|
java.lang.String |
transferMaster(java.util.Set<java.lang.String> nodeNames,
int timeout,
java.util.concurrent.TimeUnit timeUnit,
boolean force)
Transfers the master state from the current master to one of the
replicas supplied in the argument list.
|
void |
updateAddress(java.lang.String nodeName,
java.lang.String newHostName,
int newPort)
Update the network address for a specified member of the replication
group.
|
public ReplicationGroupAdmin(java.lang.String groupName, java.util.Set<java.net.InetSocketAddress> helperSockets)
groupName
- the name of the group to be administeredhelperSockets
- the sockets on which it can contact helper nodes
in the replication group to carry out admin services.public java.util.Set<java.net.InetSocketAddress> getHelperSockets()
public java.lang.String getGroupName()
public java.lang.String getMasterNodeName() throws UnknownMasterException, EnvironmentFailureException
UnknownMasterException
- if the master was not foundEnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.public ReplicationNode ensureMonitor(RepNodeImpl monitor) throws UnknownMasterException, EnvironmentFailureException
monitor
- the monitor nodeUnknownMasterException
- if the master was not foundEnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.public void removeMember(java.lang.String nodeName) throws UnknownMasterException, MemberNotFoundException, MasterStateException, EnvironmentFailureException
Monitor
it will no longer be informed of
election results. Once removed, a node cannot be added again to the
group under the same node name.
Ideally, the node being removed should be shut down before this call is issued.
If the node is an active Replica
the master will terminate
its connection with the node and will not allow the replica to reconnect
with the group, since it's no longer a member of the group. If the node
wishes to re-join it should do so with a different node name.
An active Master cannot be removed. It must first be shutdown, or
transition to the Replica
state before it can be removed
from the group.
nodeName
- identifies the node being removed from the groupUnknownMasterException
- if the master was not foundMemberNotFoundException
- if the node denoted by
nodeName
is not a member of the replication groupMasterStateException
- if the member being removed is currently
the MasterEnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.public ReplicationGroup getGroup() throws UnknownMasterException, EnvironmentFailureException
UnknownMasterException
- if the master was not foundEnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurspublic NodeState getNodeState(ReplicationNode repNode, int socketConnectTimeout) throws java.io.IOException, ServiceDispatcher.ServiceConnectFailedException
state
of a replicated
node and state
of the application where the node is
running in.repNode
- a ReplicationNode includes those information which are
needed to connect to the nodesocketConnectTimeout
- the timeout value for creating a socket
connection with the replicated nodejava.io.IOException
- if the machine is down or no response is returnedServiceDispatcher.ServiceConnectFailedException
- if can't connect to the service
running on the replicated nodepublic void updateAddress(java.lang.String nodeName, java.lang.String newHostName, int newPort) throws EnvironmentFailureException, MasterStateException, MemberNotFoundException, ReplicaStateException, UnknownMasterException
To make a network address change, take these steps:
nodeName
- the name of the node whose address will be updated.newHostName
- the new host name of the nodenewPort
- the new port number of the nodeEnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occursMasterStateException
- if the member being updated is currently
the masterMemberNotFoundException
- if the node denoted by
nodeName
is not a member of the replication groupReplicaStateException
- if the member being updated is currently
aliveUnknownMasterException
- if the master was not foundDbResetRepGroup, which can be used in a
related but different use case to copy and move a group.
public java.lang.String transferMaster(java.util.Set<java.lang.String> nodeNames, int timeout, java.util.concurrent.TimeUnit timeUnit, boolean force) throws MasterTransferFailureException, UnknownMasterException
MasterTransferFailureException
- if the master transfer operation
failsUnknownMasterException
- if the master was not foundReplicatedEnvironment.transferMaster(java.util.Set<java.lang.String>, int, java.util.concurrent.TimeUnit)
Copyright (c) 2004-2012 Oracle. All rights reserved.