I would like to simplify SSH Tunneling to do a MySQL Dump and SCP the file to local machine

只谈情不闲聊 提交于 2019-12-11 08:59:04

问题


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

  1. make dump by cron on database2
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!