A Replication between MySql and MariaDB with SymmetricDS

A Replication between MySql and MariaDB with SymmetricDS

apt-get install mysql-server-5.6

mysql -u root -proot -e “CREATE DATABASE corp;”

mkdir -p /data/mariadb1

docker run -d -v /data/mariadb1:/var/lib/mysql -p 3306 -p 8080 -e XTRABACKUP_PASSWORD=abc -e MYSQL_ROOT_PASSWORD=secret –name=store001 irmann/galera-mariadb-10.0-xtrabackup seed

docker exec -it store001 bash

root@2954e5d5249c:/# export TERM=dumb

root@2954e5d5249c:/# mysql -u root -psecret -e ‘CREATE DATABASE store001;’
root@2954e5d5249c:/# exit

SEED_IP=$(docker inspect -f ‘{{ .NetworkSettings.IPAddress }}’ store001)

echo $SEED_IP
172.17.0.5

mkdir -p /data/mariadb2

docker run -d -v /data/mariadb2:/var/lib/mysql -p 3306 -p 8080 -e XTRABACKUP_PASSWORD=abc -e MYSQL_ROOT_PASSWORD=secret –name=store002 irmann/galera-mariadb-10.0-xtrabackup seed

docker exec -it store002 bash

root@2954e5d5249c:/# export TERM=dumb

root@2954e5d5249c:/# mysql -u root -psecret -e ‘CREATE DATABASE store002;’
root@2954e5d5249c:/# exit

SEED_IP=$(docker inspect -f ‘{{ .NetworkSettings.IPAddress }}’ store002)

echo $SEED_IP
172.17.0.6

– download symmetric-server from http://sourceforge.net/projects/symmetricds/files/symmetricds/symmetricds-3.7/symmetric-server-3.7.10.zip/download

unzip symmetric-server-3.7.10.zip -d ~/opt/
cd ~/opt/symmetric-server-3.7.10/samples
subl corp-000.properties

engine.name=corp-000
group.id=corp
external.id=000
sync.url=http://localhost:31415/sync/corp-000
registration.url=
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost/corp?tinyInt1isBit=false
db.user=root
db.password=root

job.purge.period.time.ms=7200000
job.routing.period.time.ms=5000
job.push.period.time.ms=10000
job.pull.period.time.ms=10000
initial.load.create.first=true

subl store-001.properties

engine.name=store-001
group.id=store
external.id=001
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://172.17.0.5/store001?tinyInt1isBit=false
db.user=root
db.password=secret
registration.url=http://localhost:31415/sync/corp-000
job.routing.period.time.ms=5000
job.push.period.time.ms=10000
job.pull.period.time.ms=10000

subl store-002.properties

engine.name=store-002
group.id=store
external.id=002
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://172.17.0.6/store002?tinyInt1isBit=false
db.user=root
db.password=secret
registration.url=http://localhost:31415/sync/corp-000
job.routing.period.time.ms=5000
job.push.period.time.ms=10000
job.pull.period.time.ms=10000

cp corp-000.properties ../engines/
cp store-001.properties ../engines/
cp store-002.properties ../engines/

../bin/dbimport –engine corp-000 –format XML –alter-case create_sample.xml
../bin/symadmin –engine corp-000 create-sym-tables
../bin/dbimport –engine corp-000 insert_sample.sql
../bin/sym

../bin/symadmin –engine corp-000 reload-node 001
../bin/symadmin –engine corp-000 reload-node 002

mysql -u root -proot -D corp

insert into item (item_id, name) values (110000055, ‘Soft Drink’);
insert into item_selling_price (item_id, store_id, price)
values (110000055, ‘001’, 0.65);
insert into item_selling_price (item_id, store_id, price)
values (110000055, ‘002’, 1.00);

docker exec -it store001 bash

root@2954e5d5249c:/# export TERM=dumb

root@2954e5d5249c:/# mysql -u root -psecret -D store001

select * from item_selling_price
-> ;
+———–+———-+——-+——+
| item_id | store_id | price | cost |
+———–+———-+——-+——+
| 11000001 | 001 | 0.20 | 0.10 |
| 110000055 | 001 | 0.65 | NULL |
+———–+———-+——-+——+

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s