数据迁移上云优化之 - 带宽压缩加速

本文涉及的产品
云原生数据库 PolarDB 分布式版,标准版 2核8GB
RDS PostgreSQL Serverless,0.5-4RCU 50GB 3个月
推荐场景:
对影评进行热评分析
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
简介:

现在云已经是一个趋势毋庸置疑,但是怎样在有限的时间内把数据弄上云端是个需要考虑的问题。
如果能增量复制,整个时间窗口可以不需要太关注,因为切换的时间窗口比较短。
但是如果是全量迁移,或者增量迁移前的全量迁移,则需要考虑时间窗口。
一般来说,从线下到线上,网络带宽都比较低,这个我在以前把香港机房的数据迁移到国内机房时深有同感,速度之慢难以忍受。
下面是一套加速方案:
1
2
3
4
5
6
下面是一个例子:
首先在本地服务器建立远程数据库服务器隧道 :

ssh -C -L 6666:127.0.0.1:1921 postgres@remote_ip  

在另外一个本地的Shell里面执行如下命令,备份远程数据库的数据到本地:

postgres@db-172-16-3-33-> date +%F%T;psql -h 127.0.0.1 -p 6666 -U postgres db_remote -c "copy schema.tbl_log to stdout" >./tbl_log.dmp;date +%F%T  
2011-06-2717:16:50  
2011-06-2717:17:08  

耗时18秒

不走隧道的话

postgres@db-172-16-3-33-> date +%F%T;psql -h remote_ip -p 1921 -U schema db_remote -c "copy schema.tbl_log to stdout" >./tbl_log2.dmp;date +%F%T  
2011-06-2717:20:06  
2011-06-2717:22:29  

耗时143秒

速度提升非常惊人.

参考:

man ssh
     -L [bind_address:]port:host:hostport  
             Specifies that the given port on the local (client) host is to be forwarded to the given host and port on  
             the remote side.  This works by allocating a socket to listen to port on the local side, optionally bound  
             to the specified bind_address.  Whenever a connection is made to this port, the connection is forwarded  
             over the secure channel, and a connection is made to host port hostport from the remote machine.  Port  
             forwardings can also be specified in the configuration file.  IPv6 addresses can be specified with an  
             alternative syntax: [bind_address/]port/host/hostport or by enclosing the address in square brackets.  
             Only the superuser can forward privileged ports.  By default, the local port is bound in accordance with  
             the GatewayPorts setting.  However, an explicit bind_address may be used to bind the connection to a spe-  
             cific address.  The bind_address of “localhost” indicates that the listening port be bound for local use  
             only, while an empty address or ‘*’ indicates that the port should be available from all interfaces.  
  
     -C      Requests compression of all data (including stdin, stdout, stderr, and data for forwarded X11 and TCP  
             connections).  The compression algorithm is the same used by gzip(1), and the “level” can be controlled  
             by the CompressionLevel option for protocol version 1.  Compression is desirable on modem lines and other  
             slow connections, but will only slow down things on fast networks.  The default value can be set on a  
             host-by-host basis in the configuration files; see the Compression option.  
目录
相关文章
|
存储 安全 数据库
|
存储 内存技术
USB的VID,PID
USB的VID,PID
424 0
|
负载均衡 安全 Java
深入了解Spring Cloud Gateway:构建高效微服务网关
Spring Cloud Gateway是一个强大的微服务网关,它在现代分布式架构中扮演着至关重要的角色。本文将深入介绍Spring Cloud Gateway的核心概念、功能和用途,以帮助您更好地理解和利用这一工具来构建高效的微服务应用。
|
8月前
|
机器学习/深度学习 人工智能 测试技术
Qwen2.5-Max 发布,探索大规模 MoE 模型的智能
Qwen2.5-Max 发布,探索大规模 MoE 模型的智能
|
11月前
|
数据采集 自然语言处理 数据库
深入体验阿里云通义灵码:测试与实例展示
阿里云通义灵码是一款强大的代码生成工具,支持自然语言描述需求,快速生成高质量代码。它在测试、代码质量和用户体验方面表现出色,能够高效地生成 Python 和 Java 等语言的代码,助力开发者提升开发效率和代码质量。无论是新手还是资深开发者,都能从中受益匪浅。
深入体验阿里云通义灵码:测试与实例展示
|
12月前
|
运维 监控 持续交付
运维之道:从新手到高手的蜕变之路
【10月更文挑战第14天】 在当今这个数字化时代,运维作为保障系统稳定运行的重要岗位,其重要性不言而喻。本文将带你走进运维的世界,探索从一名运维新手成长为行业高手的过程。我们将一起了解运维的基本职责、面临的挑战以及必备的技能和知识。通过实际案例分析,揭示如何在实践中不断提升自己的能力,最终实现职业生涯的飞跃。无论你是即将踏入这个行业的新人,还是已经在行业中摸爬滚打多年的老手,相信本文都能为你提供一些有价值的启示和指导。
224 2
|
12月前
|
机器学习/深度学习 人工智能 数据可视化
【AI大模型】深入Transformer架构:编码器部分的实现与解析(上)
【AI大模型】深入Transformer架构:编码器部分的实现与解析(上)
|
编解码
荔枝派Zero(全志V3S)开启mplayer,播放音视频
mplayer 是一款开源的多媒体播放器,可以用来播放音视频, mplayer 自带多种格式的解码器,不需要我们再另外安装。本文介绍如何在 荔枝派上移植 mplayer 播放器,基于音频驱动实验。
512 0
递推 4----7-4 sdut-C语言实验-马拦过河卒
递推 4----7-4 sdut-C语言实验-马拦过河卒
201 0
|
移动开发 JavaScript 小程序
uView Subsection 分段器
uView Subsection 分段器
265 0