How to create PowerDNS infrastructure for connecting it to SolusVM Master server?

Have more questions? Submit a request

Applicable to:

  • SolusVM

Question

How to create PowerDNS infrastructure for connecting it to SolusVM Master server?

Answer

SVM_WARN: The solution below is applicable for CentOS 7 servers only. For CentOS 6 check our documentation.

Automated solution

On PowerDNS master node:

  1. Install MariaDB and PowerDNS packages:

    # yum update -y && yum install epel-release -y && yum install mariadb mariadb-server pdns pdns-backend-mysql -y && systemctl enable mariadb && systemctl enable pdns && systemctl start mariadb

  2. Download and start svmpdnsinstall.sh script from SolusVM support github page:

    # curl -o svmpdnsinstall.sh https://raw.githubusercontent.com/solusvm-support/helpers/master/svmpdnsinstall.sh && sh svmpdnsinstall.sh

  3. Install PowerDNS Master using the script.

  4. Copy /root/master.txt to PowerDNS slave node:

    # scp /root/master.txt root@powerdns_slave_ip:/root/master.txt

    replace powerdns_slave_ip with actual IP address of PowerDNS slave node.

On PowerDNS slave node:

  1. Install MariaDB and PowerDNS packages:

    # yum update -y && yum install epel-release -y && yum install mariadb mariadb-server pdns pdns-backend-mysql -y && systemctl enable mariadb && systemctl enable pdns && systemctl start mariadb

  2. Download and start svmpdnsinstall.sh script from SolusVM support github page:

    # curl -o svmpdnsinstall.sh https://raw.githubusercontent.com/solusvm-support/helpers/master/svmpdnsinstall.sh && sh svmpdnsinstall.sh

  3. Install PowerDNS slave node using the script.

Add PowerDNS Master to SolusVM Master node.

Manual solution
  • Configure PowerDNS Master Server

    1. Install required packages and enable necessary services:

      # yum update -y
      # yum install epel-release -y
      # yum -y install mariadb mariadb-server pdns pdns-backend-mysql
      # systemctl enable mariadb
      # systemctl enable pdns
      # systemctl start mariadb

    2. Set the password for root user in MySQL and create empty powerdns database:

      # mysqladmin -u root password mastermysqlpassword
      # MYSQL_PWD=mastermysqlpassword mysql -u root -e"create database powerdns"

    3. Download pdns.sql file with database schema and import it:

      # wget https://support.solus.io/hc/en-us/article_attachments/360023860952/pdns.sql
      # MYSQL_PWD=mastermysqlpassword mysql -u root powerdns < pdns.sql

    4. Comment out launch=bind line in /etc/pdns/pdns.conf and add MySQL configuration there. Example below:

      CONFIG_TEXT: ...
      #launch=bind
      launch=gmysql
      gmysql-host=127.0.0.1
      gmysql-user=root
      gmysql-password=mastermysqlpassword
      gmysql-dbname=powerdns
      ...

    5. Add the following lines to /etc/my.cnf file under [mysqld] section:

      CONFIG_TEXT: server-id = 1
      log-bin = mysql-bin
      log-bin-index = mysql-bin.index
      expire-logs-days = 10
      max-binlog-size = 100M
      binlog-do-db = powerdns
      binlog_format=ROW
      bind-address=0.0.0.0

    6. Restart MariaDB and pdns:

      # service pdns restart
      # service mariadb restart

    7. Create user for SolusVM master and slave server:

      # MYSQL_PWD=mastermysqlpassword mysql -uroot
      mysql> create user pdnsslave;
      mysql> create user 'pdnsslave'@'*';
      mysql> grant replication slave on *.* to pdnsslave identified by 'ANEWPASSOWRD';
      mysql> GRANT ALL ON powerdns.* TO 'root'@'YOUR_SOLUSVM_MASTERS_IP' IDENTIFIED BY 'mastermysqlpassword';
      FLUSH PRIVILEGES;
      exit;

    8. Adjust firewall if required:

      # iptables -I INPUT -p tcp -s YOUR_SLAVE_MYSQL_IP --dport 3306 -j ACCEPT
      # iptables -I INPUT -p tcp -s YOUR_SOLUSVM_MASTERS_IP --dport 3306 -j ACCEPT
      # iptables-save > iptables.txt

    9. Execute the following query and copy its output:

      # MYSQL_PWD=mastermysqlpassword mysql -uroot -e "show master status \G"
      *************************** 1. row ***************************
      File: mysql-bin.000001
      Position: 99
      Binlog_Do_DB: powerdns
      Binlog_Ignore_DB:
      1 row in set (0.00 sec)

  • Configure PowerDNS Slave server

    1. Install required packages and enable necessary services:

      # yum update -y
      # yum install epel-release -y
      # yum -y install mariadb mariadb-server pdns pdns-backend-mysql
      # systemctl enable mariadb
      # systemctl enable pdns
      # systemctl start mariadb

    2. Set the password for root user in MySQL and create empty powerdns database:

      # mysqladmin -u root password slavemysqlpassword
      # MYSQL_PWD=slavemysqlpassword mysql -u root -e"create database powerdns"

    3. Download pdns.sql file with database schema and import it:

      # wget https://support.solus.io/hc/en-us/article_attachments/360023860952/pdns.sql
      # MYSQL_PWD=slavemysqlpassword mysql -u root powerdns < pdns.sql

    4. Comment out launch=bind line in /etc/pdns/pdns.conf and add MySQL configuration there. Result should look like this:

      CONFIG_TEXT: ...
      #launch=bind
      launch=gmysql
      gmysql-host=127.0.0.1
      gmysql-user=root
      gmysql-password=slavemysqlpassword
      gmysql-dbname=powerdns
      ...

    5. Edit /etc/my.cnf with the following settings added under [mysqld] section:

      CONFIG_TEXT: server-id=2
      relay-log=slave-relay-bin
      relay-log-index=slave-relay-bin.index
      replicate-do-db=powerdns

    6. Restart MariaDB and pdns:

      # service pdns restart
      # service mariadb restart

    7. Adjust firewall if required:

      # iptables -I INPUT -p tcp -s YOUR_MASTER_MYSQL_IP --dport 3306 -j ACCEPT
      # iptables-save > iptables.txt

    8. Configure Slave server to connect to the Master server:

      # MYSQL_PWD=slavemysqlpassword mysql -uroot
      mysql> change master to master_host='MASTER_POWERDNS_IP', master_user='pdnsslave', master_connect_retry=60, master_password='ANEWPASSOWRD', master_log_file='mysql-bin.000001', master_log_pos=99;
      mysql> start slave;

      Note: use the information from steps 7 (ANEWPASSWORD) and 9 (File is master_log_file and Position is master_log_pos

    9. Check the status with the following command for any error messages:

      MYSQL_LIN: mysql> show slave status \G

  • Add PowerDNS Master to SolusVM Master node.

Articles in this section

Was this article helpful?
0 out of 0 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.