PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

栏目: IT技术 · 发布时间: 4年前

内容简介: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 ho
PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

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 from one database to another allows to alleviate system failures, improve productivity, run backup services, and analyze data with no performance degrade.

Among numerous database clustering solutions , Jelastic provides PostgreSQL with master-slave asynchronous replication based on the certified templates. By default, it deploys two database containers (one per role - master and slave). 

The primary (master) server runs an active instance of the database and accepts read-write operations, whilst the standby (slave) server runs a copy of the active database and handles read-only operations. Therefore, if the primary database fails due to container failure or database corruption, the slave server (running in a separate container) has to be promoted to the master retaining the writes to ensure database availability.

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

Within the cluster topology, each database container has a defaultvertical scaling from 2 reserved to 32 dynamic cloudlets (up to 4 GiB of RAM and 12.8 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.

Database Cluster can be installed automatically:

  • As a Marketplace application
  • Via embedded Auto-Clustering feature at the Dashboard

Within this tutorial, we will cover both.

PostgreSQL Cluster Installation from Marketplace

PostgreSQL Master-Slave Clusterpackage can be easily found in the Marketplace. 

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

If required change database Version , Environment name and destinationRegion in the installation window.

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

PostgreSQL Auto-Clustering Mode

In Jelastic, auto-clustering is enabled by a specially designed switch that makes clustering easier than ever before. To do this just invoke thetopology wizard at the dashboard, pick the software stack(e.g. PostgreSQL 12.3) and slide the Auto-Clustering switch to the right.

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

Change the destination region if necessary. Here we chose Premium .

Tip:The PostgreSQL Replication package sources are available within Jelastic JPS Collection alongside with other useful solutions, any of which can be integrated throughimporting a manifest.yaml or manifest.jps file from the appropriate repository.

Cluster Topology

Database cluster topology obtained upon both deployments looks like as follows:

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

When the database cluster installation is completed, you’ll see a confirmation message with master node URL and database access credentials. All this information is duplicated via email.

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

Note:If the cluster was installed with auto-clustering functionality the credentials are sent via email only.

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

Testing PostgreSQL Database Replication

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 a New Database

1. Click Open in Browser next to the PostgreSQL Master node to launch the phpPgAdmin web interface.

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

2. Under Servers , click PostgreSQL and log in with credentials you’ve obtained upon cluster installation. 

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

3. Click Create database

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

4. Fill in the Name box (e.g. Jelastic ), and click Create

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

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

Check the Replication

To make sure that data replication from the master to the slave database node works as intended, perform the following steps.

1. Click Open in Browser next to the PostgreSQL Slave node to launch the phpPgAdmin web interface.

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

2. Access admin interface with the same username and password that you’ve used to access the master node.

PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

Once logged in, you can see the replicated database ( Jelastic , in our example).

That’s it! The PostgreSQL environment with master-slave asynchronous replication is up and ready for data processing.

As a next step, you can connect this PostgreSQL replicated database to your project. The process depends on application specifics, so follow the instructions below for:

Try out by yourself how easy it can be to handle multiple copies of essential data within replicated PostgreSQL databases with no need to make manual configurations. Register at one of Jelastic cloud hosting providers and get a free account for testing.


以上所述就是小编给大家介绍的《PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

浪潮式发售

浪潮式发售

[美] 杰夫.沃克(Jeff Walker) / 李文远 / 广东人民出版社 / 2016-3-1 / 39.80元

10天时间,4种发售路径, 让你的产品一上架就被秒杀 投资失败的个体户,怎样让长期积压的库存,变成众人抢购的稀缺品,最终敲开财富之门? 只有一腔热血的大学毕业生,怎样将原本无人问津的网球课程,发售成价值45万美元的专业教程? 长期脱离社会的全职主妇,如何白手起家,创造出自己的第一款爆品,并挽救即将破碎的家庭? 改变上述人士命运的是同一件法宝——产品发售方程式。互......一起来看看 《浪潮式发售》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具