PostgreSQL Auto-Clustering with Asynchronous Master-Slave Replication

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

内容简介: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》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

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

大连接

大连接

[美] 尼古拉斯•克里斯塔基斯(Nicholas A. Christakis)、[美] 詹姆斯•富勒(James H. Fowler) / 简学 / 中国人民大学出版社 / 2013-1 / 59.90元

[内容简介] 1. 本书是继《六度分隔》之后,社会科学领域最重要的作品。作者发现:相距三度之内是强连接,强连接可以引发行为;相聚超过三度是弱连接,弱连接只能传递信息。 2. 本书讲述了社会网络是如何形成的以及对人类现实行为的影响,如对人类的情绪、亲密关系、健康、经济的运行和政治的影响等,并特别指出,三度影响力(即朋友的朋友的朋友也能影响到你)是社会化网络的强连接原则,决定着社会化网络的......一起来看看 《大连接》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具