玩玩TCPCOPY+ intercept+mysql-replay-module(未成功)
TCPCOPY+ intercept这两个模拟流量转发倒简单。
但,想实现一个mysql-replay-module模块时,失败了。(我现在仔细想想,这个方案,在我们现在的场景里,实用性不大,但弄好点专业些。)
https://github.com/session-replay-tools/mysql-replay-module
https://github.com/session-replay-tools/tcpcopy
安装=================================
一,在assistant server上安装intercept:
- git clone git://github.com/session-replay-tools/intercept.git
- cd intercept
- ./configure --with-resp-payload
- make
- make install
二,在ONLINE SERVER上安装TCPCOPY:
- 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
配置====================================
一,在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
二,在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
listens on port 3306 from device eth0
三,在ONLINE SERVER上启动TCPCOPY:
a) set user password pair in conf/plugin.conf in the installion directory
Format:
user user1@password1,user2@password2,...,userN@passwordN;
For example:
user root@123456;
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.
最后,一份转两份,真实服务器上有,测试服务器上也有流量。用过压力或冒烟测试,蛮好的。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。