/
How to Externalise PostgreSQL

How to Externalise PostgreSQL

Please follow the guide below to externalise PostgreSQL through MCS.

What we use from AWS

Amazon RDS - Managed relational database service.

Get the PostgreSQL version from MCS

Use the below commands to get the version of PostgreSQL.

mcs@mcs:~/MCS$ docker ps | grep post 5aae76093218 registry.tagvs.com/mcs_postgres:latest "/docker-entrypoint.…" About an hour ago Up About an hour 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp mcs-postgres-1 mcs@mcs:~/MCS$ docker exec 5aae76093218 postgres --version postgres (PostgreSQL) 14.1 (Debian 14.1-1.pgdg110+1)

Create a PostgreSQL database with AWS RDS

Step 1 - Navigate to Amazon RDS → Databases.

Step 2 - Create a database.

Choose the latest available version available on AWS RDS (currently 14.11-R2 is the latest).

Follow the on screen instructions as shown below.

 

 

Step 3 - Wait until database is created.

DB instance identifier: mnm-mcs-postgres

Engine: 14.11-R2

Availability and durability: Multi-AZ DB instance

Master username: postgres

Master password: postgres

Instance configuration: db.t4g.micro ($0.035 per hour)

Allocated storage: 20 (Autoscaling)

Please check Security Groups configuration related to mnm-MCS-postgres

Move MCS database to AWS RDS

Make MCS database backup

Our backup name: 230713_115357_110-rc14-23062101_backup

Download backup just in case to local drive.

Move database to AWS RDS

Step 1 – Navigate to MCS Terminal

  • MCS folder ./run.sh

  • Select run-debug in ./run.sh menu and select (5) run-debug (pg_admin)

MCS operation: 1) start 2) stop 3) logs 4) update 5) run-debug 6) run-kibana 7) setup 8) admin-password-reset 9) exit #? 5

Step 2 - Connect to pg_admin

Open in web browser: http://<MCS_IP>:1234/

Step 3 - Add new server (local MCS database)

  • General:

    • Name: mcs

  • Connection:

    • Host: postgres

    • Maintenance database: mcs_configuration

    • Username: postgres

    • Password: postgress

Step 4 - Add new server (AWS RDS)

  • General:

    • Name: rds

  • Connection:

    • Host: mnm-mcs-postgres.cknefvziywmj.eu-west-1.rds.amazonaws.com

    • Maintenance database: postgres

    • Username: postgres

    • Password: postgress

Step 5 - Backup local MCS database

Select database and make backup.

Step 6 - Create new database in AWS RDS

  • Database: mcs_configuration

  • Owner: postgres

Step 7 - Restore backup to AWS RDS

Select database and make restore.

Make changes in the MCS configuration

Step 1 - Edit the .env file and change POSTGRES_HOST variable

###postgres POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres POSTGRES_HOST=mnm-mcs-postgres.cknefvziywmj.eu-west-1.rds.amazonaws.com POSTGRES_PORT=5432 POSTGRES_DB=mcs_configuration PG_DATA_PATH="./postgres/data" PG_MEM_LIMIT=2g

Step 2 - Edit the docker-compose.yml file and make sure that manager does not depend on postgres anymore.

Step 3 - Edit the docker-compose.yml file and postgres configuration. This is not required anymore.

Step 4 - Restart MCS

Related content

Video Bridge - MCS
Video Bridge - MCS
Read with this
How Externalise OpenSearch
How Externalise OpenSearch
Read with this
How to Configure Logstash
How to Configure Logstash
Read with this
How to Create a New User with a Specific Role
How to Create a New User with a Specific Role
Read with this
How to change MCS Certificates
How to change MCS Certificates
Read with this
How to Backup and Restore
How to Backup and Restore
Read with this