public class MongoDBClientSupport
extends java.lang.Object
Constructor and Description |
---|
MongoDBClientSupport(com.mongodb.ServerAddress standalone) |
Modifier and Type | Method and Description |
---|---|
boolean |
addMemberToReplicaSet(MongoDBServer secondary,
java.lang.Integer id)
Reconfigures the replica set that this client is the primary member of to include a new member.
|
boolean |
addShardToRouter(java.lang.String hostAndPort) |
static MongoDBClientSupport |
forServer(AbstractMongoDBServer standalone)
Creates a
MongoDBClientSupport instance in standalone mode. |
org.bson.BasicBSONObject |
getReplicaSetStatus()
Runs
replSetGetStatus on the admin database. |
org.bson.BasicBSONObject |
getServerStatus() |
long |
getShardCount() |
boolean |
initializeReplicaSet(java.lang.String replicaSetName,
java.lang.Integer id) |
boolean |
ping() |
boolean |
removeMemberFromReplicaSet(MongoDBServer server)
Reconfigures the replica set that this client is the primary member of to
remove the given server.
|
com.google.common.base.Optional<com.mongodb.CommandResult> |
runDBCommand(java.lang.String database,
java.lang.String command) |
public MongoDBClientSupport(com.mongodb.ServerAddress standalone)
public static MongoDBClientSupport forServer(AbstractMongoDBServer standalone) throws java.net.UnknownHostException
MongoDBClientSupport
instance in standalone mode.java.net.UnknownHostException
public com.google.common.base.Optional<com.mongodb.CommandResult> runDBCommand(java.lang.String database, java.lang.String command)
public long getShardCount()
public org.bson.BasicBSONObject getServerStatus()
public boolean ping()
public boolean initializeReplicaSet(java.lang.String replicaSetName, java.lang.Integer id)
public org.bson.BasicBSONObject getReplicaSetStatus()
replSetGetStatus
on the admin database.replSetGetStatus
, or
an empty BasicBSONObject
if the command threw an exception (e.g. if
the connection was reset) or if the resultant CommandResult.ok()
was false.public boolean addMemberToReplicaSet(MongoDBServer secondary, java.lang.Integer id)
secondary
- New member of the set.id
- The id for the new set member. Must be unique within the set.public boolean removeMemberFromReplicaSet(MongoDBServer server)
server
- The server to removepublic boolean addShardToRouter(java.lang.String hostAndPort)