Django:使用pgloader停顿将mysql迁移到postgres

时间:2018-11-02 20:04:35

标签: mysql django postgresql pgloader

我正在将Django db从mysql迁移到postgres。我一直在跟here找到的指南一起使用,但是在将数据从旧数据库移到新数据库时遇到了麻烦。我正在使用脚本来执行此操作:

LOAD DATABASE
    FROM mysql://mysql_username:mysql_password@localhost/mysql_dbname
    INTO postgresql:///myproject
    WITH truncate, data only, disable triggers, preserve index names, include no drop, reset sequences
    ALTER SCHEMA 'mysql_dbname' RENAME TO 'public'
;

我使用pgloader运行脚本,它运行了一段时间并停止。输出如下:

[...]
2018-11-02T19:59:30.832000Z NOTICE COPY public.auth_group
2018-11-02T19:59:30.832000Z NOTICE COPY public.auth_group_permissions
2018-11-02T19:59:30.832000Z NOTICE COPY public.auth_permission
2018-11-02T19:59:30.832000Z NOTICE COPY public.auth_user
2018-11-02T19:59:30.832000Z NOTICE COPY public.auth_user_groups
2018-11-02T19:59:30.832000Z NOTICE COPY public.auth_user_user_permissions
2018-11-02T19:59:30.832000Z NOTICE COPY public.django_admin_log
2018-11-02T19:59:30.832000Z NOTICE COPY public.django_content_type
2018-11-02T19:59:30.833000Z NOTICE COPY public.django_migrations
2018-11-02T19:59:30.833000Z NOTICE COPY public.django_session
2018-11-02T19:59:30.833000Z NOTICE COPY public.scoutapp_field
2018-11-02T19:59:30.833000Z NOTICE COPY public.scoutapp_labelledata
2018-11-02T19:59:30.833000Z NOTICE COPY public.scoutapp_labellefieldorder
2018-11-02T19:59:30.833000Z NOTICE COPY public.scoutapp_leafsamplefields
2018-11-02T19:59:30.833000Z NOTICE COPY public.scoutapp_leafsamples
2018-11-02T19:59:30.833000Z NOTICE COPY public.scoutapp_leafsufficiency
2018-11-02T19:59:30.833000Z NOTICE COPY public.scoutapp_rustmitefields
2018-11-02T19:59:30.833000Z NOTICE COPY public.scoutapp_rustmites
2018-11-02T19:59:30.833000Z NOTICE COPY public.scoutapp_scoutingareas
2018-11-02T19:59:30.834000Z NOTICE COPY public.scoutapp_sensorlocations
2018-11-02T19:59:30.834000Z NOTICE COPY public.scoutapp_soilmoisturedata
2018-11-02T19:59:30.834000Z NOTICE COPY public.scoutapp_spraytrials

debugger invoked on a CL-POSTGRES::PROTOCOL-ERROR in thread
#<THREAD "lparallel" RUNNING {1006AC6013}>:
  PostgreSQL protocol error: Unexpected message received: Z

debugger invoked on a CL-POSTGRES::PROTOCOL-ERROR in thread
#<THREAD "lparallel" RUNNING {1006AC6A13}>:
  PostgreSQL protocol error: Unexpected message received: Z

debugger invoked on a CL-POSTGRES::PROTOCOL-ERROR in thread
#<THREAD "lparallel" RUNNING {1006AC6513}>:
  PostgreSQL protocol error: Unexpected message received: Z

debugger invoked on a CL-POSTGRES::PROTOCOL-ERROR in thread
#<THREAD "lparallel" RUNNING {1006AC6F13}>:
  PostgreSQL protocol error: Unexpected message received: Z

然后停顿,没有任何反应。我还尝试使用--debug --verbose运行并得到:

[...]
2018-11-02T19:37:34.948000Z SQL ALTER TABLE scoutapp_leafsamples ENABLE TRIGGER ALL;
2018-11-02T19:37:34.948000Z DEBUG  stop public.scoutapp_leafsamples   | 848 .. 1880 = 1.032d0
2018-11-02T19:37:34.948000Z DEBUG Writer[3] for public.scoutapp_leafsamples is done in 0.001000s
2018-11-02T19:37:34.948000Z INFO COPY ON ERROR STOP
2018-11-02T19:37:34.948000Z DEBUG Finished processing WRITER for "public.scoutapp_leafsamples"  0.001000s
2018-11-02T19:37:34.948000Z DEBUG writers-counts[public.scoutapp_leafsamples] = 0
2018-11-02T19:37:34.948000Z DEBUG CONNECTED TO #<PGLOADER.PGSQL:PGSQL-CONNECTION pgsql://Ryan@UNIX:5432/reporting {1014219DF3}>
2018-11-02T19:37:34.948000Z DEBUG SET client_encoding TO 'utf8'
2018-11-02T19:37:34.948000Z DEBUG SET application_name TO 'pgloader'
2018-11-02T19:37:34.948000Z SQL SET search_path TO public;
2018-11-02T19:37:34.948000Z SQL ALTER TABLE scoutapp_rustmitefields DISABLE TRIGGER ALL;
2018-11-02T19:37:34.949000Z INFO pgsql:copy-rows-from-queue[3]: public.scoutapp_rustmitefields (id field_name
                                                               variety location
                                                               acres)
2018-11-02T19:37:34.949000Z SQL ALTER TABLE scoutapp_rustmitefields ENABLE TRIGGER ALL;
2018-11-02T19:37:34.949000Z DEBUG  stop public.scoutapp_rustmitefields   | 853 .. 1899 = 1.046d0
2018-11-02T19:37:34.949000Z DEBUG Writer[3] for public.scoutapp_rustmitefields is done in 0.000000s
2018-11-02T19:37:34.949000Z INFO COPY ON ERROR STOP
2018-11-02T19:37:34.949000Z DEBUG Finished processing WRITER for "public.scoutapp_rustmitefields"  0.000000s
2018-11-02T19:37:34.949000Z DEBUG writers-counts[public.scoutapp_rustmitefields] = 0
2018-11-02T19:37:34.949000Z DEBUG CONNECTED TO #<PGLOADER.PGSQL:PGSQL-CONNECTION pgsql://Ryan@UNIX:5432/reporting {100B030333}>
2018-11-02T19:37:34.949000Z DEBUG SET client_encoding TO 'utf8'
2018-11-02T19:37:34.949000Z DEBUG SET application_name TO 'pgloader'
2018-11-02T19:37:34.949000Z SQL SET search_path TO public;
2018-11-02T19:37:34.950000Z SQL ALTER TABLE scoutapp_scoutingareas DISABLE TRIGGER ALL;
2018-11-02T19:37:34.950000Z INFO pgsql:copy-rows-from-queue[3]: public.scoutapp_scoutingareas (id location
                                                              scouteditem)
2018-11-02T19:37:34.950000Z SQL ALTER TABLE scoutapp_scoutingareas ENABLE TRIGGER ALL;

再一次,它似乎停滞了。有谁知道错误可能是什么?我能够通过类似的问题here寻找其他人,但到目前为止我还没有运气。

0 个答案:

没有答案