Thursday, October 15, 2009

MySQL and SSL, continued

Barked up some wrong trees, but finally got it to work. I'd made some trivial errors specifying the wrong filename as --ssl-ca=... parameter to mysql, and also the permissions on the certificate file for the mysqld slave process on cirrus was wrong. But now it works for server 1!

Next step: enable slave for server 2, copy my data from quetzal to server 2 master on cumulus, make sure it ends up on cirrus.

Manually added port forwarding of ports 3307, 3308, 3309 from sol to cumulus, these settings won't survive a reboot.

Steps to enable replication:

On master:
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)

mysql> show master status;
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| mysql2-bin.000005 | 98 | | |
+-------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)

mysql> show master status;
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| mysql2-bin.000005 | 98 | | |
+-------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
On slave:
mysql> CHANGE MASTER TO MASTER_HOST='www.lewin.nu', MASTER_USER='replicationSlave', MASTER_PASSWORD='****', MASTER_LOG_FILE='mysql2-bin.000005', MASTER_LOG_POS=98, MASTER_SSL=1, MASTER_SSL_CA='/etc/mysql/mysql-ca-cert.pem', MASTER_PORT=3307;
Query OK, 0 rows affected (0.01 sec)
For some reason I got errors about mysql not being able to update the master.info; I had to to 'RESET SLAVE', then CHANGE MASTER TO..., and then it would work.

Then do "unlock tables" on the master, and "start slave" on the slave.

do "SHOW SLAVE STATUS\G;" on the slave, the first line should read: "Waiting for master to send event".

Next step is to copy my date from quetzal to database 2, and make sure it is replicated to Mårten. It's tens of GB I think, so it will take a while.

Bedtime now!

No comments: