From 3edcf9b6705aace9ec98addd8293d1aed5b47c89 Mon Sep 17 00:00:00 2001 From: Swann Croiset Date: Thu, 14 Jan 2016 11:51:57 +0100 Subject: [PATCH] Set appropriately the Pacemaker option no-quorum-policy When the cluster does not have quorum (less than 3 Elasticsearch nodes) the 'no-quorum policiy' is set to 'ignore', which allows to continue all resource management. If the cluster have quorum (more that 2 nodes), the policy is set to 'stop', which stops all resources in the affected cluster partition if the cluster loses quorum to avoid data corruption. http://clusterlabs.org/doc/en-US/Pacemaker/1.0/html/Pacemaker_Explained/s-cluster-options.html Change-Id: I3b1ad071e4bf31581f245bbd8de863e6266ffb5b --- .../puppet/manifests/enable_quorum.pp | 34 +++++++++++++++++++ deployment_tasks.yaml | 14 ++++++++ 2 files changed, 48 insertions(+) create mode 100644 deployment_scripts/puppet/manifests/enable_quorum.pp diff --git a/deployment_scripts/puppet/manifests/enable_quorum.pp b/deployment_scripts/puppet/manifests/enable_quorum.pp new file mode 100644 index 0000000..e8867dd --- /dev/null +++ b/deployment_scripts/puppet/manifests/enable_quorum.pp @@ -0,0 +1,34 @@ +# Copyright 2016 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +prepare_network_config(hiera('network_scheme', {})) +$corosync_roles = hiera_array('lma::corosync_roles') +$network_metadata = hiera('network_metadata') +$nodes = get_nodes_hash_by_roles($network_metadata, $corosync_roles) + +Cs_property { + provider => 'crm', +} + +if count($nodes) > 2 { + $policy = 'stop' +} else { + $policy = 'ignore' +} + +cs_property { 'no-quorum-policy': + ensure => present, + value => $policy, +} diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml index bb996ad..0ebbcc1 100644 --- a/deployment_tasks.yaml +++ b/deployment_tasks.yaml @@ -143,3 +143,17 @@ timeout: 600 reexecute_on: - deploy_changes + +# This task needs to be reexecuted to reconfigure the no-quorum-policy each +# time the cluster is scaled. +- id: lma-enable-quorum + type: puppet + groups: [primary-elasticsearch_kibana] + requires: [lma-es-kibana-haproxy] + required_for: [deploy_end] + parameters: + puppet_manifest: "puppet/manifests/enable_quorum.pp" + puppet_modules: "puppet/modules" + timeout: 120 + reexecute_on: + - deploy_changes