-
Notifications
You must be signed in to change notification settings - Fork 744
[docs] AZ tutorial: High availability MySQL #4360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: availability-zones
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## availability-zones #4360 +/- ##
======================================================
+ Coverage 89.35% 89.67% +0.31%
======================================================
Files 259 268 +9
Lines 15744 16270 +526
======================================================
+ Hits 14068 14590 +522
- Misses 1676 1680 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f21b770 to
3098c8f
Compare
d45e88c to
c243ac6
Compare
3098c8f to
6c91f0b
Compare
ff67820 to
43a6ad7
Compare
7f27dd1 to
b20f21b
Compare
b20f21b to
4029149
Compare
43a6ad7 to
874a1be
Compare
26948b9 to
eeceaee
Compare
874a1be to
b827909
Compare
eeceaee to
b7c9b32
Compare
b827909 to
72d2d5a
Compare
b7c9b32 to
7104ebb
Compare
72d2d5a to
0893661
Compare
7104ebb to
f00a058
Compare
0893661 to
1637626
Compare
sharder996
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @geoffreynyaga, after extensive testing I think I'm finally able to give some feedback on this.
First of, after having trouble getting the MySQL setup to work following this guide I used the Google doc version which I had better success with. I actually think the Google doc version is better written than this one here and fixes a lot of the things I was going to leave comments on in this review. I did still have some additional comments which I left there.
As far as testing goes, I got the setup working properly on macOS after tinkering a bit. So, pending my comments on the Google doc, I think that side is good.
For Ubuntu, I was not able to get the setup working with issues arising when trying to get mysql-primary to rejoin the cluster. Below are some logs parsed out of /var/log/mysql/error.log:
2025-10-29T04:58:56.540884Z 11 [ERROR] [MY-010584] [Repl] Replica I/O for channel '': Error connecting to source '[email protected]:3306'. This was attempt 10/86400, with a delay of 60 seconds between attempts. Message: Access denied for user 'replica'@'10.32.29.1' (using password: YES), Error_code: MY-001045
2025-10-29T04:59:01.244290Z 27 [Warning] [MY-010056] [Server] Host name 'scott-Darter-Pro' could not be resolved: Temporary failure in name resolution
I find it interesting that the database is trying to connect to 10.32.29.1, which is the IP address of my host and not the IP of the new primary.
Another thing I find interesting is that on macOS, the two VMs which should be in different availability zones are located within the same subnet, i.e. 192.168.2.* where as on Ubuntu they are in different subnets, i.e. 10.152.207.* and 10.32.29.*. I'm not sure, but wouldn't be surprised if this is related to the issues I have on Ubuntu as described above.
@Sploder12 maybe you are able to provide some more insight into what is going on here.
| GRANT REPLICATION SLAVE ON *.* TO 'replica'@'%'; | ||
| FLUSH PRIVILEGES; | ||
| EOF | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to mention here for the user to enter their created password from before, i.e., SecureRootPass123
| Extract the replication log file and position from the full.sql file: | ||
|
|
||
| ```bash | ||
| grep -i 'CHANGE MASTER' full.sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| grep -i 'CHANGE MASTER' full.sql | |
| grep -i 'CHANGE MASTER TO MASTER_LOG_FILE' full.sql |
Otherwise, I get so much text I have to scroll through it.
|
|
||
| ```bash | ||
| mysql -u root -p -e "SELECT * FROM testdb.t1;" | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mention what should be returned?
| server-id=1 | ||
| log_bin=mysql-bin | ||
| binlog_do_db=testdb | ||
| bind-address=0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mention that this isn't simply adding settings, some of them exist already and must be overwritten.
|
|
||
| **Important**: Use the same root password (`SecureRootPass123`) as configured on the primary server. | ||
|
|
||
| Edit the MySQL configuration file /etc/mysql/mysql.conf.d/mysqld.cnf to include these settings: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a code block as before with sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
| multipass transfer client-key.pem mysql-standby: | ||
| ``` | ||
|
|
||
| On the standby VM, move certificates to the SSL directory and set appropriate permissions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem Be more clear where
| multipass transfer client-cert.pem mysql-standby: | ||
| multipass transfer mysql-primary:client-key.pem . | ||
| multipass transfer client-key.pem mysql-standby: | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add an additional command to remove the certificates from the host? Just to be tidy and to not encourage users to leave their certificates lying around.
| On the standby VM, move certificates to the SSL directory and set appropriate permissions: | ||
|
|
||
| ```bash | ||
| # On mysql-standby, move certificates and set permissions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem Be more clear where
|
|
||
| ```bash | ||
| multipass transfer mysql-primary:full.sql . | ||
| multipass transfer full.sql mysql-standby: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem Clean up after ourselves
| -- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000002', MASTER_LOG_POS=157; | ||
| ``` | ||
|
|
||
| Finally, configure the standby as a replica by providing the primary's IP, replication user credentials, and the extracted master log file and position. **Use the values from the mysqldump file, not the current master status**: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replication user credentials
Its unclear what this is supposed to be.
This PR adds a new tutorial for setting up and working with AZ. It provides step-by-step guidance to help users get started quickly with AZs and work on a primary-replica setup across two VMs.
Additions
Notes