diff options
author | Tal Gitelman <tal.gitelman@att.com> | 2019-03-28 11:00:54 +0200 |
---|---|---|
committer | Tal Gitelman <tal.gitelman@att.com> | 2019-04-04 16:33:03 +0300 |
commit | c4d387d216e72911f80c1ebee91b73aba191b91b (patch) | |
tree | c12066b7a213d34ca7c84375fb4bb2d6f0b23138 /sdc-os-chef/sdc-cassandra | |
parent | ac3aca69dbeae29c9aeca2053adc7aedbb75e149 (diff) |
Make Cassandra port configurable.
SDC-BE & Onboarding - BE.
Reviewer: Evgenia A & Areli F.
Change-Id: Iaf86d647b0560764ef65d9148c85bffaf934992d
Issue-ID: SDC-2077
Signed-off-by: Tal Gitelman <tal.gitelman@att.com>
Diffstat (limited to 'sdc-os-chef/sdc-cassandra')
6 files changed, 26 insertions, 19 deletions
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb index 32e89c9b21..47ab456dec 100644 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb @@ -21,18 +21,19 @@ template "cassandra-yaml-config" do group "cassandra" mode "0755" variables ({ - :cassandra_cluster => cluster_name, - :cassandra_data_dir => node['cassandra'][:data_dir], - :cassandra_commitlog_dir => node['cassandra'][:commitlog_dir], - :cassandra_cache_dir => node['cassandra'][:cache_dir], - :seeds_address => cas_ips, - :listen_address => application_host, - :broadcast_address => application_host, - :broadcast_rpc_address => application_host, - :rpc_address => "0.0.0.0", - :num_tokens => node['cassandra'][:num_tokens], - :internode_encryption => "none", - :cassandra_truststore_dir => "/etc/cassandra/cs_trust" + :cassandra_port => node['cassandra']['cassandra_port'], + :cassandra_cluster => cluster_name, + :cassandra_data_dir => node['cassandra'][:data_dir], + :cassandra_commitlog_dir => node['cassandra'][:commitlog_dir], + :cassandra_cache_dir => node['cassandra'][:cache_dir], + :seeds_address => cas_ips, + :listen_address => application_host, + :broadcast_address => application_host, + :broadcast_rpc_address => application_host, + :rpc_address => "0.0.0.0", + :num_tokens => node['cassandra'][:num_tokens], + :internode_encryption => "none", + :cassandra_truststore_dir => "/etc/cassandra/cs_trust" }) end diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-changeCSpass.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-changeCSpass.rb index 7afb307401..ae582cfe25 100644 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-changeCSpass.rb +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-changeCSpass.rb @@ -12,7 +12,8 @@ template "/tmp/change_cassandra_pass.sh" do mode 0755 variables({ :cassandra_ip => application_host, - :cassandra_pwd => ENV['CS_PASSWORD'] + :cassandra_pwd => ENV['CS_PASSWORD'], + :cassandra_port => node['cassandra']['cassandra_port'] }) end diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-prepareProbeFile.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-prepareProbeFile.rb index c196ca7b94..0165d36ef1 100644 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-prepareProbeFile.rb +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-prepareProbeFile.rb @@ -12,6 +12,7 @@ template "/var/lib/ready-probe.sh" do mode 0755 variables({ :cassandra_ip => application_host, - :cassandra_pwd => ENV['CS_PASSWORD'] + :cassandra_pwd => ENV['CS_PASSWORD'], + :cassandra_port => node['cassandra']['cassandra_port'] }) end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/cassandra.yaml.erb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/cassandra.yaml.erb index d4b6032d00..8e3d1229ba 100644 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/cassandra.yaml.erb +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/cassandra.yaml.erb @@ -403,7 +403,9 @@ broadcast_address: <%= @broadcast_address %> start_native_transport: true # port for the CQL native transport to listen for clients on # For security reasons, you should not expose this port to the internet. Firewall it if needed. -native_transport_port: 9042 +#Default value 9042 +#native_transport_port: 9042 +native_transport_port: <%= @cassandra_port %> # The maximum threads for handling requests when the native transport is used. # This is similar to rpc_max_threads though the default differs slightly (and # there is no native_transport_min_threads, idle threads will always be stopped diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/change_cassandra_pass.sh.erb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/change_cassandra_pass.sh.erb index d1fdcf3c2c..a9d71808b8 100644 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/change_cassandra_pass.sh.erb +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/change_cassandra_pass.sh.erb @@ -2,14 +2,15 @@ CASSANDRA_PASS=<%= @cassandra_pwd %> CASSANDRA_IP=<%= @cassandra_ip %> +CASSANDRA_PORT=<%= @cassandra_port %> pass_changed=99 retry_num=1 is_up=0 while [ $is_up -eq 0 -a $retry_num -le 100 ]; do - echo "exit" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP > /dev/null 2>&1 + echo "exit" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP $CASSANDRA_PORT > /dev/null 2>&1 res1=$? - echo "exit" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP > /dev/null 2>&1 + echo "exit" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP $CASSANDRA_PORT > /dev/null 2>&1 res2=$? if [ $res1 -eq 0 -o $res2 -eq 0 ]; then @@ -24,7 +25,7 @@ done if [ $res1 -eq 0 -a $res2 -eq 1 -a $is_up -eq 1 ]; then echo "Modify cassandra password" - echo "ALTER USER cassandra WITH PASSWORD '$CASSANDRA_PASS';" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP + echo "ALTER USER cassandra WITH PASSWORD '$CASSANDRA_PASS';" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP $CASSANDRA_PORT elif [ $res1 -eq 1 -a $res2 -eq 0 -a $is_up -eq 1 ]; then echo "cassandra password already modified" else exit 1 diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb index 2f97d0768e..b8d3cfe136 100644 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb @@ -2,9 +2,10 @@ CASSANDRA_PASS=<%= @cassandra_pwd %> CASSANDRA_IP=<%= @cassandra_ip %> +CASSANDRA_PORT=<%= @cassandra_port %> if [[ $(nodetool status |tail -n2 | grep -Ev "^$"a) == *"UN"* ]]; then - echo "exit" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP > /dev/null 2>&1 + echo "exit" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP $CASSANDRA_PORT > /dev/null 2>&1 rc=$? if [[ $rc != 0 ]]; then exit $rc; fi fi |