DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Database Query Service With OpenAI and PostgreSQL in .NET
  • PostgreSQL 12 End of Life: What to Know and How to Prepare
  • Understanding Leaderless Replication for Distributed Data
  • Formulating a Robust Strategy for Storage in Amazon Relational Database Service PostgreSQL Deployments

Trending

  • A Simple, Convenience Package for the Azure Cosmos DB Go SDK
  • The Role of Functional Programming in Modern Software Development
  • Teradata Performance and Skew Prevention Tips
  • Understanding Java Signals
  1. DZone
  2. Data Engineering
  3. Databases
  4. Asynchronous Master-Slave Replication of PostgreSQL Databases in One Click

Asynchronous Master-Slave Replication of PostgreSQL Databases in One Click

Replicating your data has obvious benefits, but can be a bit tedious to setup. Take a look at how to easily set it up using PostgreSQL and Jelastic's cloud.

By 
Tetiana Markova user avatar
Tetiana Markova
·
May. 26, 17 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
9.7K Views

Join the DZone community and get the full member experience.

Join For Free

as a critical component for most applications, data has to be available for end users in a dynamically changing environment. storing data in one location is a subject to risk in case of a system failure. therefore, you need to come up with a strategy on how to ensure high availability — and one of the solutions is to maintain the data on multiple synchronized servers.

having your data replicated to another database can be very helpful for a variety of reasons, such as improving performance, running backup services, analyzing information, and by all means alleviating system failures.

among numerous database clustering solutions , jelastic provides the postgresql package with master-slave asynchronous replication that can be installed automatically and run with no additional configurations required.

now let’s take a quick look at the package specs and follow the step-by-step installation guide.

the presented postgresql replication solution for one-click installation is based on jelastic certified postgresql 9.5.5 template. by default, it deploys two database containers (one per role: master and slave) with asynchronous replication between them.

the primary (master) server runs active database which handles read-write operations, whilst the standby (slave) server operates with this db copy and handles read-only operations. therefore, if the primary database fails, the system will run data from the fail-over slave container.

asynchronous master-slave replication

within the package, each database container has a default vertical scaling from 1 reserved to 24 dynamic cloudlets (up to 3 gib of ram and 9.6 ghz of cpu) that are allocated dynamically based on the incoming load. subsequently, you can change the resource allocation limit by following the above-linked guide.

now, let’s proceed further to get the postgresql package up and running in the cloud.

deploying postgresql replication package

the package installation is a fairly simple process that you can perform in just a few clicks.

  1. log into the jelastic platform with your credentials and click marketplace in the top pane.

    marketplace

    within the apps section, use the search box to find the postgresql database replication package and click install .

    tip: the postgresql replication package sources are available within jelastic jps collection alongside with other useful solutions, any of which can be integrated through importing a manifest.jps file from the appropriate repository.
  2. in the installation window, type environment name and display name ( alias ), select a region (if several regions are available) and click install .

    installation

    when the package installation is completed, you’ll see a confirmation message with the master node url and simultaneously receive an email notification with your administration data.

    success

    now, let’s put the master database into action to check that data is successfully replicated to the slave.

    to ensure that data is replicated properly, we’ll create a new db instance in the master container and check its presence inside the slave.

create new pg database

  1. click open in browser next to the postgresql master node to launch the phppgadmin web interface.

    postgresql admin

  2. under servers , click postgresql and log in with credentials you’ve received via email after the package installation.

    login postgresql

  3. click create database , fill in the name box (e.g. jelastic ), and click create .

    create database

    now, when the database is created in the master node, let’s check the replicated data within the slave container.

check the replication

to ensure that data replication from the master to the slave container works as intended, perform the following steps.

  1. click open in browser next to the postgresql slave node to launch the phppgadmin web interface.

    open postgresql admin panel

  2. access the admin interface with the same username and password that you’ve received via email after the package installation.

    postgresql database

    once logged in, you can see and manage the database (jelastic, in our example) that was earlier created in the master container.

that’s it! the postgresql environment with master-slave asynchronous replication is up and ready for data processing.

as a next step, you can already connect these postgresql replicated databases to your project. the process depends on application specifics, so follow the instructions below for:

  • java application
  • php application
Database PostgreSQL Replication (computing)

Published at DZone with permission of Tetiana Markova, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Database Query Service With OpenAI and PostgreSQL in .NET
  • PostgreSQL 12 End of Life: What to Know and How to Prepare
  • Understanding Leaderless Replication for Distributed Data
  • Formulating a Robust Strategy for Storage in Amazon Relational Database Service PostgreSQL Deployments

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!