The following are the steps.
Step 1: Enable Binary Log in MySQL (Slave) Instance on EC2
Please make sure you configure the my.cof file with the log_slave_updates=1 to enable the replication.
mysql> show variables like 'log_bin'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | log_bin | OFF | +---------------+-------+ 1 row in set (0.00 sec) mysql> exit Bye [ec2-user@ip-172-30-0-198 ~]$ sudo vi /etc/my.cnf [mysqld] server-id=2 #replicate-do-db=ggdemo log_slave_updates=1 #Bin Log Setup log-bin=bin.log log-bin-index=bin-log.index max_binlog_size=100M binlog_format=row [ec2-user@ip-172-30-0-198 ~]$ sudo service mysqld stop Stopping mysqld: [ OK ] [ec2-user@ip-172-30-0-198 ~]$ sudo service mysqld start Starting mysqld: [ OK ] [ec2-user@ip-172-30-0-198 ~]$ mysql -h localhost -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.6.29-log MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show variables like 'log_bin'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | log_bin | ON | +---------------+-------+ 1 row in set (0.00 sec)
Download GoldenGate for MySQL 12.2.0.1.1 and then use Filezilla to upload to EC2 instance. The download file size is 190MB.
[ec2-user@ip-172-30-0-198 gg]$ ./ggsci Oracle GoldenGate Command Interpreter for MySQL Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401 Linux, x64, 64bit (optimized), MySQL Enterprise on Dec 11 2015 16:23:51 Operating system character set identified as UTF-8. Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved. GGSCI (ip-172-30-0-198) 3> create subdirs Creating subdirectories under current directory /home/ec2-user/gg Parameter files /home/ec2-user/gg/dirprm: created Report files /home/ec2-user/gg/dirrpt: created Checkpoint files /home/ec2-user/gg/dirchk: created Process status files /home/ec2-user/gg/dirpcs: created SQL script files /home/ec2-user/gg/dirsql: created Database definitions files /home/ec2-user/gg/dirdef: created Extract data files /home/ec2-user/gg/dirdat: created Temporary files /home/ec2-user/gg/dirtmp: created Credential store files /home/ec2-user/gg/dircrd: created Masterkey wallet files /home/ec2-user/gg/dirwlt: created Dump files /home/ec2-user/gg/dirdmp: created GGSCI (ip-172-30-0-198) 4> edit param mgr port 7809 GGSCI (ip-172-30-0-198) 5> start mgr Manager started.
2016-03-20 04:54:31 ERROR OGG-06551 Oracle GoldenGate Manager for MySQL, mgr .prm: Could not translate host name ip-172-30-0-198 into an Internet address. 2016-03-20 04:54:31 ERROR OGG-01668 Oracle GoldenGate Manager for MySQL, mgr .prm: PROCESS ABENDING.Answer: You need to edit the /etc/hosts file to provide the public IP of this machine so that GoldenGate Manager can connect to.
[ec2-user@ip-172-30-0-198 gg]$ more /etc/hosts 127.0.0.1 localhost localhost.localdomain ip-172-30-0-198
GGSCI (ip-172-30-0-198) 5> dblogin sourcedb ggdemo@localhost, userid root password mysql 2016-03-20 05:21:34 WARNING OGG-00769 MySQL Login failed: . SQL error (2002). Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2). ERROR: Failed to connect to MySQL database engine for HOST localhost, DATABASE ggdemo, USER root, PORT 3306.Answer: Please refer to this blog post Why I get the "Can't connect to local MySQL Server through socket..." error?
extract emsq0001 setenv (MYSQL_HOME='/var/lib/mysql') SETENV (MYSQL_UNIX_PORT='/var/lib/mysql/mysql.sock') sourcedb ggdemo@localhost,userid root,password mysql reportcount every 60 seconds, rate exttrail ./dirdat/em TRANLOGOPTIONS ALTLOGDEST /var/lib/mysql/bin-log.index TABLE ggdemo.tt_customer; add extract emsq0001, tranlog, begin now add exttrail ./dirdat/em, ext emsq0001, megabytes 1
mysql> show variables like 'datadir'; +---------------+-----------------+ | Variable_name | Value | +---------------+-----------------+ | datadir | /var/lib/mysql/ | +---------------+-----------------+ 1 row in set (0.01 sec) mysql> exit Bye [ec2-user@ip-172-30-0-198 etc]$ cd /var/lib/mysql [ec2-user@ip-172-30-0-198 mysql]$ ls auto.cnf ibdata1 mysql mysql.sock bin.000001 ib_logfile0 mysqld-relay-bin.000157 performance_schema bin-log.index ib_logfile1 mysqld-relay-bin.000158 relay-log.info ggdemo master.info mysqld-relay-bin.index [ec2-user@ip-172-30-0-198 mysql]$ sudo more bin-log.index ./bin.000001
Answer: Please refer to this blog: Why do I get the "ERROR: opening port for MGR MGR (Connection timed out)." error?