Close

2023-10-21

Bye-bye Mongo, Hello Postgres

Bye-bye Mongo, Hello Postgres

Author: Philip McMahon

In April, the Guardian significantly shifted its content management system (CMS) by migrating from MongoDB to PostgreSQL on Amazon RDS. The Guardian’s CMS tool, Composer, which produces most of its content, was previously backed by a MongoDB database on AWS. This database held about 2.3 million content items and was the primary source of truth for all Guardian content published online.

The migration was prompted by several challenges faced with MongoDB, especially after moving to AWS. Issues included the complexity of setting up MongoDB on AWS, two significant outages, and the inefficiencies of OpsManager, MongoDB’s database management software. The Guardian also faced challenges with the hefty annual fee for OpsManager and the MongoDB support contract.

After considering Amazon’s DynamoDB and waiting for its encryption-at-rest feature, the Guardian eventually chose PostgreSQL on AWS RDS. While PostgreSQL isn’t a traditional document store, it offers a JSONB column type, which allowed the Guardian to migrate with minimal changes to their data model. The migration process involved creating a new API, using a proxy to send traffic to both old and new databases, and then migrating records. The entire process was carefully executed to ensure minimal disruption to the CMS users.

The migration was successful, and the Guardian now benefits from the robustness and flexibility of PostgreSQL, leaving behind the challenges faced with MongoDB.

The post is “Bye-bye Mongo, Hello Postgres.