推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
veezzz
V2EX  ›  Python

Django dumpdata 内存溢出的问题

  •  
  •   veezzz · Aug 17, 2015 · 3696 views
    This topic created in 4060 days ago, the information mentioned may be changed or developed.
    使用 django 的 dumpdata 来做数据库的迁移,数据库大小有 3G 多, dump 过程中内存不断增加最后挂掉了,一开始用的 django1.6, 觉得是实现问题,看了 1.8 的源码,好像改成了迭代器一条条写入,可是最后还是内存溢出,请问有什么什么好的办法
    4 replies  •  2015-08-18 01:30:43 +08:00
    vicalloy
        1
    vicalloy  
       Aug 17, 2015
    别用 dumpdata 。
    虽然数据库部分用的是迭代器,但 json 部分在写入前还是全在内存中,内存肯定得暴。
    dumpdata 应当只是用来做小数据量的初始化工作,不是用来做数据迁移的。
    veezzz
        2
    veezzz  
    OP
       Aug 17, 2015
    @vicalloy 那 django 项目有好的数据库迁移方案么
    pc10201
        3
    pc10201  
       Aug 17, 2015
    @veezzz 直接用 mysql 原生的数据导入导出啊
    veezzz
        4
    veezzz  
    OP
       Aug 18, 2015
    @pc10201 迁移到 aws 的 rds 只能数据库连接,不能登录到服务器- -
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   940 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:54 · PVG 02:54 · LAX 11:54 · JFK 14:54
    ♥ Do have faith in what you're doing.