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
This commit is contained in:
Swann Croiset 2016-01-14 11:51:57 +01:00
parent f0cebee783
commit 3edcf9b670
2 changed files with 48 additions and 0 deletions

View File

@ -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,
}

View File

@ -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