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.
On PowerDNS master node:
-
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
-
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
-
Install PowerDNS Master using the script.
-
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:
-
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
-
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
-
Install PowerDNS slave node using the script.
-
Configure PowerDNS Master Server
-
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 -
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" -
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 -
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
... -
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 -
Restart MariaDB and pdns:
# service pdns restart
# service mariadb restart -
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; -
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 -
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
-
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 -
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" -
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 -
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
... -
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 -
Restart MariaDB and pdns:
# service pdns restart
# service mariadb restart -
Adjust firewall if required:
# iptables -I INPUT -p tcp -s YOUR_MASTER_MYSQL_IP --dport 3306 -j ACCEPT
# iptables-save > iptables.txt -
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
ismaster_log_file
andPosition
ismaster_log_pos
-
Check the status with the following command for any error messages:
MYSQL_LIN: mysql> show slave status \G
-
Comments
0 commentsPlease sign in to leave a comment.