Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


powerdns_master-slave_replication_with_mysql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
powerdns_master-slave_replication_with_mysql [2015/04/10 18:26] – [Client verification] adminpowerdns_master-slave_replication_with_mysql [2015/04/10 18:33] – [Enable replication] admin
Line 83: Line 83:
   * Create backup on **master**:<code>mysqldump -u root -p --single-transaction --all-databases --master-data=1 > /tmp/master_backup.sql</code>   * Create backup on **master**:<code>mysqldump -u root -p --single-transaction --all-databases --master-data=1 > /tmp/master_backup.sql</code>
   * Copy the dump to the ** slave**.   * Copy the dump to the ** slave**.
 +
 +====Slave configuration====
 +  * Edit /etc/my.cnf on the **slave**:<code>[mysqld]
 +log_bin = mysql-bin
 +server_id = 20
 +log_slave_updates = 1
 +relay_log = mysql-relay-bin
 +read_only = 1</code>
 +
 +====Enable replication====
 +  * Import the backup on the **slave**:<code>MariaDB [(none)]> source /tmp/master_backup.sql</code>
 +  * Configure replication:<code>CHANGE MASTER TO
 +Master_Host='ns1.polaire.nl',
 +Master_User='replicator',
 +Master_Password='yourpassword',
 +Master_SSL=1,
 +Master_SSL_CA = '/etc/pki/tls/certs/mariadb/ca.pem',
 +Master_SSL_CERT = '/etc/pki/tls/certs/mariadb/slave-public.pem',
 +Master_SSL_KEY = '/etc/pki/tls/certs/mariadb/slave-private.pem',
 +Master_SSL_Verify_Server_Cert = 1;
 +Query OK, 0 rows affected (0.08 sec)</code>
 +  * Start slave:<code>MariaDB [(none)]> slave start;
 +Query OK, 0 rows affected (0.00 sec)
 +
 +MariaDB [(none)]> show slave status \G</code>
powerdns_master-slave_replication_with_mysql.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1