Using these methods, you can create new clusters or add nodes to an existing cluster in an automated fashion. The nodes may be created on existing machines and VMs, or OpsCenter can launch EC2 instances to host the nodes.
| Provisioning Methods | URL |
|---|---|
| Provision a new cluster | POST /provision |
| Add nodes to an existing cluster | POST /{cluster_id}/provision |
| Launch EC2 instances and provision a new cluster | POST /launch |
| Launch EC2 instances to add nodes to a cluster | POST /{cluster_id}/launch |
Set up and start a new Cassandra or DSE cluster on existing machines.
The post body should be a JSON dictionary containing, at a minimum, the following required entries:
The following entries are typically optional, but are sometimes required:
opscenter_config: A JSON dictionary representing the OpsCenter Cluster Config for the new cluster. If this option is omitted, the [cassandra]: seed_hosts option will be automatically populated and all other options will be left at their default values.
node_type_map: The role for each node that you specify when provisioning a DSE cluster. The entry should be a map from IP addresses to one of the following: "cassandra", "hadoop", or "solr". If omitted, "cassandra" is assumed.
topology_map: Specifications of the DCs and racks for the provisioned nodes, which you can pass as a map in the form {ip: [dc, rack]}. This argument is required when using a snitch other than SimpleSnitch, RackInferringSnitch, DseSimpleSnitch, or DseDelegateSnitch. The topology info is used for token selection purposes, but will not result in cassandra-topology.properties being filled out automatically.
token_map: A map of the form {ip: token} that overrides the default OpsCenter selection of balanced tokens for each node on a per-DC basis. OpsCenter does not currently pick balanced tokens automatically when multiple racks are in use. This should only be supplied when provisioning a cluster that is not using vnodes.
ssh_ip_map: A map of private interfaces to public interfaces used to deal with nodes that have different public and private interfaces (such as Amazon EC2).
accepted_fingerprints: A parameter that SSH automatically checks for each host. If the fingerprint for a host has not been seen before, the operation will fail with a status code of 409 unless that fingerprint is included in the accepted_fingerprints parameter. The format should be a map like {ip: <fingerprint>}, where <fingerprint> should be the the result of:
ssh-keygen -lf /dev/stdin <<< "_ $(ssh-keyscan $HOST 2>/dev/null | cut -f2,3 -d ' ')"
Alternatively, when a 409 status is returned, the result body will be a JSON dictionary with a fingerprints entry. The value of that entry is a map of {ip: <fingerprint>} that can be directly used as the value for the accepted_fingerprints parameter.
Returns a Request ID.
Example
When launching a three node DSC cluster, Our post body might look like:
{
"cassandra_config": {
"authenticator": "org.apache.cassandra.auth.AllowAllAuthenticator",
"authority": "org.apache.cassandra.auth.AllowAllAuthority",
"auto_snapshot": true,
"cluster_name": "Test Cluster",
"column_index_size_in_kb": 64,
"commitlog_directory": "/var/lib/cassandra/commitlog",
"commitlog_sync": "periodic",
"commitlog_sync_period_in_ms": 10000,
"compaction_preheat_key_cache": true,
"compaction_throughput_mb_per_sec": 16,
"concurrent_reads": 32,
"concurrent_writes": 32,
"data_file_directories": [
"/var/lib/cassandra/data"
],
"dynamic_snitch_badness_threshold": 0.1,
"dynamic_snitch_reset_interval_in_ms": 600000,
"dynamic_snitch_update_interval_in_ms": 100,
"encryption_options": {
"internode_encryption": "none",
"keystore": "conf/.keystore",
"keystore_password": "cassandra",
"truststore": "conf/.truststore",
"truststore_password": "cassandra"
},
"endpoint_snitch": "SimpleSnitch",
"flush_largest_memtables_at": 0.75,
"hinted_handoff_enabled": true,
"hinted_handoff_throttle_delay_in_ms": 1,
"in_memory_compaction_limit_in_mb": 64,
"incremental_backups": false,
"index_interval": 128,
"initial_token": null,
"key_cache_save_period": 14400,
"key_cache_size_in_mb": null,
"max_hint_window_in_ms": 3600000,
"memtable_flush_queue_size": 4,
"multithreaded_compaction": false,
"partitioner": "org.apache.cassandra.dht.RandomPartitioner",
"reduce_cache_capacity_to": 0.6,
"reduce_cache_sizes_at": 0.85,
"request_scheduler": "org.apache.cassandra.scheduler.NoScheduler",
"row_cache_provider": "SerializingCacheProvider",
"row_cache_save_period": 0,
"row_cache_size_in_mb": 0,
"rpc_keepalive": true,
"rpc_port": 9160,
"rpc_server_type": "sync",
"rpc_timeout_in_ms": 10000,
"saved_caches_directory": "/var/lib/cassandra/saved_caches",
"snapshot_before_compaction": false,
"ssl_storage_port": 7001,
"storage_port": 7000,
"thrift_framed_transport_size_in_mb": 15,
"thrift_max_message_length_in_mb": 16,
"trickle_fsync": false,
"trickle_fsync_interval_in_kb": 10240
},
"install_params": {
"username": "joe",
"password": "somepassword",
"package": "dsc",
"version": "1.1.2"
},
"nodes": [
"192.168.100.1",
"192.168.100.2",
"192.168.100.3"
]
}
Which we can use as follows:
curl -X POST
localhost:8888/provision
-d @provision.json
Output:
"da0794da-4a3a-11e2-b745-e0b9a54a6d93"
DSE Example
When launching a DSE cluster with two Cassandra nodes, one Hadoop node, and one Solr node, our post body might look like:
{
"cassandra_config": {
"authenticator": "org.apache.cassandra.auth.AllowAllAuthenticator",
"authority": "org.apache.cassandra.auth.AllowAllAuthority",
"auto_snapshot": true,
...
"trickle_fsync_interval_in_kb": 10240
},
"install_params": {
"username": "joe",
"password": "somepassword",
"package": "dse",
"version": "2.2.1",
"repo-user": "some-dse-username",
"repo-password": "some-dse-password"
},
"nodes": [
"192.168.100.1",
"192.168.100.2",
"192.168.100.3",
"192.168.100.4"
],
"node_type_map": {
"192.168.100.1": "cassandra",
"192.168.100.2": "cassandra",
"192.168.100.3": "hadoop",
"192.168.100.4": "solr"
}
}
Add new Cassandra or DSE nodes to a cluster.
| Path arguments: | cluster_id -- A Cluster Config ID. |
|---|
The post body should be the same as for POST /provision, but with the following differences:
Returns a Request ID.
Example
When adding two nodes to a DSC cluster, the post body may look like:
{
"cassandra_config": {
"authenticator": "org.apache.cassandra.auth.AllowAllAuthenticator",
"authority": "org.apache.cassandra.auth.AllowAllAuthority",
"auto_snapshot": true,
...
"trickle_fsync_interval_in_kb": 10240
},
"install_params": {
"username": "joe",
"password": "somepassword",
"package": "dsc",
"version": "1.1.2"
},
"nodes": [
"192.168.100.4",
"192.168.100.5"
],
"token_map": {
"192.168.100.4": "10",
"192.168.100.5": "46248042897083394072353090607538141429"
}
}
Launch a set of new EC2 instances and provision a new cluster on them.
The post body should be a JSON dictionary with two entries: launch and provision.
"launch" dictionary
The launch entry should be a dictionary containing the following required entries:
ec2_access_id: The AWS Access ID for the account you wish to launch the instances with.
ec2_secret_key: The matching AWS Secret Key for the provided Access ID.
location: The AWS region to use for launching the instances. The following options are available:
The default location is "US East (Northern Virginia)".
The following optional entries may also be used inside the launch dictionary:
"provision" dictionary
The following entries are typically optional, but are sometimes required:
Returns a Request ID.
Example
To launch a three node cluster in US East, availability zone 'a', our post body might look like this:
{
"provision": {
"cassandra_config": {
"authenticator": "org.apache.cassandra.auth.AllowAllAuthenticator",
"authority": "org.apache.cassandra.auth.AllowAllAuthority",
"auto_snapshot": true,
...
"trickle_fsync_interval_in_kb": 10240
},
"install_params": {
"package": "dsc",
"version": "1.1.2",
"username": "ubuntu"
},
"node_type_counts": {
"cassandra": 3
}
},
"launch" {
"ec2_access_id": "9BATIQ711LYY326X6191",
"ec2_secret_key": "I2nr9Jk1welj1IJekIejkbnQ91JmajIJaRea2ajR",
"location": "US East (Northern Virginia)",
"zone": "us-east-1a",
"image_id": "ami-6139e708",
"image_size": "m2.xlarge",
"keypair": "MyKeyPair",
"security_group": "default"
}
}
Launch a set of new EC2 instances in order to add new nodes to an Cassandra or DSE cluster.
| Path arguments: | cluster_id -- A Cluster Config ID. |
|---|
The post body should be the same as the one used for POST /launch with the following differences in the provision dictionary:
Returns a Request ID.
Example
To launch two EC2 instances and add two Hadoop nodes and one Solr node to an existing DSE cluster, body might look like this:
{
"provision": {
"cassandra_config": {
"authenticator": "org.apache.cassandra.auth.AllowAllAuthenticator",
"authority": "org.apache.cassandra.auth.AllowAllAuthority",
"auto_snapshot": true,
...
"trickle_fsync_interval_in_kb": 10240
},
"install_params": {
"package": "dse",
"version": "2.2.1",
"username": "ubuntu",
"repo-user": "some-dse-username",
"repo-password": "some-dse-password"
},
"type_token_map": {
"hadoop": ["10", "86248042897083394072353090607538141429"],
"solr": ["46248042897083394072353090607538141429"]
}
},
"launch" {
"ec2_access_id": "9BATIQ711LYY326X6191",
"ec2_secret_key": "I2nr9Jk1welj1IJekIejkbnQ91JmajIJaRea2ajR",
"location": "US East (Northern Virginia)",
"zone": "us-east-1a",
"image_id": "ami-6139e708",
"image_size": "m2.xlarge",
"keypair": "MyKeyPair",
"security_group": "default"
}
}