转载一片mongodb 迁移pg 数据库的文章

The Guardian migrated their CMS's datastore in 2018 from a self-managed MongoDBcluster to PostgreSQL on Amazon RDS for a fully managed solution. The team did an API-based migration without any downtime.

Guardian’s in-house CMS - called Composer - which stores articles, blog content, photo galleries and video was originally built on top of MongoDB as a datastore. This was preceded by a vendor software backed by an Oracle database. This setup had downtimes whenever the schema had to be migrated. As an alternative, the team looked at various NoSQL dbs, and one of the key reasons for choosing MongoDB seems to have been flexibility. Originally hosted on their own datacenter, they moved their MongoDB to their AWS servers after an outage. The installation and management scripts had to be handwritten by Guardian’s team. They opted for a support contract and bought the OpsManager tool, which is a frontend application for managing MongoDB. However, the team did not go for MongoDB's Atlas offering, which is a "fully managed database", for reasons which are unclear. OpsManager does not manage deployments.

After moving to AWS, the team faced two MongoDB outages. Some of them the reasons were basic system administration issues, like not allowing NTP to access time servers to keep clocks in sync. Others pertained to the difficulty of managing OpsManager itself and obtaining timely support from the vendor, according to the article. The team felt that moving to a solution which had minimal database management would suit them best.

The team chose PostgreSQL due to its maturity and support for the jsonb data type, as a hosted database on Amazon’s RDS. The jsonb type allows for indexing of fields inside the JSON object. The migration plan was to write a new API over Postgres and use a proxy that would send traffic to both APIs to keep them in sync for new, incoming data. The existing data would be migrated using the APIs, and then the proxy would switch to the new API. Their previous migration from Oracle was also done using a similar approach. The migration script logs were pushed to Elasticsearch so that the migration could be tracked. In the process, they also improved their structured logging.

The proxy directed all traffic to the MongoDB API in real time, and asynchronously to the Postgres API . Any difference in the responses was logged and analyzed. To ensure that the new API and backend can hold up to production traffic, GoReplay processes were run to generate traffic. GoReplay can capture traffic and replay it against a different environment - in this case, the pre-production one. A complete migration was done on the pre-production environment. The final step in the production migration was to switch the DNS name from the proxy's endpoint (an Amazon ELB) to the Postgres API (another ELB). This allowed their clients to function without any change. Post-migration, their integration tests failed as they had not been migrated to the new API.

Other organizations have moved from MongoDB to PostgreSQL for a variety of reasons.

The Guardian’s Migration from MongoDB to PostgreSQL on Amazon RDS的更多相关文章

  1. MongoDB与PostgresQL无责任初步测试

    PostgresQL一秒能插入多少条记录,MongoDB呢?读取的情况又如何?我写了一些简单的程序,得出了一些简单的数据,贴在这里分享,继续往下阅读前请注意下本文标题中的“无责任”,这表示此测试结果不 ...

  2. data type Migration from MySQL to PostgreSQL

    MySQL          PostgreSQL tinyint           smallint smallint          smallint mediumint      integ ...

  3. python脚本 mongodb到postgresql

    安装 mongo模块 pip install pymongo 安装postgresql 驱动 pip install python-psycopg2  1 # -*- coding: utf-8 -* ...

  4. 快速掌握Flyway

    什么是Flyway? Flyway is an open-source database migration tool. It strongly favors simplicity and conve ...

  5. Tungsten Replicator学习总结

    之前基于Tungsten Replicator实现了内部使用的分布式数据库的数据迁移工具,此文为当时调研Tungsten Replicator时的学习心得,创建于2015.7.22. 1 概述 1.1 ...

  6. Flyway Overview and Installation

    https://flywaydb.org/documentation/ Flyway is an open-source database migration tool. It strongly fa ...

  7. 快速掌握和使用Flyway

    什么是Flyway? 转载:https://blog.waterstrong.me/flyway-in-practice/ Flyway is an open-source database migr ...

  8. Flyway学习笔记

    Flyway做为database migration开源工具,功能上像是git.svn这种代码版本控制.google搜索database migration,或者针对性更强些搜索database mi ...

  9. NoSQL数据库介绍(2)

    2 NoSQL潮流      在这一章中,将一起讨论NoSQL潮流的动机和主要驱动力.以及NoSQL主张的批评和反馈.本章将通过不同的尝试得出结论来分类和描写叙述NoSQL数据库.当中一个分类法将在随 ...

随机推荐

  1. 实力封装:Unity打包AssetBundle(一)

    说明:这是一系列循序渐进的教程,今天先介绍最简单的AssetBundle打包方式. 这是一个由在Unity中需要加载模型而引发出来的一系列坑,为了填坑花了不少时间,如果有需要在Unity中自定义菜单, ...

  2. 【转】Delphi 10.3关于相机该注意的细节

    感谢移动信息化专家提供的方法,他的ChinaCock组件是相当的专业,感兴趣可以加入qq群223717588.

  3. 联想 Lenovo PWR-G60 无线掌中宝拆机

    从朋友那里弄了台Lenovo PWR-G60,现在已经停产了,淘宝上某店卖的国产WIFI Pineapple貌似就是拿这个刷的,打算出篇DIY教程 现在人在外地,编程器.热风枪.烙铁工具啥的都没有,更 ...

  4. Python 第一类对象

    def fn(): print("我叫fn") fn() print(fn) # <function fn at 0x0000000001D12E18> fn() gn ...

  5. Ubuntu 16.04安装vsftpd 并开启ftp服务

    1. 安装 sudo apt-get install vsftpd 2.可以使用下列命令来打开,关闭,重启ftp服务 sudo /etc/init.d/vsftpd start sudo /etc/i ...

  6. Eclipse_设置_01_自动提示

  7. oracle函数创建及调用

    创建函数的语法如下: CREATE [OR REPLACE] FUNCTION function_name[ (argment [ { IN | OUT | IN OUT } ] Type , arg ...

  8. ajax跨域(No 'Access-Control-Allow-Origin' header is present on the requested resource)

    问题 在某域名下使用Ajax向另一个域名下的页面请求数据,会遇到跨域问题.另一个域名必须在response中添加 Access-Control-Allow-Origin 的header,才能让前者成功 ...

  9. idea 新建一个java项目并运行

    这个只能算是个笔记,参考:参考文档 打开Idea,选择create new project,如图 或选择File ——> New——>Project... 出现以下界面,选中Java,然后 ...

  10. Java调用Lua脚本(热载实现)

    前言: Lua作为解析执行的脚本语言, 往往是易变逻辑编写的首选语言, 尤其是在游戏领域. C/C++和Lua的结合, 往往了标配. 比如Redis, Nginx其对Lua的支持, 也是杠杠的. 当然 ...