四节点:mysql

使用 MySQL 兼容的 openHalo 内核替换默认的 PostgreSQL

mysql 配置模板基于 full 模板,使用使用易景科技开源的 openHalo (MYSQL兼容内核)替代原生 PostgreSQL 内核

完整教程请参考:openHalo (MySQL兼容) 内核使用说明


配置概览

  • 配置名称: mysql
  • 节点数量: 四节点,pigsty/vagrant/spec/full.rb
  • 配置说明:Babelfish/WiltonDB 四节点配置模板,提供 Microsoft SQL Server 兼容能力
  • 适用系统:el8, el9
  • 适用架构:x86_64, aarch64
  • 相关配置:full

此配置于 Pigsty v3.4.1 新加入。

启用方式:在 configure 过程中使用 -c mysql 参数:

./configure -c mysql

备注:这是一个四节点模版,您需要在生成配置后修改其他三个节点的 IP 地址或直接移除(可选)


配置内容

源文件地址:pigsty/conf/mysql.yml

all:
  children:

    infra:
      hosts:
        10.10.10.10: { infra_seq: 1 }

    etcd:
      hosts:
        10.10.10.10: { etcd_seq: 1 }
      vars:
        etcd_cluster: etcd

    # openHaloDB singleton
    pg-meta:
      hosts:
        10.10.10.10: { pg_seq: 1, pg_role: primary }
      vars:
        pg_cluster: pg-meta
        pg_users:
          - {name: dbuser_meta ,password: DBUser.Meta   ,pgbouncer: true ,roles: [dbrole_admin]    ,comment: pigsty admin user }
          - {name: dbuser_view ,password: DBUser.Viewer ,pgbouncer: true ,roles: [dbrole_readonly] ,comment: read-only viewer for meta database }
        pg_databases:
          - {name: postgres, extensions: [aux_mysql]} # the mysql compatible database
          - {name: meta ,baseline: cmdb.sql ,comment: pigsty meta database ,schemas: [pigsty]}
        pg_hba_rules:
          - {user: dbuser_view , db: all ,addr: infra ,auth: pwd ,title: 'allow grafana dashboard access cmdb from infra nodes'}
        pg_vip_enabled: true
        pg_vip_address: 10.10.10.2/24
        pg_vip_interface: eth1

    # halo 3-node ha cluster: 10.10.10.3 ---> 10.10.10.1{1,2,3}
    pg-test:
      hosts:
        10.10.10.11: { pg_seq: 1, pg_role: primary }   # primary instance, leader of cluster
        10.10.10.12: { pg_seq: 2, pg_role: replica }   # replica instance, follower of leader
        10.10.10.13: { pg_seq: 3, pg_role: replica, pg_offline_query: true } # replica with offline access
      vars:
        pg_cluster: pg-test           # define pgsql cluster name
        pg_users:  [{ name: test , password: test , pgbouncer: true , roles: [ dbrole_admin ] }]
        pg_databases: [{name: test}, { name: postgres, extensions: [aux_mysql] }]
        pg_vip_enabled: true
        pg_vip_address: 10.10.10.3/24
        pg_vip_interface: eth1

  vars:                               # global variables
    version: v3.4.1                   # pigsty version string
    admin_ip: 10.10.10.10             # admin node ip address
    region: default                   # upstream mirror region: default,china,europe
    node_tune: oltp                   # node tuning specs: oltp,olap,tiny,crit
    pg_conf: oltp.yml                 # pgsql tuning specs: {oltp,olap,tiny,crit}.yml
    #docker_registry_mirrors: ["https://docker.1ms.run", "https://docker.m.daocloud.io"]
    infra_portal:                     # domain names and upstream servers
      home         : { domain: h.pigsty }
      grafana      : { domain: g.pigsty ,endpoint: "${admin_ip}:3000" , websocket: true }
      prometheus   : { domain: p.pigsty ,endpoint: "${admin_ip}:9090" }
      alertmanager : { domain: a.pigsty ,endpoint: "${admin_ip}:9093" }
      blackbox     : { endpoint: "${admin_ip}:9115" }
      loki         : { endpoint: "${admin_ip}:3100" }

    pg_mode: mysql                    # MySQL Compatible Mode by HaloDB
    pg_version: 14                    # The current HaloDB is compatible with PG Major Version 14
    pg_packages: [ openhalodb, pgsql-common, mysql ]   # also install mysql client shell
    repo_modules: node,pgsql,infra,mysql
    repo_extra_packages: [ openhalodb, mysql ] # replace default postgresql kernel with openhalo packages

注意事项

openHalo 新近开源,尚未提供官方 RPM,目前 RPM 包由 Pigsty 制作提供。

Pigsty 将在后续提供对 Debian / Ubuntu 的支持。