org.apache.brooklyn.entity.nosql.couchbase.CouchbaseNode 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
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.brooklyn.entity.nosql.couchbase;
import java.net.URI;
import org.apache.brooklyn.api.catalog.Catalog;
import org.apache.brooklyn.api.entity.ImplementedBy;
import org.apache.brooklyn.api.sensor.AttributeSensor;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.annotation.Effector;
import org.apache.brooklyn.core.annotation.EffectorParam;
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.config.render.RendererHints;
import org.apache.brooklyn.core.effector.Effectors;
import org.apache.brooklyn.core.effector.MethodEffector;
import org.apache.brooklyn.core.entity.Attributes;
import org.apache.brooklyn.core.sensor.BasicAttributeSensorAndConfigKey;
import org.apache.brooklyn.core.sensor.PortAttributeSensorAndConfigKey;
import org.apache.brooklyn.core.sensor.Sensors;
import org.apache.brooklyn.entity.software.base.SoftwareProcess;
import org.apache.brooklyn.util.core.flags.SetFromFlag;
import org.apache.brooklyn.util.text.ByteSizeStrings;
@Catalog(name="CouchBase Node", description="Couchbase Server is an open source, distributed (shared-nothing architecture) "
+ "NoSQL document-oriented database that is optimized for interactive applications.")
@ImplementedBy(CouchbaseNodeImpl.class)
public interface CouchbaseNode extends SoftwareProcess {
@SetFromFlag("adminUsername")
ConfigKey COUCHBASE_ADMIN_USERNAME = ConfigKeys.newStringConfigKey("couchbase.adminUsername", "Username for the admin user on the node", "Administrator");
@SetFromFlag("adminPassword")
ConfigKey COUCHBASE_ADMIN_PASSWORD = ConfigKeys.newStringConfigKey("couchbase.adminPassword", "Password for the admin user on the node", "Password");
@SetFromFlag("version")
ConfigKey SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION,
"3.0.0");
@SetFromFlag("enterprise")
ConfigKey USE_ENTERPRISE = ConfigKeys.newBooleanConfigKey("couchbase.enterprise.enabled",
"Whether to use Couchbase Enterprise; if false uses the community version. Defaults to true.", true);
@SetFromFlag("downloadUrl")
BasicAttributeSensorAndConfigKey DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey(
SoftwareProcess.DOWNLOAD_URL, "http://packages.couchbase.com/releases/${version}/"
+ "couchbase-server-${driver.communityOrEnterprise}${driver.downloadLinkPreVersionSeparator}${version}${driver.downloadLinkOsTagWithPrefix}");
@SetFromFlag("clusterInitRamSize")
BasicAttributeSensorAndConfigKey COUCHBASE_CLUSTER_INIT_RAM_SIZE = new BasicAttributeSensorAndConfigKey(
Integer.class, "couchbase.clusterInitRamSize", "initial ram size of the cluster", 300);
PortAttributeSensorAndConfigKey COUCHBASE_WEB_ADMIN_PORT = new PortAttributeSensorAndConfigKey("couchbase.webAdminPort", "Web Administration Port", "8091+");
PortAttributeSensorAndConfigKey COUCHBASE_API_PORT = new PortAttributeSensorAndConfigKey("couchbase.apiPort", "Couchbase API Port", "8092+");
PortAttributeSensorAndConfigKey COUCHBASE_INTERNAL_BUCKET_PORT = new PortAttributeSensorAndConfigKey("couchbase.internalBucketPort", "Internal Bucket Port", "11209");
PortAttributeSensorAndConfigKey COUCHBASE_INTERNAL_EXTERNAL_BUCKET_PORT = new PortAttributeSensorAndConfigKey("couchbase.internalExternalBucketPort", "Internal/External Bucket Port", "11210");
PortAttributeSensorAndConfigKey COUCHBASE_CLIENT_INTERFACE_PROXY = new PortAttributeSensorAndConfigKey("couchbase.clientInterfaceProxy", "Client interface (proxy)", "11211");
PortAttributeSensorAndConfigKey COUCHBASE_INCOMING_SSL_PROXY = new PortAttributeSensorAndConfigKey("couchbase.incomingSslProxy", "Incoming SSL Proxy", "11214");
PortAttributeSensorAndConfigKey COUCHBASE_INTERNAL_OUTGOING_SSL_PROXY = new PortAttributeSensorAndConfigKey("couchbase.internalOutgoingSslProxy", "Internal Outgoing SSL Proxy", "11215");
PortAttributeSensorAndConfigKey COUCHBASE_REST_HTTPS_FOR_SSL = new PortAttributeSensorAndConfigKey("couchbase.internalRestHttpsForSsl", "Internal REST HTTPS for SSL", "18091");
PortAttributeSensorAndConfigKey COUCHBASE_CAPI_HTTPS_FOR_SSL = new PortAttributeSensorAndConfigKey("couchbase.internalCapiHttpsForSsl", "Internal CAPI HTTPS for SSL", "18092");
PortAttributeSensorAndConfigKey ERLANG_PORT_MAPPER = new PortAttributeSensorAndConfigKey("couchbase.erlangPortMapper", "Erlang Port Mapper Daemon Listener Port (epmd)", "4369");
PortAttributeSensorAndConfigKey NODE_DATA_EXCHANGE_PORT_RANGE_START = new PortAttributeSensorAndConfigKey("couchbase.nodeDataExchangePortRangeStart", "Node data exchange Port Range Start", "21100+");
PortAttributeSensorAndConfigKey NODE_DATA_EXCHANGE_PORT_RANGE_END = new PortAttributeSensorAndConfigKey("couchbase.nodeDataExchangePortRangeEnd", "Node data exchange Port Range End", "21199+");
AttributeSensor IS_PRIMARY_NODE = Sensors.newBooleanSensor("couchbase.isPrimaryNode", "flag to determine if the current couchbase node is the primary node for the cluster");
AttributeSensor IS_IN_CLUSTER = Sensors.newBooleanSensor("couchbase.isInCluster", "flag to determine if the current couchbase node has been added to a cluster, "
+ "including being the first / primary node");
AttributeSensor COUCHBASE_WEB_ADMIN_URL = Attributes.MAIN_URI;
// Interesting stats
AttributeSensor OPS = Sensors.newDoubleSensor("couchbase.stats.ops",
"Retrieved from pools/nodes//interestingStats/ops");
AttributeSensor COUCH_DOCS_DATA_SIZE = Sensors.newLongSensor("couchbase.stats.couch.docs.data.size",
"Retrieved from pools/nodes//interestingStats/couch_docs_data_size");
AttributeSensor COUCH_DOCS_ACTUAL_DISK_SIZE = Sensors.newLongSensor("couchbase.stats.couch.docs.actual.disk.size",
"Retrieved from pools/nodes//interestingStats/couch_docs_actual_disk_size");
AttributeSensor EP_BG_FETCHED = Sensors.newLongSensor("couchbase.stats.ep.bg.fetched",
"Retrieved from pools/nodes//interestingStats/ep_bg_fetched");
AttributeSensor MEM_USED = Sensors.newLongSensor("couchbase.stats.mem.used",
"Retrieved from pools/nodes//interestingStats/mem_used");
AttributeSensor COUCH_VIEWS_ACTUAL_DISK_SIZE = Sensors.newLongSensor("couchbase.stats.couch.views.actual.disk.size",
"Retrieved from pools/nodes//interestingStats/couch_views_actual_disk_size");
AttributeSensor CURR_ITEMS = Sensors.newLongSensor("couchbase.stats.curr.items",
"Retrieved from pools/nodes//interestingStats/curr_items");
AttributeSensor VB_REPLICA_CURR_ITEMS = Sensors.newLongSensor("couchbase.stats.vb.replica.curr.items",
"Retrieved from pools/nodes//interestingStats/vb_replica_curr_items");
AttributeSensor COUCH_VIEWS_DATA_SIZE = Sensors.newLongSensor("couchbase.stats.couch.views.data.size",
"Retrieved from pools/nodes//interestingStats/couch_views_data_size");
AttributeSensor GET_HITS = Sensors.newLongSensor("couchbase.stats.get.hits",
"Retrieved from pools/nodes//interestingStats/get_hits");
AttributeSensor CMD_GET = Sensors.newDoubleSensor("couchbase.stats.cmd.get",
"Retrieved from pools/nodes//interestingStats/cmd_get");
AttributeSensor CURR_ITEMS_TOT = Sensors.newLongSensor("couchbase.stats.curr.items.tot",
"Retrieved from pools/nodes//interestingStats/curr_items_tot");
AttributeSensor REBALANCE_STATUS = Sensors.newStringSensor("couchbase.rebalance.status",
"Displays the current rebalance status from pools/nodes/rebalanceStatus");
class MainUri {
public static final AttributeSensor MAIN_URI = Attributes.MAIN_URI;
static {
// ROOT_URL does not need init because it refers to something already initialized
RendererHints.register(COUCHBASE_WEB_ADMIN_URL, RendererHints.namedActionWithUrl());
RendererHints.register(COUCH_DOCS_DATA_SIZE, RendererHints.displayValue(ByteSizeStrings.metric()));
RendererHints.register(COUCH_DOCS_ACTUAL_DISK_SIZE, RendererHints.displayValue(ByteSizeStrings.metric()));
RendererHints.register(MEM_USED, RendererHints.displayValue(ByteSizeStrings.metric()));
RendererHints.register(COUCH_VIEWS_ACTUAL_DISK_SIZE, RendererHints.displayValue(ByteSizeStrings.metric()));
RendererHints.register(COUCH_VIEWS_DATA_SIZE, RendererHints.displayValue(ByteSizeStrings.metric()));
}
}
// this long-winded reference is done just to trigger the initialization above
AttributeSensor MAIN_URI = MainUri.MAIN_URI;
MethodEffector SERVER_ADD = new MethodEffector(CouchbaseNode.class, "serverAdd");
MethodEffector SERVER_ADD_AND_REBALANCE = new MethodEffector(CouchbaseNode.class, "serverAddAndRebalance");
MethodEffector REBALANCE = new MethodEffector(CouchbaseNode.class, "rebalance");
MethodEffector BUCKET_CREATE = new MethodEffector(CouchbaseNode.class, "bucketCreate");
org.apache.brooklyn.api.effector.Effector ADD_REPLICATION_RULE = Effectors.effector(Void.class, "addReplicationRule")
.description("Adds a replication rule from the indicated bucket on the cluster where this node is located "
+ "to the indicated cluster and optional destination bucket")
.parameter(String.class, "fromBucket", "Bucket to be replicated")
.parameter(Object.class, "toCluster", "Entity (or ID) of the cluster to which this should replicate")
.parameter(String.class, "toBucket", "Destination bucket for replication in the toCluster, defaulting to the same as the fromBucket")
.buildAbstract();
@Effector(description = "add a server to a cluster")
public void serverAdd(@EffectorParam(name = "serverHostname") String serverToAdd, @EffectorParam(name = "username") String username, @EffectorParam(name = "password") String password);
@Effector(description = "add a server to a cluster, and immediately rebalances")
public void serverAddAndRebalance(@EffectorParam(name = "serverHostname") String serverToAdd, @EffectorParam(name = "username") String username, @EffectorParam(name = "password") String password);
@Effector(description = "rebalance the couchbase cluster")
public void rebalance();
@Effector(description = "create a new bucket")
public void bucketCreate(@EffectorParam(name = "bucketName") String bucketName, @EffectorParam(name = "bucketType") String bucketType,
@EffectorParam(name = "bucketPort") Integer bucketPort, @EffectorParam(name = "bucketRamSize") Integer bucketRamSize,
@EffectorParam(name = "bucketReplica") Integer bucketReplica);
}