Enable the MySQL back end for PowerDNS

Enable the MySQL back end for PowerDNSΒΆ

You can use PowerDNS with the MySQL back end instead of the default SQLite one if required.

Warning

If you use PowerDNS in the slave mode, you must run MySQL with a storage engine that supports transactions, for example, InnoDB that is the default storage engine for MySQL in MCP.

Using a non-transaction storage engine may negatively affect your database after some actions, such as failures in an incoming zone transfer.

For more information, see: PowerDNS documentation.

Note

While following the procedure below, replace ${node} with a short name of the required node where applicable.

To enable the MySQL back end for PowerDNS:

  1. Open your Reclass model Git repository.

  2. Modify nodes/_generated/${full_host_name}.yml, where ${full_host_name} is the FQDN of the particular node. Add the following classes and parameters:

    classes:
    ...
    - cluster.<cluster_name>
    - system.powerdns.server.single
    ...
    parameters:
      ...
      powerdns:
        ...
        server:
          ...
          backend:
            engine: mysql
            host: ${_param:cluster_vip_address}
            port: 3306
            dbname: ${_param:mysql_powerdns_db_name}
            user: ${_param:mysql_powerdns_db_name}
            password: ${_param:mysql_powerdns_password}
    

    Substitute <cluster_name> with the appropriate value.

    Warning

    Do not override the cluster_vip_address parameter.

  3. Create a classes/system/galera/server/database/powerdns_${node}.yml file and add the databases to use with the MySQL back end:

    parameters:
      mysql:
        server:
          database:
            powerdns_${node}:
              encoding: utf8
              users:
              - name: ${_param:mysql_powerdns_user_name_${node}}
                password: ${_param:mysql_powerdns_user_password_${node}}
                host: '%'
                rights: all
              - name: ${_param:mysql_powerdns_user_name_${node}}
                password: ${_param:mysql_powerdns_user_password_${node}}
                host: ${_param:cluster_local_address}
                rights: all
    
  4. Add the following class to classes/cluster/<cluster_name>/openstack/control.yml:

    classes:
    ...
    - system.galera.server.database.powerdns_${node}
    
  5. Add the MySQL parameters for Galera to classes/cluster/<cluster_name>/openstack/init.yml. For example:

    parameters:
      _param:
        ...
        mysql_powerdns_db_name_${node}: powerdns_${node}
        mysql_powerdns_user_name_${node}: pdns_slave_${node}
        mysql_powerdns_user_password_${node}: ni1iX1wuf]ongiVu
    
  6. Log in to the Salt Master node.

  7. Refresh pillar information:

    salt '*' saltutil.refresh_pillar
    
  8. Apply the Galera states:

    salt -C 'I@galera:master' state.sls galera
    
  9. Proceed to deploying PowerDNS as described in Deploy a new PowerDNS server for Designate.

  10. Optional. After you deploy PowerDNS:

    • If you use MySQL InnoDB, add foreign key constraints to the tables. For details, see: PowerDNS documentation.

    • If you use MySQL replication, to support the NATIVE domains, set binlog_format to MIXED or ROW to prevent differences in data between replicated servers. For details, see: MySQL documentation.