From b08309847c24bd3c060839a335a20cb3f750ed30 Mon Sep 17 00:00:00 2001 From: "Sonsino, Ofir (os0695)" Date: Sun, 14 Apr 2019 12:41:54 +0300 Subject: [PATCH] Revert "Upgrade SDC to use common cassandra cluster" This reverts commit 00a6a4d66b0d22d530314816b4b5697fbc975e37. Change-Id: I308844556aea66e91064d9067e3ba54179a0bb46 Issue-ID: SDC-2199 Signed-off-by: Sonsino, Ofir (os0695) --- .../recipes/02-createDoxKeyspace.rb | 2 +- .../cassandra-actions/recipes/03-schemaCreation.rb | 9 ++++----- .../templates/default/titan.properties.erb | 2 +- .../recipes/BE_2_setup_configuration.rb | 23 +++++++++++++++------- .../recipes/ON_5_setup_configuration.rb | 2 +- sdc-os-chef/environments/Template.json | 3 +-- .../sanityApiTests_2_setup_configuration.rb | 5 +++-- .../recipes/sanityUiTests_2_setup_configuration.rb | 5 +++-- 8 files changed, 30 insertions(+), 21 deletions(-) diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb index a516c7108b..c9a4087671 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb @@ -5,7 +5,7 @@ template "/tmp/create_dox_keyspace.sh" do variables({ :cassandra_ip => node['Nodes']['CS'].first, :cassandra_port => node['cassandra']['cassandra_port'], - :DC_NAME => node['cassandra']['datacenter_name'], + :DC_NAME => node['cassandra']['datacenter_name']+node.chef_environment, :cassandra_pwd => node['cassandra'][:cassandra_password], :cassandra_usr => node['cassandra'][:cassandra_user] }) diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb index fbfcb2ecea..b48eecd9b0 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb @@ -18,12 +18,11 @@ template "titan.properties" do source "titan.properties.erb" mode "0755" variables({ - :DC_NAME => node['cassandra']['datacenter_name'], + :DC_NAME => node['cassandra']['datacenter_name']+node.chef_environment, :cassandra_ip => node['Nodes']['CS'].first, :cassandra_pwd => node['cassandra'][:cassandra_password], :cassandra_usr => node['cassandra'][:cassandra_user], - :titan_connection_timeout => node['cassandra']['titan_connection_timeout'], - :replication_factor => node['cassandra']['replication_factor'] + :titan_connection_timeout => node['cassandra']['titan_connection_timeout'] }) end @@ -38,8 +37,8 @@ template "/tmp/sdctool/config/configuration.yaml" do :ssl_port => node['BE'][:https_port], :cassandra_ip => node['Nodes']['CS'].first, :cassandra_port => node['cassandra']['cassandra_port'], - :rep_factor => node['cassandra']['replication_factor'], - :DC_NAME => node['cassandra']['datacenter_name'], + :rep_factor => 1, + :DC_NAME => node['cassandra']['datacenter_name']+node.chef_environment, :titan_Path => "/tmp/sdctool/config/", :socket_connect_timeout => node['cassandra']['socket_connect_timeout'], :socket_read_timeout => node['cassandra']['socket_read_timeout'], diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb index 20a97be9de..0f31341d40 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/titan.properties.erb @@ -14,7 +14,7 @@ storage.cassandra.ssl.truststore.password=Aa123456 storage.cassandra.read-consistency-level=LOCAL_QUORUM storage.cassandra.write-consistency-level=LOCAL_QUORUM storage.cassandra.replication-strategy-class=org.apache.cassandra.locator.NetworkTopologyStrategy -storage.cassandra.replication-strategy-options=<%= @DC_NAME %>,<%= @replication_factor %> +storage.cassandra.replication-strategy-options=<%= @DC_NAME %>,1 storage.cassandra.astyanax.local-datacenter=<%= @DC_NAME %> cache.db-cache = false diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb index 5d83cdbd43..335271f4d5 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb @@ -1,12 +1,21 @@ # Set the cassandra replica number -replication_factor=node['cassandra']['replication_factor'] +cassandra_nodes = node['Nodes']['CS'] +if cassandra_nodes.length <=2 + replication_factor=1 +elsif cassandra_nodes.length >2 && cassandra_nodes.length <=4 + replication_factor=3 +else + replication_factor=4 +end + + if node['Pair_EnvName'] == "" - titan_dcname_with_rep = node['cassandra']['datacenter_name'] + "," + replication_factor.to_s - conf_dcname_with_rep = node['cassandra']['datacenter_name'] + "','" + replication_factor.to_s + titan_dcname_with_rep = node['cassandra']['datacenter_name'] + node.chef_environment + "," + replication_factor.to_s + conf_dcname_with_rep = node['cassandra']['datacenter_name'] + node.chef_environment + "','" + replication_factor.to_s else - titan_dcname_with_rep = node['cassandra']['datacenter_name'] + "," + replication_factor.to_s + "," + node['cassandra']['cluster_name'] + node['Pair_EnvName'] + "," + replication_factor.to_s - conf_dcname_with_rep = node['cassandra']['datacenter_name'] + "','" + replication_factor.to_s + "','" + node['cassandra']['cluster_name'] + node['Pair_EnvName'] + "','" + replication_factor.to_s + titan_dcname_with_rep = node['cassandra']['datacenter_name'] + node.chef_environment + "," + replication_factor.to_s + "," + node['cassandra']['cluster_name'] + node['Pair_EnvName'] + "," + replication_factor.to_s + conf_dcname_with_rep = node['cassandra']['datacenter_name'] + node.chef_environment + "','" + replication_factor.to_s + "','" + node['cassandra']['cluster_name'] + node['Pair_EnvName'] + "','" + replication_factor.to_s end @@ -22,7 +31,7 @@ template "titan.properties" do :cassandra_pwd => node['cassandra'][:cassandra_password], :cassandra_usr => node['cassandra'][:cassandra_user], :rep_factor => replication_factor, - :DC_NAME => node['cassandra']['datacenter_name'], + :DC_NAME => node['cassandra']['datacenter_name']+node.chef_environment, :DC_NAME_WITH_REP => titan_dcname_with_rep, :titan_connection_timeout => node['cassandra']['titan_connection_timeout'], :cassandra_truststore_password => node['cassandra'][:truststore_password], @@ -44,7 +53,7 @@ template "catalog-be-config" do :cassandra_ip => node['Nodes']['CS'].join(",").gsub(/[|]/,''), :cassandra_port => node['cassandra']['cassandra_port'], :rep_factor => replication_factor, - :DC_NAME => node['cassandra']['datacenter_name'], + :DC_NAME => node['cassandra']['datacenter_name']+node.chef_environment, :REP_STRING => conf_dcname_with_rep, :titan_Path => "/var/lib/jetty/config/catalog-be/", :socket_connect_timeout => node['cassandra']['socket_connect_timeout'], diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb index 80fc57efcb..5f7e5e62ef 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb @@ -10,7 +10,7 @@ template "onboard-be-config" do :ssl_port => node['ONBOARDING_BE'][:https_port], :cassandra_ip => node['Nodes']['CS'].join(",").gsub(/[|]/,''), :cassandra_port => node['cassandra']['cassandra_port'], - :DC_NAME => node['cassandra']['datacenter_name'], + :DC_NAME => node['cassandra']['datacenter_name']+node.chef_environment, :socket_connect_timeout => node['cassandra']['socket_connect_timeout'], :socket_read_timeout => node['cassandra']['socket_read_timeout'], :cassandra_pwd => node['cassandra'][:cassandra_password], diff --git a/sdc-os-chef/environments/Template.json b/sdc-os-chef/environments/Template.json index c5f64f0bb3..3fee2a2e1d 100644 --- a/sdc-os-chef/environments/Template.json +++ b/sdc-os-chef/environments/Template.json @@ -88,8 +88,7 @@ "commitlog_dir": "/var/lib/cassandra/commitlog", "socket_read_timeout": "20000", "socket_connect_timeout": "20000", - "titan_connection_timeout": "10000", - "replication_factor": "1" + "titan_connection_timeout": "10000" } } } diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb index a50c4dbc4f..7321155232 100644 --- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb @@ -26,6 +26,7 @@ template "sdc-yaml-config" do }) end +replication_factor=1 template "titan.properties" do path "/#{tests_base}/conf/titan.properties" source "BE-titan.properties.erb" @@ -36,7 +37,7 @@ template "titan.properties" do :CASSANDRA_IP => node['Nodes']['CS'].join(",").gsub(/[|]/,''), :CASSANDRA_PWD => node['cassandra'][:cassandra_password], :CASSANDRA_USR => node['cassandra'][:cassandra_user], - :rep_factor => node['cassandra']['replication_factor'], - :DC_NAME => node['cassandra']['datacenter_name'] + :rep_factor => replication_factor, + :DC_NAME => node['cassandra']['datacenter_name']+node.chef_environment }) end diff --git a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb index 1d4c6d6f6c..8bef97c7b5 100644 --- a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb +++ b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb @@ -26,6 +26,7 @@ template "sdc-yaml-config" do }) end +replication_factor=1 template "titan.properties" do path "/#{tests_base}/conf/titan.properties" source "BE-titan.properties.erb" @@ -36,7 +37,7 @@ template "titan.properties" do :CASSANDRA_IP => node['Nodes']['CS'].join(",").gsub(/[|]/,''), :CASSANDRA_PWD => node['cassandra'][:cassandra_password], :CASSANDRA_USR => node['cassandra'][:cassandra_user], - :rep_factor => node['cassandra']['replication_factor'], - :DC_NAME => node['cassandra']['datacenter_name'] + :rep_factor => replication_factor, + :DC_NAME => node['cassandra']['datacenter_name']+node.chef_environment }) end -- 2.16.6