brooklyn.entity.nosql.mongodb.MongoDBServer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brooklyn-software-nosql Show documentation
Show all versions of brooklyn-software-nosql Show documentation
Brooklyn entities for NoSQL data store software entities
The newest version!
package brooklyn.entity.nosql.mongodb;
import org.bson.BasicBSONObject;
import brooklyn.catalog.Catalog;
import brooklyn.config.ConfigKey;
import brooklyn.entity.basic.ConfigKeys;
import brooklyn.entity.proxying.ImplementedBy;
import brooklyn.event.AttributeSensor;
import brooklyn.event.basic.BasicConfigKey;
import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
import brooklyn.event.basic.Sensors;
import brooklyn.util.flags.SetFromFlag;
@Catalog(name="MongoDB Server",
description="MongoDB (from \"humongous\") is a scalable, high-performance, open source NoSQL database",
iconUrl="classpath:///mongodb-logo.png")
@ImplementedBy(MongoDBServerImpl.class)
public interface MongoDBServer extends AbstractMongoDBServer {
// See http://docs.mongodb.org/ecosystem/tools/http-interfaces/#http-console
// This is *always* 1000 more than port. We disable if it is not available.
PortAttributeSensorAndConfigKey HTTP_PORT =
new PortAttributeSensorAndConfigKey("mongodb.server.httpPort", "HTTP port for the server (estimated)", "28017+");
@SetFromFlag("enableRestInterface")
ConfigKey ENABLE_REST_INTERFACE = ConfigKeys.newBooleanConfigKey(
"mongodb.config.enable_rest", "Adds --rest to server startup flags when true", Boolean.FALSE);
AttributeSensor HTTP_INTERFACE_URL = Sensors.newStringSensor(
"mongodb.server.http_interface", "URL of the server's HTTP console");
AttributeSensor STATUS_BSON = Sensors.newSensor(BasicBSONObject.class,
"mongodb.server.status.bson", "Server status (BSON/JSON map ojbect)");
AttributeSensor UPTIME_SECONDS = Sensors.newDoubleSensor(
"mongodb.server.uptime", "Server uptime in seconds");
AttributeSensor OPCOUNTERS_INSERTS = Sensors.newLongSensor(
"mongodb.server.opcounters.insert", "Server inserts");
AttributeSensor OPCOUNTERS_QUERIES = Sensors.newLongSensor(
"mongodb.server.opcounters.query", "Server queries");
AttributeSensor OPCOUNTERS_UPDATES = Sensors.newLongSensor(
"mongodb.server.opcounters.update", "Server updates");
AttributeSensor OPCOUNTERS_DELETES = Sensors.newLongSensor(
"mongodb.server.opcounters.delete", "Server deletes");
AttributeSensor OPCOUNTERS_GETMORE = Sensors.newLongSensor(
"mongodb.server.opcounters.getmore", "Server getmores");
AttributeSensor OPCOUNTERS_COMMAND = Sensors.newLongSensor(
"mongodb.server.opcounters.command", "Server commands");
AttributeSensor NETWORK_BYTES_IN = Sensors.newLongSensor(
"mongodb.server.network.bytesIn", "Server incoming network traffic (in bytes)");
AttributeSensor NETWORK_BYTES_OUT = Sensors.newLongSensor(
"mongodb.server.network.bytesOut", "Server outgoing network traffic (in bytes)");
AttributeSensor NETWORK_NUM_REQUESTS = Sensors.newLongSensor(
"mongodb.server.network.numRequests", "Server network requests");
/** A single server's replica set configuration **/
ConfigKey REPLICA_SET = new BasicConfigKey(MongoDBReplicaSet.class,
"mongodb.replicaset", "The replica set to which the server belongs. " +
"Users should not set this directly when creating a new replica set.");
AttributeSensor REPLICA_SET_MEMBER_STATUS = Sensors.newSensor(
ReplicaSetMemberStatus.class, "mongodb.server.replicaSet.memberStatus", "The status of this server in the replica set");
AttributeSensor IS_PRIMARY_FOR_REPLICA_SET = Sensors.newBooleanSensor(
"mongodb.server.replicaSet.isPrimary", "True if this server is the write master for the replica set");
AttributeSensor IS_SECONDARY_FOR_REPLICA_SET = Sensors.newBooleanSensor(
"mongodb.server.replicaSet.isSecondary", "True if this server is a secondary server in the replica set");
AttributeSensor REPLICA_SET_PRIMARY_ENDPOINT = Sensors.newStringSensor(
"mongodb.server.replicaSet.primary.endpoint", "The host:port of the server which is acting as primary (master) for the replica set");
AttributeSensor MONGO_SERVER_ENDPOINT = Sensors.newStringSensor(
"mongodb.server.endpoint", "The host:port where this server is listening");
/**
* @return The replica set the server belongs to, or null if the server is a standalone instance.
*/
MongoDBReplicaSet getReplicaSet();
/**
* @return True if the server is a child of {@link MongoDBReplicaSet}.
*/
boolean isReplicaSetMember();
/**
* Initialises a replica set at the server the method is invoked on.
* @param replicaSetName The name for the replica set.
* @param id The id to be given to this server in the replica set configuration.
* @return True if initialisation is successful.
*/
boolean initializeReplicaSet(String replicaSetName, Integer id);
/**
* Reconfigures the replica set that the server the method is invoked on is the primary member of
* to include a new member.
*
* Note that this can cause long downtime (typically 10-20s, even up to a minute).
*
* @param secondary New member of the set.
* @param id The id for the new set member. Must be unique within the set; its validity is not checked.
* @return True if addition is successful. False if the server this is called on is not the primary
* member of the replica set.
*/
boolean addMemberToReplicaSet(MongoDBServer secondary, Integer id);
/**
* Reconfigures the replica set that the server the method is invoked on is the primary member of
* to remove the given server.
* @param server The server to remove.
* @return True if removal is successful. False if the server this is called on is not the primary
* member of the replica set.
*/
boolean removeMemberFromReplicaSet(MongoDBServer server);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy