Use SSH tunnel

Cooperation sector of redis clusters, kafka cluster, restrictions: no vpn, can be connected only by a particular springboard machine (no root access) Debugging development.

Want to achieve: connect it redis local development clusters, kafka cluster development and debugging, otherwise, they can change the code once again play package upload, well-known "Java code farmers leave ide (a) would not have written code."

Project profiles can fill only a portion of redis cluster node, other nodes automatically discover, but for running up the project, the actual or to connect to other nodes, so this can really requires a local connection on all nodes (program automatic discovery ip: port that is not directly accessible to its offer of ip: port).

Consider all the ip: port combination is different, that does not appear 192.168.1.2:6379, 192.168.1.3:6379 this ip different port of the same situation.

Assume springboard machine is [email protected]: 2222
Redis Cluster:
192.168.9.1:6379
192.168.9.1:6380
192.168.9.1:6381
192.168.9.2:6479
192.168.9.2:6480
192.168.9.2:6481

Dismantling tasks:
1. To the native (or other controllable master) of all the ip redis binding, kafka empathy;
2. All redis port mapped to the corresponding listening port, kafka empathy.

Specific operations:
1. cmd -> information ipconfig / ALL native recording current ip address, subnet mask, default gateway, DNS servers.

Fill in the content record red line below "Use the following IP address"

Configure multiple ip

Fill the arrow all the way to the ip redis clusters are added on to

At this view cmd ipconfig / all

More than the corresponding redis cluster ip, and can ping the

Ip to configure such a success

2. Map port

ssh -L 192.168.9.1:6179:192.168.9.1:6179 \
    -L 192.168.9.1:6180:192.168.9.1:6180 \
    -L 192.168.9.1:6181:192.168.9.1:6181 \
    -L 192.168.9.2:6279:192.168.9.2:6279 \
    -L 192.168.9.2:6280:192.168.9.2:6280 \
    -L 192.168.9.2:6281:192.168.9.2:6281 \
-Nf [email protected] -p 2222

Do not worry this is a problem how * unix command executed on the windows, use git bash it.

Use man ssh did little to see what is next

-L 绑定地址端口 本地ip:本地port:目的ip:目的port
-N 不要执行远程命令,仅作端口转发
-f 后台执行

Completed, 192.168.9.1 and 192.168.9.2 will now access the remote connection and 192.168.9.2 192.168.9.1 springboard machine (192.168.1.2).

Finally, if there is a difference 192.168.9.1:6379 and 192.168.9.2:6379 this ip, the same port the case, consider starting a virtual machine to a virtual machine configuration in accordance with the above, of course, the virtual machine is to use windows or * unix to see which familiar a.

Guess you like

Origin www.cnblogs.com/lixifun/p/11823743.html