Configuring and Managing VIP for Pgpool-II on AWS

It is possible to install and configure Pgpool-II in EC2 instances. However, the common ways to assign VIP can't be used in the Cloud. We need to consider alternatives for assigning VIP in the Cloud.

This post describes how to configure and manage VIP in AWS.

There several ways to configure VIP in AWS:

  • Assigning Elastic IP 
  • Assigning secondary private IP
  • Updating route table 
  • Updating Route53 record 

Multi-AZ Support Client Application Pgpool-II Instance Subnet
Assigning Elastic IP connect from the internet
public
Assigning secondary private IP × within VPC
private
Updating route table within VPC private
Updating Route53 record within VPC
other VPCs
on-premise
private

 

Assigning Elastic IP 

Elastic IP is a public IPv4 address, which is reachable from the internet, and it can be associated with an EC2 instance. 

The Elastic IP should be associated with leader Pgpool-II instance and clients connect to Pgpool-II via Elastic IP. If the leader Pgpool-II goes down, it disassociates the Elastic IP, and then the new leader Pgpool-II associate the Elastic IP with own instance.

This method supports multiple availability zones.

Assigning Secondary Private IP

Multiple private IP addresses can be assigned for EC2 instances.

You can assign a secondary private IP address to leader Pgpool-II instance. If the leader Pgpool-II goes down, then reassign it to the new Pgpool-II instance. 

Because the private IP address is not reachable over the internet, you need to locate your application instance in the same VPC. 

Note: A secondary private IP address cannot be assigned across multiple availability zones.

Updating Route Table 

This method can be useful if you want to locate Pgpool-II instances across multiple availability zones, and Pgpool-II can only be connected within VPC.

You need to create a route entry for the VIP to redirect the traffic to leader Pgpool-II instance. If the leader Pgpool-II goes down, then redirect the traffic to the new leader Pgpool-II instance by updating the VIP route entry.

This method supports multiple availability zones.

Updating Route53 Record 

This method can be useful if you want to locate Pgpool-II instances in private subnets and connect to it from on-promise or other VPCs. This method supports multiple availability zones.

Route53 is a DNS web service provided by AWS.

Configure Route53 and add a DNS A record which should route the traffic to leader Pgpool-II instance. If the leader Pgpool-II goes down, then route the traffic to the new leader Pgpool-II instance by updating the A record.

Note: the DNS record updates may take time.

Conslusion 

In this blog, I have described several ways to configure and manage VIP in the Cloud. 

If you want to locate Pgpool-II instances in private subnets across multiple availability zones and speed up failover, "Updating Route Table" is recommended.

In the next post, I will describe detailed information about configuring VIP by updating route table.

Comments

Popular posts from this blog

Installing Pgpool-II on Debian/Ubuntu

Query Load Balancing in Pgpool-II

Connection Pooling in Pgpool-II