galera puppet 代码创建两个集群而不是一个集群

galera puppet code creating two clusters instead of one cluster

我有一个木偶代码,它应该创建一个包含两个节点的 galera 集群,但它却创建了两个集群,每个集群有一个节点。

两个节点的名字分别是testbox1和testbox2

以下是我的./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 mysql@bootstrap.service'


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

我正在使用 fraenki/galera 模块

关于这段代码,我最终在一个集群中使用了 testbox1,在另一个集群中使用了 testbox2,而不是将它们都放在同一个集群中,在对我的问题进行故障排除后,我发现与 jira.percona.com/browse/PXC-2258 有关puppet 代码将创建 wsrep.cnf,它没有 wsrep_cluster_address 的值,这将覆盖具有正确值的 /etc/my.cnf.d/server.cnf。我知道如何通过删除 wsrep.cnf 手动修复此问题,但我希望 Puppet 无需我手动修复即可执行此操作,但我不知道如何。

puppet 3.8.7版本(开源)(我升级不了)

mysql@bootstrap只需要在一个节点上执行。另一个节点正常启动,然后它将 SST 关闭第一个节点。

如果有两个节点,您将难以获得法定人数并且无法作为 HA 系统使用。