-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transfer documents to the specified directory
- Loading branch information
1 parent
45c1173
commit f6769e7
Showing
5 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Pre-Warming Data for a Newly Added MySQL Secondary Using TCPCopy | ||
|
||
Using TCPCopy to pre-warm data on a newly added MySQL secondary is quite practical. Many users have employed this method, especially for high-load replicas. Adding a cold secondary directly to the cluster can lead to numerous slow queries | ||
|
||
## Architecture Deployment Diagram | ||
|
||
Below is the deployment architecture diagram for pre-warming. It replicates read-only requests from MySQL secondary one to MySQL secondary two to achieve the pre-warming effect. | ||
|
||
![](C:\Users\86185\AppData\Roaming\marktext\images\2024-10-27-21-14-11-1730034836403.png) | ||
|
||
## Deploying TCPCopy | ||
|
||
### Installing `tcpcopy` | ||
|
||
``` | ||
git clone https://github.com/session-replay-tools/tcpcopy.git | ||
cd tcpcopy | ||
./configure --set-protocol-module=mysql-replay-module | ||
make && make install | ||
``` | ||
|
||
By default, it is installed in `/usr/local/tcpcopy/`. | ||
|
||
Modify `/usr/local/tcpcopy/conf/plugin.conf` and include the database username and password that will be used for future pre-warming. | ||
|
||
``` | ||
user test@123; | ||
user app_user@456; | ||
``` | ||
|
||
### Install `intercept` on the Assistant Server. | ||
|
||
``` | ||
git clone https://github.com/session-replay-tools/intercept.git | ||
cd intercept | ||
./configure --with-resp-payload | ||
make && make install | ||
``` | ||
|
||
By default, it is installed in `/usr/local/intercept/`. | ||
|
||
## Running TCPCopy | ||
|
||
We assume that all MySQL nodes use port 3306. The client IP addresses accessing the online secondary server fall within the 192.168.0.0 subnet. The online secondary server is at 192.168.2.3, the target server is at 192.168.2.4, and the assistant server is at 192.168.2.5, as shown in the diagram below.: | ||
|
||
![](C:\Users\86185\AppData\Roaming\marktext\images\2024-10-27-22-10-46-1730038231179.png) | ||
|
||
### Routing Setup on the MySQL Secondary Two | ||
|
||
``` | ||
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.2.5 | ||
``` | ||
|
||
### Run `intercept` on the Assistant Server | ||
|
||
``` | ||
./intercept -i eth0 -F 'tcp and src port 3306' -d | ||
``` | ||
|
||
### Run `tcpcopy` on the MySQL Secondary one | ||
|
||
``` | ||
./tcpcopy -x 3306-192.168.2.4:3306 -s 192.168.2.5 | ||
``` | ||
|
||
With all deployments completed, you can proceed with the pre-warming operation as expected. | ||
|
||
## Note | ||
|
||
1. User Accounts and Privileges: Both MySQL instances on the target and online servers must have identical user accounts and privileges, though passwords can differ. | ||
2. Session Replay: Only complete sessions can be replayed. | ||
3. OpenSSL Support: OpenSSL 1.1.0+ is not currently supported. | ||
4. Password Plugin Compatibility: MySQL 8.0’s caching_sha2_password is not supported. To test MySQL 8.0 using MySQL 5.7 production flows, use mysql_native_password and ensure that all users involved in the test are configured with the mysql_native_password plugin. | ||
5. For additional assistance, visit [tcpcopy](https://github.com/session-replay-tools/tcpcopy). |
File renamed without changes.