aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/sdc-backend
diff options
context:
space:
mode:
authorSonsino, Ofir (os0695) <os0695@intl.att.com>2019-04-14 12:41:54 +0300
committerSonsino, Ofir (os0695) <os0695@intl.att.com>2019-04-14 12:41:54 +0300
commitb08309847c24bd3c060839a335a20cb3f750ed30 (patch)
treea4d87f251d14dabb769987f3e5b3214861d2fc8b /catalog-be/sdc-backend
parent962b8610448d6cec8f12045e09b4adac3aefbf4c (diff)
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) <os0695@intl.att.com>
Diffstat (limited to 'catalog-be/sdc-backend')
-rw-r--r--catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb23
1 files changed, 16 insertions, 7 deletions
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'],