问题
Server setup (fake IPs)
- utility - 1.1.1.1 - SSH access on public IP
- database2 - 1.1.1.2 - SSH access on private IP from utility
On a semi-regular basis I need to do a mysqldump on database2 and pull that down to my local machine so I can debug our app with real data. My current process is as follows:
- ssh into utility
- ssh into database2
- execute mysqldump command
- exit from database2
- scp dump file down to utility
- exit utility
- scp dump file down to local machine
Needless to say this is not optimal. Is there a quicker method, possibly via tunneling, that I could use given my setup?
回答1:
you can
- make dump by cron on database2
- make port forward on utility and connect at once to database2
summary: you will get dump by one scp command.
UPD:
if you can't port forward or cron, you can add access to database from utility and make mysqldump from him.
来源:https://stackoverflow.com/questions/10322352/i-would-like-to-simplify-ssh-tunneling-to-do-a-mysql-dump-and-scp-the-file-to-lo