如何通过折叠轨道迁移来迁移生产数据
将旧数据放入新数据库结构的潜在策略是什么?我们正在考虑的一种策略是编写一些 ruby,它在每个表的基础上执行一些 sql。
What would be potential strategies to getting the old data into a new db structure? One strategy we are thinking of is to write some ruby which executes some sql on a per table basis.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于这是一项一次性任务(我在这里先入为主),您可能希望拥有两个数据库,一个是旧的,一个是通过新迁移创建的新数据库。并编写一个 ruby 脚本来根据需要将数据从旧数据库复制到新数据库。
它将有助于保留旧数据库,从而减少与创建新数据库和从转储中重新导入数据相关的停机时间。您可以使用旧代码,直到数据迁移完毕,一旦数据迁移到新数据库完成,请更新代码并重新启动服务器。瞧!大量数据迁移,无需停机! :)
总结一下我的建议:
Since this is a one time task(I am preconceiving things here), you might want to have two databases, one old and one created new, from fresh migration. And write a ruby script to copy data as you want from old to new database.
It will help retain the old database and hence the downtime associated with creating new db and reimporting data from dump. You can use your old code until data is migrated and as soon as data migration to new db completes, update the code and restart the server. Voila! whole lot of data migration with no down time! :)
To summarize what I am suggesting: