前言

因项目需要,整理下mysql迁移postgresql的常用工具搜集

1、迁移工具

开发的pgloader是一个mysql迁移到pg的工具,性能和表现都良好,开发和测试环境迁移已经验正,github地址: https://github.com/dimitri/pgloader

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
LOAD DATABASE
 FROM mysql://admin1:***@10.10.214.205:3306/t230530_B
 INTO pgsql://admin:***@10.10.216.108:5432/B


WITH
     include drop, create tables, no truncate, create indexes, reset sequences, foreign keys
 CAST type datetime to timestamp
     drop default drop not null using zero-dates-to-null,
     type date drop not null drop default using zero-dates-to-null

 ALTER SCHEMA 't230530_B' RENAME TO 'public'

SET PostgreSQL PARAMETERS
    maintenance_work_mem to '1GB',
    work_mem to '1GB'

SET MySQL PARAMETERS
    net_read_timeout  = '600',
    net_write_timeout = '600'

执行迁移,观察日志没有报错正常结束即可

……

阅读全文