Manybubbles has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/95720


Change subject: Puppet configuration for new elasticsearch servers
......................................................................

Puppet configuration for new elasticsearch servers

Also sets up minimum_master_nodes, master_eligable, and holds_data.

Change-Id: Ic30396c1f47767b05a8e0cfe51693f845e763715
---
M manifests/role/elasticsearch.pp
M manifests/site.pp
M modules/elasticsearch/manifests/init.pp
M modules/elasticsearch/templates/elasticsearch.yml.erb
4 files changed, 50 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/20/95720/1

diff --git a/manifests/role/elasticsearch.pp b/manifests/role/elasticsearch.pp
index 90e4de4..267d8a9 100644
--- a/manifests/role/elasticsearch.pp
+++ b/manifests/role/elasticsearch.pp
@@ -1,5 +1,13 @@
 # = Class: role::elasticsearch::production
 #
+# == Parameters:
+# - $minimum_master_nodes:  how many master nodes must be online for this node
+#       to believe that the Elasticsearch cluster is functioning correctly.
+#       Defaults to 1.  Should be set to number of masster eligable nodes in
+#       cluster / 2 + 1.
+# - $master_eligable:  is this node eligable to be a master node?  Defaults to
+#       true.
+#
 # This class manages an elasticsearch service in a WMF-specific way for
 # production.
 #
@@ -9,10 +17,12 @@
         'pmtpa' => '224.2.2.6',
     }
     class { '::elasticsearch':
-        cluster_name    => "production-search-${::site}",
-        heap_memory     => '7G',
-        multicast_group => $multicast_group,
-        plugins_dir     => '/srv/deployment/elasticsearch/plugins',
+        cluster_name         => "production-search-${::site}",
+        heap_memory          => '7G',
+        multicast_group      => $multicast_group,
+        plugins_dir          => '/srv/deployment/elasticsearch/plugins',
+        minimum_master_nodes => $minimum_master_nodes,
+        master_eligable      => $master_eligable,
     }
     deployment::target { 'elasticsearchplugins': }
 
@@ -26,9 +36,10 @@
 #
 class role::elasticsearch::beta {
     class { '::elasticsearch':
-        cluster_name => 'beta-search',
-        heap_memory  => '4G',
-        plugins_dir  => '/srv/deployment/elasticsearch/plugins',
+        cluster_name         => 'beta-search',
+        heap_memory          => '4G',
+        plugins_dir          => '/srv/deployment/elasticsearch/plugins',
+        minimum_master_nodes => 3, # Has four nodes all of which can be master
     }
     deployment::target { 'elasticsearchplugins': }
 
diff --git a/manifests/site.pp b/manifests/site.pp
index b35d66b..50419f8 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -2757,7 +2757,7 @@
     class { misc::maintenance::updatequerypages: enabled => true }
 }
 
-node /^testsearch100[1-3]\.eqiad\.wmnet/ {
+node /^(testsearch100[1-3]|elastic10(0[0-9]|11))\.eqiad\.wmnet/ {
     include accounts::manybubbles,
         accounts::demon,
         groups::wikidev
@@ -2765,8 +2765,21 @@
     sudo_user { [ "manybubbles" ]: privileges => ['ALL = NOPASSWD: ALL'] }
     sudo_user { [ "demon" ]: privileges => ['ALL = NOPASSWD: ALL'] }
 
+    # TODO before merging: which nodes should be master eligable?
+    # Hopefully they are on different racks.
+    $master_eligable = $hostname ? {
+        /^testsearch100[1-3]/ => true,
+        'elastic1000'         => true,
+        'elastic1011'         => true,
+        'elastic1004'         => true,
+        default               => false,
+    }
+
     include standard
-    include role::elasticsearch::production
+    class { "role::elasticsearch::production":
+        minimum_master_nodes => 2,
+        master_eligable      => true,
+    }
     class { "lvs::realserver": realserver_ips => [ "10.2.2.30" ] }
 }
 
diff --git a/modules/elasticsearch/manifests/init.pp 
b/modules/elasticsearch/manifests/init.pp
index 3a13280..b3a69ca 100644
--- a/modules/elasticsearch/manifests/init.pp
+++ b/modules/elasticsearch/manifests/init.pp
@@ -12,6 +12,13 @@
 #       smaller.
 # - $multicast_group:  multicast group to use for peer discovery.  Defaults to
 #       elasticsearch's default: '224.2.2.4'.
+# - $minimum_master_nodes:  how many master nodes must be online for this node
+#       to believe that the Elasticsearch cluster is functioning correctly.
+#       Defaults to 1.  Should be set to number of masster eligable nodes in
+#       cluster / 2 + 1.
+# - $master_eligable:  is this node eligable to be a master node?  Defaults to
+#       true.
+# - $holds_data: should this node hold data?  Defaults to true.
 #
 # == Sample usage:
 #
@@ -22,7 +29,10 @@
 class elasticsearch($cluster_name,
                     $heap_memory = '2G',
                     $multicast_group = '224.2.2.4',
-                    $plugins_dir = '/usr/share/elasticsearch/plugins') {
+                    $plugins_dir = '/usr/share/elasticsearch/plugins',
+                    $minimum_master_nodes = 1,
+                    $master_eligable = true,
+                    $holds_data = true) {
     # Check arguments
     if $cluster_name == 'elasticsearch' {
         fail('$cluster_name must not be set to "elasticsearch"')
diff --git a/modules/elasticsearch/templates/elasticsearch.yml.erb 
b/modules/elasticsearch/templates/elasticsearch.yml.erb
index 5190cea..f7282b4 100644
--- a/modules/elasticsearch/templates/elasticsearch.yml.erb
+++ b/modules/elasticsearch/templates/elasticsearch.yml.erb
@@ -43,12 +43,12 @@
 # and to allow or deny to store the data.
 #
 # Allow this node to be eligible as a master node (enabled by default):
-#
-# node.master: true
-#
+
+node.master: <%= @master_eligable %>
+
 # Allow this node to store data (enabled by default):
-#
-# node.data: true
+
+node.data: <%= @holds_data %>
 
 # You can exploit these settings to design advanced cluster topologies.
 #
@@ -300,7 +300,7 @@
 # operational within the cluster. Set this option to a higher value (2-4)
 # for large clusters (>3 nodes):
 #
-# discovery.zen.minimum_master_nodes: 1
+discovery.zen.minimum_master_nodes: <%= @minimum_master_nodes %>
 discovery.zen.ping.multicast.group: <%= @multicast_group %>
 
 # Set the time to wait for ping responses from other nodes when discovering.

-- 
To view, visit https://gerrit.wikimedia.org/r/95720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic30396c1f47767b05a8e0cfe51693f845e763715
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Manybubbles <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to