Follow the instructions in this section to prepare the MySQL database for Oracle GoldenGate Usage on both clusters.
On cluster nyc, add the following information to the my.cnf configuration file:
log-bin=/mys/data/logs/bin-log # additional Oracle GoldenGate requirements log-bin-index=/mys/data/logs/bin-log.index max_binlog_size=4096 binlog-format=ROW # for active-active configurations, set auto-increment auto-increment-increment=2 auto-increment-offset=1 # additional Oracle GoldenGate requirements end
Restart the MySQL server.
pnycb# clrs disable mys-rs pnycb# clrs enable mys-rs
On cluster sfo, add the following information to the my.cnf configuration file.
log-bin=/mys/data/logs/bin-log # Additional Oracle GoldenGate requirements log-bin-index=/mys/data/logs/bin-log.index max_binlog_size=4096 binlog-format=ROW # For active-active configurations, set auto-increment auto-increment-increment=2 auto-increment-offset=2 # Additional Oracle GoldenGate requirements end
Restart the MySQL server.
psfob# clrs disable mys-rs psfob# clrs enable mys-rs
On both clusters, create a database to be replicated and a database user gg for Oracle GoldenGate.
In this example, make the Oracle GoldenGate user gg as a database administrator.
Cluster nyc: root@pnycb:~# /usr/local/mysql/bin/mysql -S /tmp/mysql.sock -uroot -proot mysql> use mysql mysql> GRANT ALL ON *.* TO 'gg'@'localhost' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'pnyca' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'pnycb' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'psfoa' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'psfob' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'nyc-gg' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'sfo-gg' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'psfo' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'pnyc' IDENTIFIED BY 'gg'; mysql> create database golden; mysql> exit
Create a table to test your replication.
Once Oracle GoldenGate is configured, just manipulate data in this table and check the content on both sites.
Cluster nyc root@pnycb:~# /usr/local/mysql/bin/mysql -h nyc-gg -ugg -pgg mysql> use golden mysql> create table tab1 (row1 int not null, row2 char(64)); mysql> create unique index ind1 on tab1(row1); mysql> exit; Cluster sfo root@psfob:~# /usr/local/mysql/bin/mysql -S /tmp/mysql.sock -uroot -proot mysql> use mysql mysql> GRANT ALL ON *.* TO 'gg'@'localhost' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'pnyca' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'pnycb' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'psfoa' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'psfob' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'nyc-gg' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'sfo-gg' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'psfo' IDENTIFIED BY 'gg'; mysql> GRANT ALL ON *.* TO 'gg'@'pnyc' IDENTIFIED BY 'gg'; mysql> create database golden; mysql> exit
Create a table to test your replication.
Once GoldenGate is configured just manipulate data in this table and check the content on both sites.
root@psfob:~# /usr/local/mysql/bin/mysql -h sfo-gg -ugg -pgg mysql> use golden mysql> create table tab1 (row1 int not null, row2 char(64)); mysql> create unique index ind1 on tab1(row1); mysql> exit
On both clusters, set the MySQL database socket in the my.cnf file.
socket=/tmp/mysql.sock # Restart the mysql database. # clrs disable mys-rs # clrs enable mys-rs