Provisioning New Nodes and Clusters¶
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 |
Provisioning on Prepared Servers¶
- POST /provision¶
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:
- cassandra_config: A Cassandra Config, which is a JSON dictionary representing the cassandra.yaml configuration for the nodes in the cluster.
- install_params: A dictionary specifying what packages to install
and the user credentials needed to access the machines using SSH. The
following entries are accepted:
- package: Either “dsc” or “dse”
- version: The version of DSC or DSE to install
- username: The username to use when SSHing to the machines
- password: The password for username. This may be omitted if a private key is specified and the user has root privileges or can perform the necessary actions using sudo without specifying a password.
- private_key: The text contents of the private key for username. This may be omitted if a password is specified.
- private_key_file: The path to a private key file. This may be used in place of the private_key option.
- repo-user: If installing DSE, this is the username that you use to access the DataStax enterprise repositories.
- repo-password: If installing DSE, this is the password that you use to access the DataStax enterprise repositories.
- local_datacenters: A list of JSON dictionaries. Each dictionary represents
one datacenter to provision.
The following keys are accepted for each datacenter:
- dc: An optional name to use for the datacenter.
- node_information: A list of JSON dictionaries. Each dictionary
represents a node to provision.
The following keys are accepted for each node:
- public_ip: The externally-facing ip address for the node.
- private_ip: A non public-facing ip, if available. Otherwise, this should be set to the same value as public_ip.
- rack: The rack value for the node. This value is optional. This value is mainly useful when using the GossipingPropertyFileSnitch.
- token: initial_token value for the node. This value is optional, and should only be supplied when not using vnodes.
- node_type: For DSE node, this should be set to the workload type. Acceptable values are “cassandra”, “hadoop”, “solr”, or “spark”. If omitted, then “cassandra” will be assumed.
The following entries are typically optional, but are sometimes required:
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" }, "local_datacenters": [ { "node_information": [ { "public_ip": "192.168.100.1", "private_ip": "192.168.100.1" }, { "public_ip": "192.168.100.2", "private_ip": "192.168.100.2" }, { "public_ip": "192.168.100.3", "private_ip": "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" }, "local_datacenters": [ { "dc": "dc1", "node_information": [ { "public_ip": "192.168.100.1", "private_ip": "192.168.100.1" "node_type": "cassandra" }, { "public_ip": "192.168.100.2", "private_ip": "192.168.100.2" "node_type": "cassandra" }, ] }, { "dc": "dc2", "node_information": [ { "public_ip": "192.168.100.3", "private_ip": "192.168.100.3" "node_type": "hadoop" } ] }, { "dc": "dc3", "node_information": [ { "public_ip": "192.168.100.4", "private_ip": "192.168.100.4" "node_type": "solr" } ] }, ] }
- POST /{cluster_id}/provision¶
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:- token is required for each node when provisioning a non-vnode cluster.
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" }, "local_datacenters": [ { "dc": "dc1", "node_information": [ { "public_ip": "192.168.100.4", "private_ip": "192.168.100.4", "token": "10" }, { "public_ip": "192.168.100.5", "private_ip": "192.168.100.5", "token": "46248042897083394072353090607538141429" }, ] } ] }
Provisioning with New EC2 Instances¶
- POST /launch¶
Launch a set of new EC2 instances and provision a new cluster on them.
The post body should be a JSON dictionary with the following keys:
- cassandra_config: The same as for the /provision route.
- install_params: The same as for the /provision route.
- cloud_credentials: This is a JSON dictionary that must contain the following two keys: * ec2_access_id: The AWS Access ID for the account you want to launch the instances with. * ec2_secret_key: The matching AWS Secret Key for the provided Access ID.
- cloud_datacenters: This is a list of JSON dictionaries. Each dictionary represents a datacenter to provision. The following keys are accepted for each dc:
- dc: A name to use for the datacenter.
- location: The AWS region to use for launching the instances. The default location is “US East (Northern Virginia)”. The following options are available: * “US East (Northern Virginia)”. * “US West (Northern California)”. * “US West (Oregon)”. * “EU (Ireland)”. * “Asia Pacific (Tokyo)”. * “Asia Pacific (Singapore)”. * “South America (Sao Paulo)”.
- image_id: The ami to launch.
- image_size: The instance size to launch.
- zone: The availability zone to use for launching.
- vpc_id: The Amazon VPC to use for launching.
- subnet_id: The subnet_id to use for launching.
- tokens: A list of initial_token values to assign to the launched nodes. This key is optional, and should only be supplied when not using vnodes.
- node_count: The number of nodes to launch.
- node_type: Similar to /provision. This is the type of DSE workload to set on the launched nodes.
- rack: The value of rack for the nodes.
- keypair: The name of an AWS keypair to use when launching the new EC2 instances.
- security_group: If omitted, a new security group named OpsCenterSecurityGroup will be created and used. This security group opens the default ports used by Cassandra, DSE, OpsCenter, and SSH.
- private_key_file: The contents of the private key for the EC2 keypair to use.
- username: The username to use when SSHing to the machines.
- private_key: The text contents of the private key for username. This can be omitted if a password is specified or if the keypair option was omitted, which results in a new key pair being created.
- private_key_file: The path to a private key file. This can be used in place of the private_key option.
Returns a Request ID.
Example
To launch a three node cluster in US East, availability zone ‘a’, our post body might look like this:
{ "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" }, "cloud_credentials": { "ec2_access_id": "9BATIQ711LYY326X6191", "ec2_secret_key": "I2nr9Jk1welj1IJekIejkbnQ91JmajIJaRea2ajR", }, "cloud_datacenters": [ { "dc": "dc1", "location": "US East (Northern Virginia)", "image_id": "ami-6139e708", "image_size": "m3.xlarge", "zone": "us-east-1a", "vpc_id": "vpc-32d3ad57", "subnet_id": "subnet-eb8b50c0", "tokens": ["1234", "5678" ], "node_count": 2, "node_type": "cassandra", "rack": "rack2", "security_group": "default" } ] }
- POST /{cluster_id}/launch¶
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
. When adding nodes to an existing datacenter, be sure to specify the “dc” in the cloud_datacenters information. Also, the node_type of the additional nodes should match the node_type of the existing nodes in that datacenter.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:
{ "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": "4.1.2", "username": "ubuntu" }, "cloud_credentials": { "ec2_access_id": "9BATIQ711LYY326X6191", "ec2_secret_key": "I2nr9Jk1welj1IJekIejkbnQ91JmajIJaRea2ajR", }, "cloud_datacenters": [ { "dc": "dc2", "location": "US East (Northern Virginia)", "image_id": "ami-6139e708", "image_size": "m3.xlarge", "zone": "us-east-1a", "vpc_id": "vpc-32d3ad57", "subnet_id": "subnet-eb8b50c0", "tokens": ["1234", "5678" ], "node_count": 2, "node_type": "hadoop", "rack": "rack3", "security_group": "default" }, { "dc": "dc3", "location": "US East (Northern Virginia)", "image_id": "ami-6139e708", "image_size": "m3.xlarge", "zone": "us-east-1a", "vpc_id": "vpc-32d3ad57", "subnet_id": "subnet-eb8b50c0", "tokens": ["7777"], "node_count": 1, "node_type": "solr", "rack": "rack4", "security_group": "default" } ] }