public class MongoDBClientSupport
extends java.lang.Object
Constructor and Description |
---|
MongoDBClientSupport(com.mongodb.ServerAddress standalone) |
MongoDBClientSupport(com.mongodb.ServerAddress standalone,
java.lang.String username,
java.lang.String password,
java.lang.String authenticationDatabase) |
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.
|
|
runDBCommand(java.lang.String database,
java.lang.String command) |
public MongoDBClientSupport(com.mongodb.ServerAddress standalone)
public MongoDBClientSupport(com.mongodb.ServerAddress standalone, java.lang.String username, java.lang.String password, java.lang.String authenticationDatabase)
public static MongoDBClientSupport forServer(AbstractMongoDBServer standalone) throws java.net.UnknownHostException
MongoDBClientSupport
instance in standalone mode.java.net.UnknownHostException
publicrunDBCommand(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)