Search code examples
mysqlpuppetdevopsgalera

galera puppet code creating two clusters instead of one cluster


I have a puppet code that supposed to create one galera cluster that contains two nodes but instead, it is creating two clusters with one node each.

the name of the two nodes are testbox1 and testbox2

the following is my ./hiera/role/testbox.yaml

---
classes:
  - '::galera'

selinux::mode: 'permissive'

yum::repos::enabled:
  - percona-x86_64
yum::repos:
  contrail-3.2.1-mitaka:
    enabled: 0

packages:
  - 'Percona-XtraDB-Cluster-shared-compat-57'
  - 'Percona-Server-selinux-56'

galera::configure_repo: false
galera::package_ensure: 'present'
galera::galera_package_ensure: 'absent'
galera::galera_package_name: 'Percona-XtraDB-Cluster-galera-3'
galera::client_package_name: 'Percona-XtraDB-Cluster-client-57'
galera::mysql_package_name: 'Percona-XtraDB-Cluster-server-57'
galera::bootstrap_command: 'systemctl start [email protected]'


galera::mysql_service_name: 'mysql'
mysql::server_service_name: 'mysql'
galera::service_enabled: true
galera::mysql_restart: true

galera::configure_firewall: false
mysql::server::purge_conf_dir: true
galera::purge_conf_dir: true

galera::grep_binary: '/bin/grep'
galera::mysql_binary: '/usr/bin/mysql'
galera::rundir: '/var/run/mysqld'
galera::socket: '/var/lib/mysql/mysql.sock'

galera::create_root_user: true
galera::create_root_my_cnf: true
galera::create_status_user: true
galera::status_check: true

galera::galera_servers: ['testbox-1', 'testbox-2']
galera::galera_master: 'testbox-1'
galera::status_password: 'bla'
galera::bind_address: '0.0.0.0'
galera::override_options:
  mysqld:
    pxc_strict_mode: 'ENFORCING'
    wsrep_provider: '/usr/lib64/galera3/libgalera_smm.so'
    wsrep_slave_threads: 8
    wsrep_sst_method: 'rsync'
    wsrep_cluster_name: 'grafana-galera-cluster'
    wsrep_node_address: "%{ipaddress}"
    wsrep_node_name: "%{hostname}"
    wsrep_sst_auth: "sstuser:%{hiera('galera::sstuser_password')}"
    binlog_format: 'ROW'
    default_storage_engine: 'InnoDB'
    innodb_locks_unsafe_for_binlog: 1
    innodb_autoinc_lock_mode: 2
    innodb_buffer_pool_size: '40000M'
    innodb_log_file_size: '100M'
    query_cache_size: 0
    query_cache_type: 0
    datadir: '/var/lib/mysql'
    socket: '/var/lib/mysql/mysql.sock'
    log-error: '/var/log/mysqld.log'
    pid-file: '/var/run/mysql/mysql.pid'
    max_connections: '10000'
    max_connect_errors: '10000000'
  mysqld_safe:
    log-error: '/var/log/mysqld.log'

galera::status_user: 'clustercheck'
galera::status_allow: '%'
galera::status_available_when_donor: 0
galera::status_available_when_readonly: -1
galera::status_host: 'localhost'
galera::status_log_on_success: ''
galera::status_log_on_success_operator: '='
galera::status_port: 9200

galera::validate::action: 'select count(1);'
galera::validate::catch: 'ERROR'
galera::validate::delay: 3
galera::validate::inv_catch: undef
galera::validate::retries: 20

and I am using fraenki/galera module

The thing with this code, I end up with testbox1 in one cluster and testbox2 in another cluster instead of having both of them in the same cluster, After troubleshooting my issue is related to jira.percona.com/browse/PXC-2258, I found out the puppet code will create wsrep.cnf which has no value for wsrep_cluster_address and this will overwrite /etc/my.cnf.d/server.cnf which has the right value. I know how to fix this manually by deleting wsrep.cnf but I would like to have Puppet to do this without me fixing things manually but I do not know how.

puppet version 3.8.7 (opensource) (I can not upgrade it)


Solution

  • mysql@bootstrap needs to be executed on only one node. The other node do a normal start and then it will SST off the first node.

    With two nodes you will have trouble getting a quorum and its unworkable as a HA system.