Streaming Replication - changing IP addresses

Started by Dara Unglaubeover 11 years ago4 messagesgeneral
Jump to latest
#1Dara Unglaube
dara@glifwc.org

Greetings.
We have streaming replication set up on two servers that are on our local
network using their external/public IP addresses. We are switching internet
providers and need to change the external/public IP addresses of both
servers. I'm not sure how to go about this correctly.

1. Our local network IP addresses will not be changing, is there any
reason we could/should not use our local network IP addresses in the
streaming replication process?
2. What is the best route to make these changes? Is it as simple as
turning postgres off on both servers, changing the IP settings (master -
postgres.conf and hba.conf and slave - recovery.conf files to the local
network IPs) and starting the service up again? Can anyone point me to an
example?

Any tips, suggestions, help you could provide would be greatly appreciated.

Thanks in advance for your time!

Dara

#2John R Pierce
pierce@hogranch.com
In reply to: Dara Unglaube (#1)
Re: Streaming Replication - changing IP addresses

On 12/8/2014 11:56 AM, Dara Unglaube wrote:

We have streaming replication set up on two servers that are on our
local network using their external/public IP addresses. We are
switching internet providers and need to change the external/public IP
addresses of both servers. I'm not sure how to go about this correctly.

1. Our local network IP addresses will not be changing, is there any
reason we could/should not use our local network IP addresses in
the streaming replication process?
2. What is the best route to make these changes? Is it as simple as
turning postgres off on both servers, changing the IP settings
(master - postgres.conf and hba.conf and slave - recovery.conf
files to the local network IPs) and starting the service up again?
Can anyone point me to an example?

Any tips, suggestions, help you could provide would be greatly
appreciated.

Thanks in advance for your time!

if these two servers are both local, there's absolutely no reason to use
public IP space for this, they should be using their local addresses,
faster, lower latency, otherwise each round trip packet is going through
4 layers of NAT (out, in, then out, in again to return).

make sure the master allows the slave replication account to connect via
its local IP (this would be in pg_hba.conf, and a 'reload'), then
change the address the slave is using to connect to the master, and
restart the slave, and it all should be good.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

#3Dara Unglaube
dara@glifwc.org
In reply to: John R Pierce (#2)
Re: Streaming Replication - changing IP addresses

Thank so very for the info, John! This will help a lot to have it set up
locally.

I have it set up across the local network and double checked with
pg_stat_replication and it was using the local IP. But now I am not sure
about the "archive_command" command on the master. We had it set up to
archive onto the slave through the archive_command using SSH & rsync
because we were going through the public IP. Below is the command line.

archive_command = 'rsync -az -e "\"/cygdrive/c/cygwin64/bin/ssh.exe\""
"/cygdrive/d/PostgreSQL/9.1/data/%p"
"postgres@0.0.0.0:/cygdrive/d/PostgreSQL/9.1/data/wals/%f"
'

Is this neccessary? What is the benefit of having the archive on? Could I
map a network drive from the slave to the master and set the
archive_command to that mapped drive? Or what would be the best approach
for this?

Thanks so very much!
Dara

On Mon, Dec 8, 2014 at 2:11 PM, John R Pierce <pierce@hogranch.com> wrote:

On 12/8/2014 11:56 AM, Dara Unglaube wrote:

We have streaming replication set up on two servers that are on our local
network using their external/public IP addresses. We are switching internet
providers and need to change the external/public IP addresses of both
servers. I'm not sure how to go about this correctly.

1. Our local network IP addresses will not be changing, is there any
reason we could/should not use our local network IP addresses in the
streaming replication process?
2. What is the best route to make these changes? Is it as simple as
turning postgres off on both servers, changing the IP settings (master -
postgres.conf and hba.conf and slave - recovery.conf files to the local
network IPs) and starting the service up again? Can anyone point me to an
example?

Any tips, suggestions, help you could provide would be greatly appreciated.

Thanks in advance for your time!

if these two servers are both local, there's absolutely no reason to use
public IP space for this, they should be using their local addresses,
faster, lower latency, otherwise each round trip packet is going through 4
layers of NAT (out, in, then out, in again to return).

make sure the master allows the slave replication account to connect via
its local IP (this would be in pg_hba.conf, and a 'reload'), then change
the address the slave is using to connect to the master, and restart the
slave, and it all should be good.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

--

*Dara J. Olson Unglaube*
Aquatic Invasive Species Coordinator
Great Lakes Indian Fish & Wildlife Commission
P.O. Box 9, 72682 Maple Street
Odanah, WI 54861
(715) 682-6619 ext.2129
dara@glifwc.org <dolson@glifwc.org>
maps.glifwc.org

#4John R Pierce
pierce@hogranch.com
In reply to: Dara Unglaube (#3)
Re: Streaming Replication - changing IP addresses

On 12/9/2014 9:07 AM, Dara Unglaube wrote:

Is this neccessary? What is the benefit of having the archive on?
Could I map a network drive from the slave to the master and set the
archive_command to that mapped drive? Or what would be the best
approach for this?

having a wal archive lets the slave resume after a service interruption
faster, and also farther back than your wal_keep_Segments setting would
otherwise allow.

having a wal archive, along with occasional base backups will let you do
'point in time recovery' (PITR) right up to a specified transaction, as
long as you have a base backup from prior to that transaction and all
wal archives since that base backup.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general