Filippo Giunchedi has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/370554 )
Change subject: Cassandra: Do not include the main DNS in the list of seeds
......................................................................
Cassandra: Do not include the main DNS in the list of seeds
Bug: T172610
Change-Id: I49313adaf5fb6c1028df21a2c18ca4385df734f5
---
M modules/cassandra/manifests/instance.pp
M modules/cassandra/templates/cassandra.yaml-2.1.erb
M modules/cassandra/templates/cassandra.yaml-2.2.erb
M modules/cassandra/templates/cassandra.yaml-3.x.erb
4 files changed, 26 insertions(+), 3 deletions(-)
Approvals:
jenkins-bot: Verified
Filippo Giunchedi: Looks good to me, approved
diff --git a/modules/cassandra/manifests/instance.pp
b/modules/cassandra/manifests/instance.pp
index 1587dca..c6dc7f8 100644
--- a/modules/cassandra/manifests/instance.pp
+++ b/modules/cassandra/manifests/instance.pp
@@ -69,7 +69,11 @@
$hints_directory = $this_instance['hints_directory']
$heapdump_directory = $this_instance['heapdump_directory']
$saved_caches_directory = $this_instance['saved_caches_directory']
+ $instance_count = 1
} else {
+ unless $instance_name =~ /^[a-z]$/ {
+ fail("instance name should match /^[a-z]$/, but have
${instance_name}")
+ }
$data_directory_base = "/srv/cassandra-${instance_name}"
$config_directory = "/etc/cassandra-${instance_name}"
$service_name = "cassandra-${instance_name}"
@@ -81,6 +85,7 @@
$hints_directory = pick($this_instance['hints_directory'],
"${data_directory_base}/data/hints")
$heapdump_directory = pick($this_instance['heapdump_directory'],
$data_directory_base)
$saved_caches_directory =
pick($this_instance['saved_caches_directory'],
"${data_directory_base}/saved_caches")
+ $instance_count = size($instances)
}
$tls_cluster_name = $::cassandra::tls_cluster_name
diff --git a/modules/cassandra/templates/cassandra.yaml-2.1.erb
b/modules/cassandra/templates/cassandra.yaml-2.1.erb
index ffdb549..e41e759 100644
--- a/modules/cassandra/templates/cassandra.yaml-2.1.erb
+++ b/modules/cassandra/templates/cassandra.yaml-2.1.erb
@@ -266,11 +266,17 @@
# Ex: "<ip1>,<ip2>,<ip3>"
# Omit own host name / IP in multi-node clusters (see
# https://phabricator.wikimedia.org/T91617).
+ # Also disregard the main DNS interfaces of each node when
+ # multiple instances are colocated on the same node (see
+ # https://phabricator.wikimedia.org/T172610)
<% clean_seeds = @seeds.length > 1 ? @seeds.select { |x|
x != @hostname \
&& ! (x.start_with?
"#{@hostname}-") \
&& x != @ipaddress \
- && x != @fqdn
+ && x != @fqdn \
+ &&
(/^.+-[a-z]\.(?:eqiad|codfw)\.wmnet$/ =~ x \
+ || @instance_count ==
1 \
+ ||
/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ =~ x)
}.join(',') :
@seeds.join(',') %>
- seeds: <%= clean_seeds %>
# For workloads with more data than can fit in memory, Cassandra's
diff --git a/modules/cassandra/templates/cassandra.yaml-2.2.erb
b/modules/cassandra/templates/cassandra.yaml-2.2.erb
index e71f15f..809d399 100644
--- a/modules/cassandra/templates/cassandra.yaml-2.2.erb
+++ b/modules/cassandra/templates/cassandra.yaml-2.2.erb
@@ -311,11 +311,17 @@
# Ex: "<ip1>,<ip2>,<ip3>"
# Omit own host name / IP in multi-node clusters (see
# https://phabricator.wikimedia.org/T91617).
+ # Also disregard the main DNS interfaces of each node when
+ # multiple instances are colocated on the same node (see
+ # https://phabricator.wikimedia.org/T172610)
<% clean_seeds = @seeds.length > 1 ? @seeds.select { |x|
x != @hostname \
&& ! (x.start_with?
"#{@hostname}-") \
&& x != @ipaddress \
- && x != @fqdn
+ && x != @fqdn \
+ &&
(/^.+-[a-z]\.(?:eqiad|codfw)\.wmnet$/ =~ x \
+ || @instance_count ==
1 \
+ ||
/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ =~ x)
}.join(',') :
@seeds.join(',') %>
- seeds: <%= clean_seeds %>
# For workloads with more data than can fit in memory, Cassandra's
diff --git a/modules/cassandra/templates/cassandra.yaml-3.x.erb
b/modules/cassandra/templates/cassandra.yaml-3.x.erb
index 5462ba6..2069ae3 100644
--- a/modules/cassandra/templates/cassandra.yaml-3.x.erb
+++ b/modules/cassandra/templates/cassandra.yaml-3.x.erb
@@ -397,11 +397,17 @@
# Ex: "<ip1>,<ip2>,<ip3>"
# Omit own host name / IP in multi-node clusters (see
# https://phabricator.wikimedia.org/T91617).
+ # Also disregard the main DNS interfaces of each node when
+ # multiple instances are colocated on the same node (see
+ # https://phabricator.wikimedia.org/T172610)
<% clean_seeds = @seeds.length > 1 ? @seeds.select { |x|
x != @hostname \
&& ! (x.start_with?
"#{@hostname}-") \
&& x != @ipaddress \
- && x != @fqdn
+ && x != @fqdn \
+ &&
(/^.+-[a-z]\.(?:eqiad|codfw)\.wmnet$/ =~ x \
+ || @instance_count ==
1 \
+ ||
/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ =~ x)
}.join(',') :
@seeds.join(',') %>
- seeds: <%= clean_seeds %>
# For workloads with more data than can fit in memory, Cassandra's
--
To view, visit https://gerrit.wikimedia.org/r/370554
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I49313adaf5fb6c1028df21a2c18ca4385df734f5
Gerrit-PatchSet: 7
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mobrovac <[email protected]>
Gerrit-Reviewer: Eevans <[email protected]>
Gerrit-Reviewer: Elukey <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits