|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.entity.nosql.mongodb.ReplicaSetConfig
public class ReplicaSetConfig
Simplifies the creation of configuration objects for Mongo DB replica sets.
A configuration object is structured like this:{ "_id" : "replica-set-name", "version" : 3, "members" : [ { "_id" : 0, "host" : "Sams.local:27017" }, { "_id" : 1, "host" : "Sams.local:27018" }, { "_id" : 2, "host" : "Sams.local:27019" } ] }To add or remove servers to a replica set you must redefine this configuration (run
replSetReconfig
on the primary) with the new members
list and the version
updated.
Constructor Summary | |
ReplicaSetConfig(java.lang.String name)
|
|
ReplicaSetConfig(java.lang.String name, BasicBSONList existingMembers)
|
Method Summary | |
---|---|
BasicBSONObject
|
build()
@return A BasicBSONObject representing the configuration that is suitable for a MongoDB server. |
static ReplicaSetConfig
|
builder(java.lang.String name)
Creates a configuration with the given name. |
static ReplicaSetConfig
|
fromExistingConfig(BSONObject config)
Creates a configuration from an existing configuration. |
ReplicaSetConfig
|
member(MongoDBServer server, java.lang.Integer id)
Adds a new member to the replica set config using MongoDBServer#HOSTNAME#HOSTNAME and MongoDBServer#PORT#PORT for hostname and port. |
ReplicaSetConfig
|
member(ServerAddress address, java.lang.Integer id)
Adds a new member to the replica set config using com.mongodb.ServerAddress#getHost() and com.mongodb.ServerAddress#getPort() for hostname and port. |
ReplicaSetConfig
|
member(java.lang.String hostname, java.lang.Integer port, java.lang.Integer id)
Adds a new member to the replica set config with the given hostname, port and id. |
ReplicaSetConfig
|
remove(MongoDBServer server)
Removes the first entity using MongoDBServer#HOSTNAME#HOSTNAME and MongoDBServer#PORT#PORT. |
ReplicaSetConfig
|
remove(java.lang.String hostname, java.lang.Integer port)
Removes the first entity with the given hostname and port from the list of members |
ReplicaSetConfig
|
version(java.lang.Integer version)
Sets the version of the configuration. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructor Detail |
---|
public ReplicaSetConfig(java.lang.String name)
public ReplicaSetConfig(java.lang.String name, BasicBSONList existingMembers)
Method Detail |
---|
public BasicBSONObject build()
public static ReplicaSetConfig builder(java.lang.String name)
public static ReplicaSetConfig fromExistingConfig(BSONObject config)
public ReplicaSetConfig member(MongoDBServer server, java.lang.Integer id)
public ReplicaSetConfig member(ServerAddress address, java.lang.Integer id)
public ReplicaSetConfig member(java.lang.String hostname, java.lang.Integer port, java.lang.Integer id)
public ReplicaSetConfig remove(MongoDBServer server)
public ReplicaSetConfig remove(java.lang.String hostname, java.lang.Integer port)
public ReplicaSetConfig version(java.lang.Integer version)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.