35 | | 4. On master node |
| 35 | 4. On master node1, in command pls change '''node1''' to docker id ex. 26b55aaad407 which can be checked with '''docker ps''' on swarm node n3 |
| 36 | {{{ |
| 37 | docker exec -it node1 mysql -uroot -pmypass \ |
| 38 | -e "SET @@GLOBAL.group_replication_bootstrap_group=1;" \ |
| 39 | -e "create user 'repl'@'%';" \ |
| 40 | -e "GRANT REPLICATION SLAVE ON *.* TO repl@'%';" \ |
| 41 | -e "flush privileges;" \ |
| 42 | -e "change master to master_user='repl' for channel 'group_replication_recovery';" \ |
| 43 | -e "START GROUP_REPLICATION;" \ |
| 44 | -e "SET @@GLOBAL.group_replication_bootstrap_group=0;" \ |
| 45 | -e "SELECT * FROM performance_schema.replication_group_members;" |
| 46 | }}} |
| 47 | |
| 48 | 5. On replicate node2, node3, pls change '''node2''' to docker id ex. ac87f41b140c which can be checked with '''docker ps''' on swarm node n1, n2 |
| 49 | {{{ |
| 50 | root@n1:/home/ubuntu/GR# docker exec -it ac87f41b140c mysql -uroot -pmypass \ |
| 51 | -e "change master to master_user='repl' for channel 'group_replication_recovery';" \ |
| 52 | -e "START GROUP_REPLICATION;" |
| 53 | }}} |
| 54 | We also do above command with node3 (replicate node) |
| 55 | |
| 56 | 6. Check all nodes status on node1 |
| 57 | {{{ |
| 58 | root@n3:/home/ubuntu# docker exec -it 26 mysql -uroot -pmypass -e "SELECT * FROM performance_schema.replication_group_members;" |
| 59 | mysql: [Warning] Using a password on the command line interface can be insecure. |
| 60 | +---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+ |
| 61 | | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK | |
| 62 | +---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+ |
| 63 | | group_replication_applier | 852f597b-e92c-11ec-9238-02420a000b03 | node2 | 3306 | ONLINE | SECONDARY | 8.0.29 | XCom | |
| 64 | | group_replication_applier | 89a10b8c-e92c-11ec-9362-02420a000b06 | node3 | 3306 | ONLINE | SECONDARY | 8.0.29 | XCom | |
| 65 | | group_replication_applier | 8ef43b09-e92c-11ec-936c-02420a000b09 | node1 | 3306 | ONLINE | PRIMARY | 8.0.29 | XCom | |
| 66 | +---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+ |
| 67 | root@n3:/home/ubuntu# |
| 68 | }}} |