ihanick / anydbver

LXD+Ansible setup to install Percona/Oracle MySQL/MongoDB/Postgresql database products with exact version specified.
MIT License
50 stars 12 forks source link

replication in mysql #29

Open jelson-y opened 3 months ago

jelson-y commented 3 months ago

For MySQLreplication is not automatically configure with the deploy command

ihanick commented 3 months ago

MySQL 5.7 is not available for RHEL8, so you can start it with el7:

$ time (./anydbver --os=el7 deploy node0 mysql:5.7 node1 mysql:5.7,master=node0 2>&1 |tail -n 5 ; ./anydbver exec node1 -- mysql -e "show slave status\G" | grep Yes)

PLAY RECAP *********************************************************************
ihanick.default            : ok=24   changed=8    unreachable=0    failed=0    skipped=76   rescued=0    ignored=0
ihanick.node1              : ok=25   changed=9    unreachable=0    failed=0    skipped=75   rescued=0    ignored=0

             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
           Master_SSL_Allowed: Yes

real    3m24.419s

For MySQL 8.0, it's possible to use default el8:

$ time (./anydbver deploy node0 mysql:8.0 node1 mysql:8.0,master=node0 2>&1 |tail -n 5 ; ./anydbver exec node1 -- mysql -e "show slave status\G" | grep Yes)

PLAY RECAP *********************************************************************
ihanick.default            : ok=24   changed=7    unreachable=0    failed=0    skipped=76   rescued=0    ignored=0
ihanick.node1              : ok=25   changed=8    unreachable=0    failed=0    skipped=75   rescued=0    ignored=0

             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
           Master_SSL_Allowed: Yes

real    2m36.197s

MySQL 8.3 innovative release requires change for show slave status to show replica status:

$ time (./anydbver deploy node0 mysql:8.3 node1 mysql:8.3,master=node0 2>&1 |tail -n 5 ; ./anydbver exec node1 -- mysql -e "show replica status\G" | grep Yes)

PLAY RECAP *********************************************************************
ihanick.default            : ok=25   changed=8    unreachable=0    failed=0    skipped=75   rescued=0    ignored=0
ihanick.node1              : ok=26   changed=9    unreachable=0    failed=0    skipped=74   rescued=0    ignored=0

           Replica_IO_Running: Yes
          Replica_SQL_Running: Yes
           Source_SSL_Allowed: Yes

real    2m45.422s

MySQL 8.4 is available just today, do not forget to git pull.

$ time (./anydbver deploy node0 mysql:8.4 node1 mysql:8.4,master=node0 2>&1 |tail -n 5 ; ./anydbver exec node1 -- mysql -e "show replica status\G" | grep Yes)

PLAY RECAP *********************************************************************
ihanick.default            : ok=24   changed=7    unreachable=0    failed=0    skipped=76   rescued=0    ignored=0
ihanick.node1              : ok=25   changed=8    unreachable=0    failed=0    skipped=75   rescued=0    ignored=0

          Replica_SQL_Running: Yes
           Source_SSL_Allowed: Yes

real    2m14.642s

Percona Server also works (5.7 is still available on RHEL8):

time (./anydbver deploy node0 percona-server:5.7 node1 percona-server:5.7,master=node0 2>&1 |tail -n 5 ; ./anydbver exec node1 -- mysql -e "show slave status\G" | grep Yes)
time (./anydbver deploy node0 percona-server:8.0 node1 percona-server:8.0,master=node0 2>&1 |tail -n 5 ; ./anydbver exec node1 -- mysql -e "show slave status\G" | grep Yes)

Async replication while docker-image is specified is not implemented in the current version and I think I will make it for the anydbver variant in golang.

Currently there is only group replication as a PoC:

./anydbver deploy node0 mysql:8.0,docker-image,group-replication node1 mysql:8.0,docker-image,master=node0,group-replication

As you can see it's pretty easy to reproduce the issue if I know:

jelson-y commented 3 months ago

Hope the below helps.

[root@centos7 anydbver]# ./anydbver deploy node0 mysql:8.3 node1 mysql:8.3,master=node0 2>&1 |tail -n 5 ; ./anydbver exec node1 -- mysql -e "show slave status\G" | grep Yes

PLAY RECAP **************************************************************************************************************************************************************************************************
root.default               : ok=25   changed=14   unreachable=0    failed=0    skipped=75   rescued=0    ignored=0   
root.node1                 : ok=26   changed=15   unreachable=0    failed=0    skipped=74   rescued=0    ignored=0   

[root@centos7 anydbver]#

command : ./anydbver deploy node0 mysql:8.3 node1 mysql:8.3,master=node0

version :

[root@centos7 anydbver]# docker version Client: Docker Engine - Community Version: 26.1.4 API version: 1.45 Go version: go1.21.11 Git commit: 5650f9b Built: Wed Jun 5 11:32:04 2024 OS/Arch: linux/amd64 Context: default

full output of deploy command : attached

anydbver_sanity.txt

ihanick commented 2 months ago

Hi @jelson-y , please check what's going on during replication setup:

full output of deploy command : attached

anydbver_sanity.txt Please get the ip address of the master with: ./anydbver ip node0 put the ip to the command below instead of 172.18.0.2 ./anydbver exec node0 -- bash /bin/bash -x /vagrant/tools/setup_mysql_replication.sh gtid 172.18.0.2 root verysecretpassword1^ mysql /etc/my.cnf "mysqld" "cluster1" ""