├── README.md ├── alerts.json ├── configuration ├── cassandra-env.xml └── cassandra-site.xml ├── metainfo.xml ├── package ├── .hash ├── scripts │ ├── cassandra.py │ ├── cassandra_master.py │ ├── clients.py │ ├── params.py │ ├── properties_config.py │ └── service_check.py └── templates │ └── cassandra.master.yaml.j2 └── screenshots ├── Initial-config.png ├── Installed-service-config.png └── Installed-service-stop.png .png /README.md: -------------------------------------------------------------------------------- 1 | # ambari-cassandra-service 2 | Ambari service for installing and managing Cassandra on HDP clusters. Apache Cassandra is an open source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. 3 | 4 | Author: [Amey Jain](https://github.com/ajak6) 5 | 6 | #### Setup 7 | - Download HDP 2.3 sandbox VM image (Sandbox_HDP_2.3_1_VMware.ova) from [Hortonworks website](http://hortonworks.com/products/hortonworks-sandbox/) 8 | - Import Sandbox_HDP_2.3_1_VMware.ova into VMWare and set the VM memory size to 8GB 9 | - Now start the VM 10 | - After it boots up, find the IP address of the VM and add an entry into your machines hosts file. For example: 11 | ``` 12 | xx.xx.xx.xx sandbox.hortonworks.com sandbox 13 | ``` 14 | - Note that you will need to replace the above xx.xx.xx.xx with the IP for your own VM 15 | 16 | - Connect to the VM via SSH (password hadoop) 17 | ``` 18 | ssh root@sandbox.hortonworks.com 19 | ``` 20 | 21 | - To download the Cassandra service folder, run below 22 | ``` 23 | VERSION=`hdp-select status hadoop-client | sed 's/hadoop-client - \([0-9]\.[0-9]\).*/\1/'` 24 | sudo git clone https://github.com/Symantec/ambari-cassandra-service.git /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/CASSANDRA 25 | ``` 26 | - Restart Ambari 27 | ``` 28 | #sandbox 29 | service ambari restart 30 | 31 | #non sandbox 32 | sudo service ambari-server restart 33 | ``` 34 | 35 | - Then you can click on 'Add Service' from the 'Actions' dropdown menu in the bottom left of the Ambari dashboard: 36 | 37 | On bottom left -> Actions -> Add service -> check Cassandra -> Next -> check nodes to be present in the cluster and act as client-> Next -> Change any config you like (e.g. install dir, memory sizes, num containers or values in cassandra.yaml) -> Next -> Deploy 38 | Add the Ip address of all the seed nodes in the ring. It can be 1 to many. Add comma separated IP/Hostname value in quotes 39 | 40 | ![Image](../master/screenshots/Initial-config.png?raw=true) 41 | 42 | - On successful deployment you will see the Cassaandra service as part of Ambari stack and will be able to start/stop the service from here: 43 | ![Image](../master/screenshots/Installed-service-stop.png?raw=true) 44 | 45 | - You can see the parameters you configured under 'Configs' tab 46 | ![Image](../master/screenshots/Installed-service-config.png?raw=true) 47 | 48 | 49 | #### Remove service 50 | 51 | - To remove the Cassandra service: 52 | - Stop the service via Ambari 53 | - Unregister the service 54 | 55 | ``` 56 | export SERVICE=Cassandra 57 | export PASSWORD=admin 58 | export AMBARI_HOST=localhost 59 | #detect name of cluster 60 | output=`curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' http://$AMBARI_HOST:8080/api/v1/clusters` 61 | CLUSTER=`echo $output | sed -n 's/.*"cluster_name" : "\([^\"]*\)".*/\1/p'` 62 | 63 | curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X DELETE http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE 64 | 65 | #if above errors out, run below first to fully stop the service 66 | #curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE 67 | ``` 68 | - Remove artifacts 69 | ``` 70 | rm -rf /var/lib/cassandra/* 71 | 72 | ``` 73 | 74 | # Contributions 75 | Prior to receiving information from any contributor, Symantec requires that all contributors complete, sign, and submit Symantec Personal Contributor Agreement (SPCA). The purpose of the SPCA is to clearly define the terms under which intellectual property has been contributed to the project and thereby allow Symantec to defend the project should there be a legal dispute regarding the software at some future time. A signed SPCA is required to be on file before an individual is given commit privileges to the Symantec open source project. Please note that the privilege to commit to the project is conditional and may be revoked by Symantec. 76 | 77 | If you are employed by a corporation, a Symantec Corporate Contributor Agreement (SCCA) is also required before you may contribute to the project. If you are employed by a company, you may have signed an employment agreement that assigns intellectual property ownership in certain of your ideas or code to your company. We require a SCCA to make sure that the intellectual property in your contribution is clearly contributed to the Symantec open source project, even if that intellectual property had previously been assigned by you. 78 | 79 | Please complete the SPCA and, if required, the SCCA and return to Symantec at: 80 | 81 | Symantec Corporation Legal Department Attention: Product Legal Support Team 350 Ellis Street Mountain View, CA 94043 82 | 83 | Please be sure to keep a signed copy for your records. 84 | 85 | # License 86 | Copyright 2016 Symantec Corporation. 87 | 88 | Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. 89 | 90 | You may obtain a copy of the License at 91 | 92 | 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. 93 | -------------------------------------------------------------------------------- /alerts.json: -------------------------------------------------------------------------------- 1 | { 2 | "Cassandra": { 3 | "service": [], 4 | "Cluster-Hosts": [ 5 | { 6 | "name": "Cassandra_service", 7 | "label": "Cassandra Service Process", 8 | "description": "This host-level alert is triggered if the Cassandra service cannot be determined to be up.", 9 | "interval": 1, 10 | "scope": "HOST", 11 | "source": { 12 | "type": "PORT", 13 | "uri": "{{cassandra-site/storage_port}}", 14 | "default_port": 7000, 15 | "reporting": { 16 | "ok": { 17 | "text": "TCP OK - {0:.3f}s response on port {1}" 18 | }, 19 | "warning": { 20 | "text": "TCP OK - {0:.3f}s response on port {1}", 21 | "value": 1.5 22 | }, 23 | "critical": { 24 | "text": "Connection failed: {0} to {1}:{2}", 25 | "value": 5.0 26 | } 27 | } 28 | } 29 | } 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /configuration/cassandra-env.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | cassandra_user 7 | cassandra 8 | USER 9 | 10 | 11 | 12 | smoke_test_user 13 | smoke 14 | USER 15 | 16 | 17 | 18 | cassandra_log_dir 19 | /var/log/cassandra 20 | Log directory for elastic 21 | 22 | 23 | cassandra_pid_dir 24 | /var/run/cassandra 25 | This is location of pid file for cassandra 26 | 27 | 28 | -------------------------------------------------------------------------------- /configuration/cassandra-site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | template 9 | Welcome, %s! 10 | Welcome template 11 | 12 | 13 | 14 | cluster_name 15 | Test Cluster 16 | Cluster name identifies your cluster. 17 | 18 | 19 | 20 | num_tokens 21 | 256 22 | Number of tokens per node 23 | 24 | 25 | hinted_handoff_enabled 26 | true 27 | Enable or disable hinted handoff 28 | 29 | 30 | hinted_handoff_throttle_in_kb 31 | 1024 32 | Maximum throttle per delivery thread in kilobytes per 33 | second 34 | 35 | 36 | 37 | max_hints_delivery_threads 38 | 2 39 | Number of threads with which to deliver hints. 40 | 41 | 42 | 43 | 44 | batchlog_replay_throttle_in_kb 45 | 1024 46 | Total maximum throttle 47 | 48 | 49 | authenticator 50 | AllowAllAuthenticator 51 | The authentication backend. It implements IAuthenticator 52 | for identifying users 53 | 54 | 55 | 56 | authorizer 57 | AllowAllAuthorizer 58 | The authorization backend. It implements IAuthenticator 59 | to limit access and provide permissions 60 | 61 | 62 | 63 | 64 | permissions_validity_in_ms 65 | 2000 66 | How long permissions in cache remain valid 67 | 68 | 69 | partitioner 70 | org.apache.cassandra.dht.Murmur3Partitioner 71 | Distributes rows (by partition key) across all nodes in 72 | the cluster 73 | 74 | 75 | 76 | data_file_directories 77 | /var/lib/cassandra/data 78 | the directory location where table data (SSTables) is 79 | stored 80 | 81 | 82 | 83 | 84 | commitlog_directory 85 | /var/lib/cassandra/commitlog 86 | The directory where the commit log is stored 87 | 88 | 89 | 90 | disk_failure_policy 91 | stop 92 | Sets how Cassandra responds to disk failure=4 93 | 94 | 95 | 96 | commit_failure_policy 97 | stop 98 | Policy for commit disk failures 99 | 100 | 101 | 102 | key_cache_save_period 103 | 14400 104 | Duration in seconds that keys are saved in cache 105 | 106 | 107 | 108 | row_cache_size_in_mb 109 | 0 110 | Maximum size of the row cache in memory. 111 | 112 | 113 | row_cache_save_period 114 | 0 115 | Duration in seconds that rows are saved in cache 116 | 117 | 118 | 119 | saved_caches_directory 120 | /var/lib/cassandra/saved_caches 121 | The directory location where table key and row caches are 122 | stored. 123 | 124 | 125 | 126 | counter_cache_save_period 127 | 7200 128 | 129 | 130 | 131 | counter_cache_size_in_mb 132 | 200 133 | 134 | 135 | 136 | commitlog_sync 137 | periodic 138 | 139 | 140 | 141 | commitlog_sync_period_in_ms 142 | 10000 143 | 144 | 145 | 146 | commitlog_segment_size_in_mb 147 | 32 148 | 149 | 150 | 151 | concurrent_reads 152 | 32 153 | 154 | 155 | 156 | concurrent_writes 157 | 32 158 | 159 | 160 | 161 | concurrent_counter_writes 162 | 32 163 | 164 | 165 | 166 | memtable_allocation_type 167 | heap_buffers 168 | 169 | 170 | 171 | index_summary_resize_interval_in_minutes 172 | 60 173 | 174 | 175 | 176 | trickle_fsync 177 | false 178 | 179 | 180 | 181 | jmxport 182 | 7199 183 | 184 | 185 | 186 | trickle_fsync_interval_in_kb 187 | 10240 188 | 189 | 190 | 191 | storage_port 192 | 7000 193 | 194 | 195 | 196 | ssl_storage_port 197 | 7001 198 | 199 | 200 | 201 | 202 | start_native_transport 203 | true 204 | 205 | 206 | 207 | native_transport_port 208 | 9042 209 | 210 | 211 | 212 | start_rpc 213 | true 214 | 215 | 216 | 217 | rpc_address1 218 | 0.0.0.0 219 | 220 | 221 | 222 | rpc_port 223 | 9160 224 | 225 | 226 | 227 | broadcast_rpc_address 228 | 1.2.3.4 229 | 230 | 231 | 232 | rpc_keepalive 233 | true 234 | 235 | 236 | 237 | rpc_server_type 238 | sync 239 | 240 | 241 | 242 | thrift_framed_transport_size_in_mb 243 | 15 244 | 245 | 246 | 247 | incremental_backups 248 | false 249 | 250 | 251 | 252 | snapshot_before_compaction 253 | false 254 | 255 | 256 | 257 | auto_snapshot 258 | true 259 | 260 | 261 | 262 | tombstone_warn_threshold 263 | 1000 264 | 265 | 266 | 267 | tombstone_failure_threshold 268 | 100000 269 | 270 | 271 | 272 | column_index_size_in_kb 273 | 64 274 | 275 | 276 | 277 | batch_size_warn_threshold_in_kb 278 | 5 279 | 280 | 281 | 282 | compaction_throughput_mb_per_sec 283 | 16 284 | 285 | 286 | 287 | compaction_large_partition_warning_threshold_mb 288 | 100 289 | 290 | 291 | 292 | sstable_preemptive_open_interval_in_mb 293 | 50 294 | 295 | 296 | 297 | sstable_preemptive_open_interval_in_mb 298 | 50 299 | 300 | 301 | 302 | read_request_timeout_in_ms 303 | 5000 304 | 305 | 306 | 307 | range_request_timeout_in_ms 308 | 10000 309 | 310 | 311 | 312 | write_request_timeout_in_ms 313 | 2000 314 | 315 | 316 | 317 | 318 | write_request_timeout_in_ms 319 | 2000 320 | 321 | 322 | 323 | 324 | counter_write_request_timeout_in_ms 325 | 5000 326 | 327 | 328 | 329 | cas_contention_timeout_in_ms 330 | 1000 331 | 332 | 333 | 334 | truncate_request_timeout_in_ms 335 | 60000 336 | 337 | 338 | 339 | request_timeout_in_ms 340 | 10000 341 | 342 | 343 | 344 | 345 | cross_node_timeout 346 | false 347 | 348 | 349 | 350 | 351 | endpoint_snitch 352 | GossipingPropertyFileSnitch 353 | 354 | 355 | 356 | dynamic_snitch_update_interval_in_ms 357 | 100 358 | 359 | 360 | 361 | dynamic_snitch_reset_interval_in_ms 362 | 600000 363 | 364 | 365 | 366 | dynamic_snitch_badness_threshold 367 | 0.1 368 | 369 | 370 | 371 | dynamic_snitch_badness_threshold 372 | 0.1 373 | 374 | 375 | 376 | request_scheduler 377 | org.apache.cassandra.scheduler.NoScheduler 378 | 379 | 380 | 381 | request_scheduler 382 | org.apache.cassandra.scheduler.NoScheduler 383 | 384 | 385 | 386 | server_encryption_options_internode_encryption 387 | none 388 | 389 | 390 | 391 | server_encryption_options_keystore 392 | conf/.keystore 393 | 394 | 395 | 396 | server_encryption_options_keystore_password 397 | cassandra 398 | 399 | 400 | 401 | server_encryption_options_truststore 402 | conf/.truststore 403 | 404 | 405 | 406 | server_encryption_options_truststore_password 407 | cassandra 408 | 409 | 410 | 411 | client_encryption_options_enabled 412 | false 413 | 414 | 415 | 416 | counter_cache_size_in_mb 417 | 0 418 | When no value is specified a minimum 419 | 420 | 421 | client_encryption_options_keystore 422 | conf/.keystore 423 | 424 | 425 | 426 | client_encryption_options_keystore_password 427 | cassandra 428 | 429 | 430 | 431 | internode_compression 432 | all 433 | 434 | 435 | 436 | inter_dc_tcp_nodelay 437 | false 438 | 439 | 440 | 441 | key_cache_size_in_mb 442 | 0 443 | 444 | 445 | 446 | row_cache_size_in_mb 447 | 0 448 | 449 | 450 | 451 | 452 | seed_provider_parameters_seeds 453 | 454 | Provide values in quotes 455 | 456 | 457 | seed_provider_class_name 458 | org.apache.cassandra.locator.SimpleSeedProvider 459 | 460 | 461 | 462 | index_summary_capacity_in_mb 463 | 0 464 | 465 | 466 | 467 | client_encryption_options_enabled 468 | false 469 | 470 | 471 | 472 | client_encryption_options_keystore 473 | conf/.keystore 474 | 475 | 476 | 477 | client_encryption_options_keystore_password 478 | cassandra 479 | 480 | 481 | 482 | -------------------------------------------------------------------------------- /metainfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 5 | 6 | Cassandra 7 | Cassandra 8 | Distributed database 9 | 2.1 10 | 11 | 12 | Cluster-Hosts 13 | Cluster Nodes 14 | SLAVE 15 | 1+ 16 | 17 | 18 | PYTHON 19 | 600 20 | 21 | 22 | 23 | Cluster_client 24 | Cluster Client 25 | CLIENT 26 | 0+ 27 | 28 | 29 | PYTHON 30 | 600 31 | 32 | 33 | 34 | 35 | 36 | any 37 | 38 | 39 | dsc21 40 | 41 | 42 | opscenter 43 | 44 | 45 | 46 | 47 | 48 | 49 | PYTHON 50 | 300 51 | 52 | 53 | cassandra-env 54 | 55 | true 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /package/.hash: -------------------------------------------------------------------------------- 1 | 3801aa53a15f3170f0740fd4aac4aa7d74599654 -------------------------------------------------------------------------------- /package/scripts/cassandra.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Licensed to the Apache Software Foundation (ASF) under one 4 | or more contributor license agreements. See the NOTICE file 5 | distributed with this work for additional information 6 | regarding copyright ownership. The ASF licenses this file 7 | to you under the Apache License, Version 2.0 (the 8 | "License"); you may not use this file except in compliance 9 | with the License. You may obtain a copy of the License at 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | """ 17 | 18 | from resource_management import * 19 | from properties_config import properties_config 20 | import sys 21 | from copy import deepcopy 22 | 23 | def cassandra(): 24 | import params 25 | 26 | Directory([params.log_dir, params.pid_dir, params.conf_dir], 27 | owner=params.cassandra_user, 28 | group=params.user_group, 29 | recursive=True 30 | ) 31 | configurations = params.config['configurations']['cassandra-site'] 32 | 33 | File(format("{conf_dir}/cassandra.yaml"), 34 | content=Template( 35 | "cassandra.master.yaml.j2", 36 | configurations = configurations), 37 | owner=params.cassandra_user, 38 | group=params.user_group 39 | ) 40 | -------------------------------------------------------------------------------- /package/scripts/cassandra_master.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Licensed to the Apache Software Foundation (ASF) under one 4 | or more contributor license agreements. The ASF licenses this file 5 | to you under the Apache License, Version 2.0 (the 6 | "License"); you may not use this file except in compliance 7 | with the License. You may obtain a copy of the License at 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | """ 15 | 16 | from resource_management import * 17 | import signal 18 | import sys 19 | import os 20 | from os.path import isfile 21 | 22 | from cassandra import cassandra 23 | 24 | 25 | class Cassandra_Master(Script): 26 | def install(self, env): 27 | import params 28 | env.set_params(params) 29 | print 'Install' 30 | self.install_packages(env) 31 | def configure(self, env): 32 | import params 33 | env.set_params(params) 34 | print 'Install plugins'; 35 | cassandra() 36 | def stop(self, env): 37 | import params 38 | env.set_params(params) 39 | stop_cmd = format("service cassandra stop") 40 | start_opscenter = format("service opscenterd stop") 41 | Execute(stop_cmd) 42 | print 'Stop the Master' 43 | def start(self, env): 44 | import params 45 | env.set_params(params) 46 | self.configure(env) 47 | start_cmd = format("service cassandra start") 48 | start_opscenter = format("service opscenterd start") 49 | Execute(start_cmd) 50 | Execute(start_opscenter) 51 | print 'Start the Master' 52 | def status(self, env): 53 | import params 54 | env.set_params(params) 55 | status_cmd = format("service cassandra status") 56 | Execute(status_cmd) 57 | print 'Status of the Master' 58 | 59 | if __name__ == "__main__": 60 | Cassandra_Master().execute() 61 | -------------------------------------------------------------------------------- /package/scripts/clients.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Licensed to the Apache Software Foundation (ASF) under one 4 | or more contributor license agreements. The ASF licenses this file 5 | to you under the Apache License, Version 2.0 (the 6 | "License"); you may not use this file except in compliance 7 | with the License. You may obtain a copy of the License at 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | """ 15 | 16 | from resource_management import * 17 | import signal 18 | import sys 19 | import os 20 | from os.path import isfile 21 | 22 | class clients(Script): 23 | def configure(self,env): 24 | import params 25 | env.set_params(params) 26 | cassandra() 27 | 28 | def status(self, env): 29 | raise ClientComponentHasNoStatus() 30 | 31 | def install(self,env): 32 | import params 33 | env.set_params(params) 34 | print 'Install the client' 35 | self.install_packages(env) 36 | 37 | if __name__ == "__main__": 38 | clients().execute() 39 | -------------------------------------------------------------------------------- /package/scripts/params.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Licensed to the Apache Software Foundation (ASF) under one 4 | or more contributor license agreements. The ASF licenses this file 5 | to you under the Apache License, Version 2.0 (the 6 | "License"); you may not use this file except in compliance 7 | with the License. You may obtain a copy of the License at 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | """ 15 | 16 | from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions 17 | from resource_management import * 18 | import commands 19 | 20 | # server configurations 21 | config = Script.get_config() 22 | 23 | cassandra_home = '/etc/cassandra/' 24 | cassandra_bin = '/usr/sbin/cassandra' 25 | cassandra_pid_dir = config['configurations']['cassandra-env']['cassandra_pid_dir'] 26 | cassandra_pid_file = format("{cassandra_pid_dir}/cassandra.pid") 27 | 28 | conf_dir = "/etc/cassandra/conf" 29 | cassandra_user = config['configurations']['cassandra-env']['cassandra_user'] 30 | log_dir = config['configurations']['cassandra-env']['cassandra_log_dir'] 31 | pid_dir = '/var/run/cassandra' 32 | pid_file = '/var/run/cassandra/cassandra.pid' 33 | 34 | hostname = config['hostname'] 35 | user_group = config['configurations']['cluster-env']['user_group'] 36 | java64_home = config['hostLevelParams']['java_home'] 37 | 38 | template = config['configurations']['cassandra-site']['template'] 39 | defaultName = config['configurations']['cassandra-site']['defaultName'] 40 | 41 | cluster_name_py = config['configurations']['cassandra-site']['cluster_name'] 42 | seed_provider_parameters_seeds = config['configurations']['cassandra-site']['seed_provider_parameters_seeds'] 43 | hinted_handoff_throttle_in_kb=config['configurations']['cassandra-site']['hinted_handoff_throttle_in_kb'] 44 | max_hints_delivery_threads=config['configurations']['cassandra-site']['max_hints_delivery_threads'] 45 | num_tokens=config['configurations']['cassandra-site']['num_tokens'] 46 | hinted_handoff_enabled=config['configurations']['cassandra-site']['hinted_handoff_enabled'] 47 | batchlog_replay_throttle_in_kb=config['configurations']['cassandra-site']['batchlog_replay_throttle_in_kb'] 48 | authenticator=config['configurations']['cassandra-site']['authenticator'] 49 | authorizer=config['configurations']['cassandra-site']['authorizer'] 50 | permissions_validity_in_ms=config['configurations']['cassandra-site']['permissions_validity_in_ms'] 51 | partitioner=config['configurations']['cassandra-site']['partitioner'] 52 | data_file_directories=config['configurations']['cassandra-site']['data_file_directories'] 53 | commitlog_directory=config['configurations']['cassandra-site']['commitlog_directory'] 54 | disk_failure_policy=config['configurations']['cassandra-site']['disk_failure_policy'] 55 | commit_failure_policy=config['configurations']['cassandra-site']['commit_failure_policy'] 56 | key_cache_save_period=config['configurations']['cassandra-site']['key_cache_save_period'] 57 | row_cache_size_in_mb=config['configurations']['cassandra-site']['row_cache_size_in_mb'] 58 | row_cache_save_period=config['configurations']['cassandra-site']['row_cache_save_period'] 59 | saved_caches_directory=config['configurations']['cassandra-site']['saved_caches_directory'] 60 | counter_cache_save_period=config['configurations']['cassandra-site']['counter_cache_save_period'] 61 | commitlog_sync=config['configurations']['cassandra-site']['commitlog_sync'] 62 | commitlog_sync_period_in_ms=config['configurations']['cassandra-site']['commitlog_sync_period_in_ms'] 63 | commitlog_segment_size_in_mb=config['configurations']['cassandra-site']['commitlog_segment_size_in_mb'] 64 | concurrent_reads=config['configurations']['cassandra-site']['concurrent_reads'] 65 | concurrent_writes=config['configurations']['cassandra-site']['concurrent_writes'] 66 | concurrent_counter_writes=config['configurations']['cassandra-site']['concurrent_counter_writes'] 67 | 68 | memtable_allocation_type=config['configurations']['cassandra-site']['memtable_allocation_type'] 69 | 70 | index_summary_resize_interval_in_minutes=config['configurations']['cassandra-site']['index_summary_resize_interval_in_minutes'] 71 | trickle_fsync=config['configurations']['cassandra-site']['trickle_fsync'] 72 | trickle_fsync_interval_in_kb=config['configurations']['cassandra-site']['trickle_fsync_interval_in_kb'] 73 | storage_port=config['configurations']['cassandra-site']['storage_port'] 74 | ssl_storage_port=config['configurations']['cassandra-site']['ssl_storage_port'] 75 | 76 | # a,listen_address1=commands.getstatusoutput('hostname -i') 77 | # listen_address=listen_address1.split()[0] 78 | a,listen_address=commands.getstatusoutput("hostname -i | awk '{print $NF}'") 79 | start_native_transport=config['configurations']['cassandra-site']['start_native_transport'] 80 | native_transport_port=config['configurations']['cassandra-site']['native_transport_port'] 81 | start_rpc=config['configurations']['cassandra-site']['start_rpc'] 82 | 83 | rpc_address=config['configurations']['cassandra-site']['rpc_address1'] 84 | rpc_port=config['configurations']['cassandra-site']['rpc_port'] 85 | broadcast_rpc_address=config['configurations']['cassandra-site']['broadcast_rpc_address'] 86 | rpc_keepalive=config['configurations']['cassandra-site']['rpc_keepalive'] 87 | rpc_server_type=config['configurations']['cassandra-site']['rpc_server_type'] 88 | thrift_framed_transport_size_in_mb=config['configurations']['cassandra-site']['thrift_framed_transport_size_in_mb'] 89 | 90 | 91 | incremental_backups = config['configurations']['cassandra-site']['incremental_backups'] 92 | snapshot_before_compaction = config['configurations']['cassandra-site']['snapshot_before_compaction'] 93 | auto_snapshot = config['configurations']['cassandra-site']['auto_snapshot'] 94 | tombstone_warn_threshold = config['configurations']['cassandra-site']['tombstone_warn_threshold'] 95 | tombstone_failure_threshold = config['configurations']['cassandra-site']['tombstone_failure_threshold'] 96 | column_index_size_in_kb = config['configurations']['cassandra-site']['column_index_size_in_kb'] 97 | batch_size_warn_threshold_in_kb = config['configurations']['cassandra-site']['batch_size_warn_threshold_in_kb'] 98 | compaction_throughput_mb_per_sec = config['configurations']['cassandra-site']['compaction_throughput_mb_per_sec'] 99 | compaction_large_partition_warning_threshold_mb = config['configurations']['cassandra-site']['compaction_large_partition_warning_threshold_mb'] 100 | sstable_preemptive_open_interval_in_mb = config['configurations']['cassandra-site']['sstable_preemptive_open_interval_in_mb'] 101 | read_request_timeout_in_ms = config['configurations']['cassandra-site']['read_request_timeout_in_ms'] 102 | range_request_timeout_in_ms = config['configurations']['cassandra-site']['range_request_timeout_in_ms'] 103 | write_request_timeout_in_ms = config['configurations']['cassandra-site']['write_request_timeout_in_ms'] 104 | counter_write_request_timeout_in_ms = config['configurations']['cassandra-site']['counter_write_request_timeout_in_ms'] 105 | cas_contention_timeout_in_ms = config['configurations']['cassandra-site']['cas_contention_timeout_in_ms'] 106 | truncate_request_timeout_in_ms = config['configurations']['cassandra-site']['truncate_request_timeout_in_ms'] 107 | request_timeout_in_ms = config['configurations']['cassandra-site']['request_timeout_in_ms'] 108 | cross_node_timeout = config['configurations']['cassandra-site']['cross_node_timeout'] 109 | endpoint_snitch = config['configurations']['cassandra-site']['endpoint_snitch'] 110 | dynamic_snitch_update_interval_in_ms = config['configurations']['cassandra-site']['dynamic_snitch_update_interval_in_ms'] 111 | dynamic_snitch_reset_interval_in_ms = config['configurations']['cassandra-site']['dynamic_snitch_reset_interval_in_ms'] 112 | dynamic_snitch_badness_threshold = config['configurations']['cassandra-site']['dynamic_snitch_badness_threshold'] 113 | request_scheduler = config['configurations']['cassandra-site']['request_scheduler'] 114 | 115 | server_encryption_options_internode_encryption = config['configurations']['cassandra-site']['server_encryption_options_internode_encryption'] 116 | server_encryption_options_keystore = config['configurations']['cassandra-site']['server_encryption_options_keystore'] 117 | server_encryption_options_keystore_password = config['configurations']['cassandra-site']['server_encryption_options_keystore_password'] 118 | server_encryption_options_truststore = config['configurations']['cassandra-site']['server_encryption_options_truststore'] 119 | server_encryption_options_truststore_password = config['configurations']['cassandra-site']['server_encryption_options_truststore_password'] 120 | 121 | client_encryption_options_enabled=config['configurations']['cassandra-site']['client_encryption_options_enabled'] 122 | client_encryption_options_keystore_password = config['configurations']['cassandra-site']['client_encryption_options_keystore_password'] 123 | client_encryption_options_keystore = config['configurations']['cassandra-site']['client_encryption_options_keystore'] 124 | 125 | internode_compression = config['configurations']['cassandra-site']['internode_compression'] 126 | inter_dc_tcp_nodelay = config['configurations']['cassandra-site']['inter_dc_tcp_nodelay'] 127 | key_cache_size_in_mb = config['configurations']['cassandra-site']['key_cache_size_in_mb'] 128 | counter_cache_size_in_mb = config['configurations']['cassandra-site']['counter_cache_size_in_mb'] 129 | seed_provider_class_name = config['configurations']['cassandra-site']['seed_provider_class_name'] 130 | seed_provider_parameters_seeds = config['configurations']['cassandra-site']['seed_provider_parameters_seeds'] 131 | index_summary_capacity_in_mb = config['configurations']['cassandra-site']['index_summary_capacity_in_mb'] 132 | -------------------------------------------------------------------------------- /package/scripts/properties_config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Licensed to the Apache Software Foundation (ASF) under one 4 | or more contributor license agreements. The ASF licenses this file 5 | to you under the Apache License, Version 2.0 (the 6 | "License"); you may not use this file except in compliance 7 | with the License. You may obtain a copy of the License at 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | """ 15 | 16 | import re 17 | from resource_management import * 18 | 19 | def properties_inline_template(configurations): 20 | return source.InlineTemplate('''{% for key, value in configurations_dict.items() %}{{ key }}={{ value }} 21 | {% endfor %}''', configurations_dict=configurations) 22 | 23 | def properties_config(filename, configurations = None, conf_dir = None, 24 | mode = None, owner = None, group = None, brokerid = None): 25 | config_content = properties_inline_template(configurations) 26 | File (format("{conf_dir}/{filename}"), content = config_content, owner = owner, 27 | group = group, mode = mode) 28 | -------------------------------------------------------------------------------- /package/scripts/service_check.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Licensed to the Apache Software Foundation (ASF) under one 4 | or more contributor license agreements. The ASF licenses this file 5 | to you under the Apache License, Version 2.0 (the 6 | "License"); you may not use this file except in compliance 7 | with the License. You may obtain a copy of the License at 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | """ 15 | 16 | from __future__ import print_function 17 | from resource_management import * 18 | import sys,subprocess,os 19 | import requests 20 | import time 21 | 22 | class ServiceCheck(Script): 23 | def service_check(self, env): 24 | import params 25 | env.set_params(params) 26 | seeds = params.seed_provider_parameters_seeds[1:-1].split(",") 27 | host=seeds[0] 28 | cmdfile=format("/tmp/cmds") 29 | File(cmdfile, 30 | mode=0600, 31 | content=InlineTemplate("CREATE KEYSPACE IF NOT EXISTS smokedemotest WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };\n" 32 | "Use smokedemotest;\n" 33 | "CREATE TABLE IF NOT EXISTS smokeusers (firstname text,lastname text,age int,email text,city text,PRIMARY KEY (lastname));\n" 34 | "INSERT INTO smokeusers (firstname, lastname, age, email, city) VALUES ('John', 'Smith', 46, 'johnsmith@email.com', 'Sacramento');\n" 35 | "DROP TABLE smokedemotest.smokeusers;\n" 36 | "DROP KEYSPACE smokedemotest;\n\n") 37 | ) 38 | Execute(format("cqlsh {host} {native_transport_port} -f {cmdfile}")) 39 | 40 | 41 | if __name__ == "__main__": 42 | ServiceCheck().execute() 43 | -------------------------------------------------------------------------------- /package/templates/cassandra.master.yaml.j2: -------------------------------------------------------------------------------- 1 | cluster_name: {{cluster_name_py}} 2 | num_tokens: {{num_tokens}} 3 | hinted_handoff_enabled: {{hinted_handoff_enabled}} 4 | hinted_handoff_throttle_in_kb: {{hinted_handoff_throttle_in_kb}} 5 | max_hints_delivery_threads: {{max_hints_delivery_threads}} 6 | batchlog_replay_throttle_in_kb: {{batchlog_replay_throttle_in_kb}} 7 | authenticator: {{authenticator}} 8 | authorizer: {{authorizer}} 9 | permissions_validity_in_ms: {{permissions_validity_in_ms}} 10 | partitioner: {{partitioner}} 11 | data_file_directories: 12 | - {{data_file_directories}} 13 | commitlog_directory: {{commitlog_directory}} 14 | disk_failure_policy: {{disk_failure_policy}} 15 | commit_failure_policy: {{commit_failure_policy}} 16 | key_cache_size_in_mb: {{key_cache_size_in_mb}} 17 | key_cache_save_period: {{key_cache_save_period}} 18 | row_cache_size_in_mb: {{row_cache_size_in_mb}} 19 | row_cache_save_period: {{row_cache_save_period}} 20 | counter_cache_size_in_mb: {{counter_cache_size_in_mb}} 21 | counter_cache_save_period: {{counter_cache_save_period}} 22 | saved_caches_directory: {{saved_caches_directory}} 23 | commitlog_sync: {{commitlog_sync}} 24 | commitlog_sync_period_in_ms: {{commitlog_sync_period_in_ms}} 25 | commitlog_segment_size_in_mb: {{commitlog_segment_size_in_mb}} 26 | seed_provider: 27 | - class_name: {{seed_provider_class_name}} 28 | parameters: 29 | - seeds: {{seed_provider_parameters_seeds}} 30 | concurrent_reads: {{concurrent_reads}} 31 | concurrent_writes: {{concurrent_writes}} 32 | concurrent_counter_writes: {{concurrent_counter_writes}} 33 | memtable_allocation_type: {{memtable_allocation_type}} 34 | index_summary_capacity_in_mb: {{index_summary_capacity_in_mb}} 35 | index_summary_resize_interval_in_minutes: {{index_summary_resize_interval_in_minutes}} 36 | trickle_fsync: {{trickle_fsync}} 37 | trickle_fsync_interval_in_kb: {{trickle_fsync_interval_in_kb}} 38 | storage_port: {{storage_port}} 39 | ssl_storage_port: {{ssl_storage_port}} 40 | listen_address: {{listen_address}} 41 | start_native_transport: {{start_native_transport}} 42 | native_transport_port: {{native_transport_port}} 43 | start_rpc: {{start_rpc}} 44 | rpc_address: {{rpc_address}} 45 | rpc_port: {{rpc_port}} 46 | broadcast_rpc_address: {{broadcast_rpc_address}} 47 | rpc_keepalive: {{rpc_keepalive}} 48 | rpc_server_type: {{rpc_server_type}} 49 | thrift_framed_transport_size_in_mb: {{thrift_framed_transport_size_in_mb}} 50 | incremental_backups: {{incremental_backups}} 51 | snapshot_before_compaction: {{snapshot_before_compaction}} 52 | auto_snapshot: {{auto_snapshot}} 53 | tombstone_warn_threshold: {{tombstone_warn_threshold}} 54 | tombstone_failure_threshold: {{tombstone_failure_threshold}} 55 | column_index_size_in_kb: {{column_index_size_in_kb}} 56 | batch_size_warn_threshold_in_kb: {{batch_size_warn_threshold_in_kb}} 57 | compaction_throughput_mb_per_sec: {{compaction_throughput_mb_per_sec}} 58 | compaction_large_partition_warning_threshold_mb: {{compaction_large_partition_warning_threshold_mb}} 59 | sstable_preemptive_open_interval_in_mb: {{sstable_preemptive_open_interval_in_mb}} 60 | read_request_timeout_in_ms: {{read_request_timeout_in_ms}} 61 | range_request_timeout_in_ms: {{range_request_timeout_in_ms}} 62 | write_request_timeout_in_ms: {{write_request_timeout_in_ms}} 63 | counter_write_request_timeout_in_ms: {{counter_write_request_timeout_in_ms}} 64 | cas_contention_timeout_in_ms: {{cas_contention_timeout_in_ms}} 65 | truncate_request_timeout_in_ms: {{truncate_request_timeout_in_ms}} 66 | request_timeout_in_ms: {{request_timeout_in_ms}} 67 | cross_node_timeout: {{cross_node_timeout}} 68 | endpoint_snitch: {{endpoint_snitch}} 69 | dynamic_snitch_update_interval_in_ms: {{dynamic_snitch_update_interval_in_ms}} 70 | dynamic_snitch_reset_interval_in_ms: {{dynamic_snitch_reset_interval_in_ms}} 71 | dynamic_snitch_badness_threshold: {{dynamic_snitch_badness_threshold}} 72 | request_scheduler: {{request_scheduler}} 73 | server_encryption_options: 74 | internode_encryption: {{server_encryption_options_internode_encryption}} 75 | keystore: {{server_encryption_options_keystore}} 76 | keystore_password: {{server_encryption_options_keystore_password}} 77 | truststore: {{server_encryption_options_truststore}} 78 | truststore_password: {{server_encryption_options_truststore_password}} 79 | client_encryption_options: 80 | enabled: {{client_encryption_options_enabled}} 81 | keystore: {{client_encryption_options_keystore}} 82 | keystore_password: {{client_encryption_options_keystore_password}} 83 | 84 | internode_compression: {{internode_compression}} 85 | inter_dc_tcp_nodelay: {{inter_dc_tcp_nodelay}} 86 | -------------------------------------------------------------------------------- /screenshots/Initial-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Symantec/ambari-cassandra-service/cc872462bf80570a32983f4c75cd1c24215c9e62/screenshots/Initial-config.png -------------------------------------------------------------------------------- /screenshots/Installed-service-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Symantec/ambari-cassandra-service/cc872462bf80570a32983f4c75cd1c24215c9e62/screenshots/Installed-service-config.png -------------------------------------------------------------------------------- /screenshots/Installed-service-stop.png .png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Symantec/ambari-cassandra-service/cc872462bf80570a32983f4c75cd1c24215c9e62/screenshots/Installed-service-stop.png .png --------------------------------------------------------------------------------