python - Getting a database dump from a remote server without an intermediary file
问题描述
I want to write a script in python that will knock on a remote server, dump the database for me locally and automatically deploy the dump on my system.
I found an interesting script that shows how to download a dump to a local machine, but I don't like that it makes a dump on the server, downloads, and then deletes it on the server. Previously, I used SH crypts and could download the dump directly to my pc like this:
currentDate=$(date +%Y-%m-%d_%H-%M)
ssh blabla@###.###.###.### -p ### "mysqldump -v --insert-ignore --skip-lock-tables --single-transaction=TRUE -u emoteDbUser -premoteDbPass remoteDbName" > /var/www/html/PROJECTNAME$currentDate.sql
Tell me please, can I achieve the same effect through python using this script as an example?https://github.com/sakibiqbal/ssh-mysql-dump/blob/master/mysql-remote-dump.py
解决方案
推荐阅读
- azure-devops - Azure DevOps - 组织项目和存储库
- node.js - 当“selfHandleResponse”为真时,如何传递代理响应?
- c# - c#获取对象的自定义事件列表
- c# - 有没有办法使用 msmq 触发器执行我的 wpf 应用程序?
- c++ - 替代使用命名空间作为模板参数
- regex - Sublime Text - 将文本转换为 JSON 格式
- swift - 运行路径搜索路径原因:无法加载捆绑包“MySecondFramework”,因为它已损坏或缺少必要的资源
- ios - 如何为 iOS 指定特定的模拟器?
- reactjs - 对象 Reactjs 中的数组中的换行符
- r - 为什么“foreach”在并行运行时不导出到我的可变对象?