DataX实现Gauss300->ADB PG(前一天数据)增量迁移

1、提前准备源Gauss300、目标 ADB PG数据库连接信息。

bash 复制代码
psql -hx.x.x.x -p25308 -Utest1 -ddb_name
xxxxxx

psql -hx.x.x.x -p3432 -Utest1 -ddb_name
xxxxxx

2、编写迁移脚本,并执行迁移。

bash 复制代码
#!/bin/bash
file_name=1.json
today_data=`date "+%Y-%m-%d 00:00:00"`
yesterday_data=`date -d "1 days ago" "+%Y-%m-%d 00:00:00"`
cat > $file_name << EOF
{
    "job": {
        "setting": {
            "speed": {
                 "channel": 2
            },
                "errorLimit": {
                "record": 0,
                "percentage": 0.02
            }
        },
        "content": [
            {
                "reader": {
                    "name": "gaussdbreader",
                    "parameter": {
                        "username": "xxxxxx",
                        "password": "xxxxxx",
                        "column": [
                            '*'
                        ],
                        "connection": [
                            {
                                "querySql": [
                                    "select * from table_name where load_time >= '$yesterday_data' and load_time < '$today_data';"
                                ],
                                "jdbcUrl": [
                                        "jdbc:opengauss://x.x.x.x/db_name"
                                ]
                            }
                        ]
                    }
                },
                "writer": {
                    "name": "postgresqlwriter",
                    "parameter": {
                        "username": "xxxxxx",
                        "password": "xxxxxx",
                        "column": [
                                "*"
                        ],
                        "connection": [{
                                "jdbcUrl": "jdbc:postgresql://x.x.x.x:3432/db_name",
                                 "table": [
                                 "table_name"
                                ]
                        }]
                    }
                }
        }
        ]
    }
}
EOF
nohup python /data/datax/datax/bin/datax.py /data/shell/qianyi/$file_name > /data/shell/qianyi/$file_name.log 2>&1 &
相关推荐
海盗12341 天前
MySQL主从复制的配置方式
android·mysql·adb
cypking2 天前
三、NestJS 开发实战文档-->集成 MySQL(TypeORM)
前端·数据库·mysql·adb·node.js
小韩博3 天前
小迪之盲注第44课
android·网络安全·adb
s_daqing3 天前
adb卸载手机app
adb·智能手机
NineData3 天前
如何通过 NineData 将 Oracle 不停机迁移到 GaussDB
数据库·oracle·gaussdb·数据库管理工具·ninedata·数据库迁移·迁移工具
半壶清水4 天前
ubuntu中mysql升级指南
mysql·ubuntu·adb
TG:@yunlaoda360 云老大5 天前
华为云国际站代理商如何配置GaussDB的读写分离权重?
服务器·华为云·gaussdb
TG:@yunlaoda360 云老大5 天前
华为云国际站代理商GaussDB主要有什么作用呢?
服务器·数据库·华为云·gaussdb
Austindatabases5 天前
OceanBase SeekDB SQL优化案例---MySQL在客户端会没有市场的
数据库·sql·mysql·adb·oceanbase
gjc5925 天前
MySQL全实例备份脚本 (用于从库部署)
mysql·adb