1. Master/slavemysql
2. Native replication(數據庫複製)web
這裏選用的是主從模式,主從各連獨立的數據庫sql
[root@ops-tmp-app-1 ~]# cat /etc/hosts數據庫
10.3.2.5 ops-tmp-app-1api
10.3.2.15 ops-tmp-app-2app
ops-tmp-app-1 從節點dom
ops-tmp-app-2 主節點ide
master配置文件:ui
[root@ops-tmp-app-2 pdns]# cat pdns.confspa
api=yes
api-key=changeme
api-logfile=/var/log/pdns.log
cache-ttl=20
daemon=yes
default-ttl=30
# 數據庫相關配置
launch=gmysql
gmysql-host=10.3.2.15
gmysql-port=3306
gmysql-user=powerdns
gmysql-dbname=powerdns
gmysql-password=powerdns
local-address=10.3.2.15
master=yes
setgid=pdns
setuid=pdns
webserver=yes
webserver-address=0.0.0.0
webserver-allow-from=0.0.0.0/0
webserver-port=8081
# 容許slave來同步變動
allow-axfr-ips=10.3.2.5
also-notify=10.3.2.5
disable-axfr=no
# 通知和AXFR的間隔
slave-cycle-interval=60
loglevel=6
default-soa-name=ops-tmp-app-2
slave配置文件:
[root@ops-tmp-app-1 ~]# cat /etc/pdns/pdns.conf
# 是否開啓api
api=yes
api-key=changeme
api-logfile=/var/log/pdns.log
cache-ttl=20
daemon=yes
default-ttl=30
# 數據庫相關配置
launch=gmysql
gmysql-host=10.3.2.5
gmysql-port=3306
gmysql-user=powerdns
gmysql-dbname=powerdns
gmysql-password=#%-#ymsX6u7
local-address=10.3.2.5
setgid=pdns
setuid=pdns
webserver=yes
webserver-address=0.0.0.0
webserver-allow-from=0.0.0.0/0
webserver-port=8081
# 容許域傳輸到的子網
allow-axfr-ips=10.3.2.15
also-notify=10.3.2.15
slave=yes
loglevel=9
default-soa-name=ops-tmp-app-1
INSERT INTO supermasters VALUES ('10.3.2.15', 'ops-tmp-app-1', account);
1. 點擊domain template
2. 點擊create template
3. 輸入名字,replication
4. 輸入名稱描述,auth replication for slave
過一回在slave節點的數據庫中查看有無記錄便可
[root@ops-tmp-app-2 ~]# cat /etc/resolv.conf
nameserver 10.3.2.5
[root@ops-tmp-app-1 ~]# dig www.test.org
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7_5.1 <<>> www.test.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20435
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1680
;; QUESTION SECTION:
;www.test.org. IN A
;; ANSWER SECTION:
www.test.org. 3600IN A 123.125.115.110
;; Query time: 3 msec
;; SERVER: 10.3.2.15#53(10.3.2.15)
;; WHEN: Mon Mar 04 20:41:51 CST 2019
;; MSG SIZE rcvd: 57