Skip to content

Commit

Permalink
Transfer documents to the specified directory
Browse files Browse the repository at this point in the history
  • Loading branch information
wangbin579 committed Oct 27, 2024
1 parent 45c1173 commit f6769e7
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ TCPCopy is a TCP stream replay tool for realistic testing of Internet server app

## Getting to Know TCPCopy

[An Overview of TCPCopy for Beginners](Beginners.md)
[An Overview of TCPCopy for Beginners](doc/Beginners.md)

[A General Overview of TCPCopy Architecture](Architecture.md)
[A General Overview of TCPCopy Architecture](doc/Architecture.md)

[TCPCopy Examples](Usage.md)
[TCPCopy Testing Use Cases](doc/Usage.md)

[TCPCopy Pre-Warming Examples](doc/Pre-Warming.md)

## Description

Expand Down
File renamed without changes.
File renamed without changes.
74 changes: 74 additions & 0 deletions doc/Pre-Warming.md
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.

0 comments on commit f6769e7

Please sign in to comment.