tcpcopy+ intercept These two analog traffic forwarding is simple.
However, when you want to implement a mysql-replay-module module, it fails. (I think about it now, it's not practical in our present scenario, but it's better to be professional.) )
Https://github.com/session-replay-tools/mysql-replay-module
Https://github.com/session-replay-tools/tcpcopy
Installing =================================
One, install intercept on the assistant server:
- git clone git://github.com/session-replay-tools/intercept.git
- CD Intercept
- ./configure--with-resp-payload
- Make
- Make install
Two, install tcpcopy on the online server:
- git clone git://github.com/session-replay-tools/tcpcopy.git
- CD tcpcopy
- git clone git://github.com/session-replay-tools/mysql-replay-module.git
- ./configure--set-protocol-module=mysql-replay-module
- Make
- Make install
Configure ====================================
One, configure the route on target server:
For example: Assume 10.110.12.18 is the IP address of the assistant server and 10.110.12.15 is the MySQL client IP address. We set the following route command to route all responses to the 10.110.12.15 to the assistant server. route add -host 10.110.12.15 gw 10.110.12.18
Two, configure port filtering on the assistant server:
For example: ./intercept -i eth0 -F ‘tcp and src port 3306‘ -d intercept will capture response packets of the TCP based application which
Three, start tcpcopy on the online server:
a) set user password pair in conf/plugin.conf in the installion directory Format: user [email protected],[email protected],...,[email protected]; For example: user [email protected]; b) start tcpcopy ./tcpcopy -x localServerPort-targetServerIP:targetServerPort -s <intercept server,> For example(assume 10.110.12.17 is the IP address of the target server): ./tcpcopy -x 3306-10.110.12.17:3306 -s 10.110.12.18 tcpcopy would capture MySQL packets(assume MySQL listens on 3306 port) on current server, do the necessary modifications and send these packets to the target port ‘3306‘ on ‘10.110.12.17‘(the target MySQL), and connect 10.110.12.18 for asking intercept to pass response packets to it.
最后,一份转两份,真实服务器上有,测试服务器上也有流量。用过压力或冒烟测试,蛮好的。
Play tcpcopy+ Intercept+mysql-replay-module (unsuccessful)