Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snju6-005k8q-7x for pgsql-admin@arkaria.postgresql.org; Mon, 09 Sep 2024 19:18:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1snju5-00HK8O-UO for pgsql-admin@arkaria.postgresql.org; Mon, 09 Sep 2024 19:18:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snju5-00HK8F-FN for pgsql-admin@lists.postgresql.org; Mon, 09 Sep 2024 19:18:25 +0000 Received: from cc-smtpout1.netcologne.de ([89.1.8.211]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snjtx-000LqA-Mg for pgsql-admin@lists.postgresql.org; Mon, 09 Sep 2024 19:18:24 +0000 Received: from cc-smtpin1.netcologne.de (cc-smtpin1.netcologne.de [89.1.8.201]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id ECA521240B for ; Mon, 9 Sep 2024 21:18:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1725909498; bh=rl+Ejfc3e/WIj27IjEsfyo4Rh6CLvULzH5ck/WCf2V0=; h=Message-ID:Date:Subject:To:References:From:In-Reply-To:From; b=E/3VpwHA7Wta0funTe3O5ALd6vIO/FyDGHtQkULIWUtUepo4bEAIn0LRg1r123XIk NclckrbxcimpFILuFueVMteX1QLB/y588tk0z1NCg68yuo970lKxMHbtdfDXu2YZ26 Hv8bENeGLq0T1b+8SMREtQ/KT2qvaJ3F2zLIc7Pd8nGSnysD/xQ2ZcRvc2tGlkN1ah R5koMLRGjBu7zLlkeKx//Jhi6+bPlnVpH0ZnwWQSP0zaHIml1ARUbt1mZdO5F2xHmN T1Z8PQdJAZhgyzMI8TKeiWCH4j3CW7UKNZx4wKscQttcS+pJEUsZttdZmP8S7SGsKI foz08+N7/0yXA== Received: from [IPV6:2a03:b580:af0d:f901:cece:ad36:6ea3:f071] (unknown [IPv6:2a03:b580:af0d:f901:cece:ad36:6ea3:f071]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by cc-smtpin1.netcologne.de (Postfix) with ESMTPSA id B823811D90 for ; Mon, 9 Sep 2024 21:18:17 +0200 (CEST) Content-Type: multipart/alternative; boundary="------------PPa2yzny1r5FwW70HJyFqqdg" Message-ID: <9c8da100-4dde-4a8d-9dff-e55c1e119f8d@netcologne.de> Date: Mon, 9 Sep 2024 21:21:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Basebackup To: pgsql-admin@lists.postgresql.org References: Content-Language: en-US From: vrms In-Reply-To: X-NetCologne-Spam: L X-Rspamd-Queue-Id: B823811D90 X-Spamd-Bar: --- X-Rspamd-Action: no action List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------PPa2yzny1r5FwW70HJyFqqdg Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit hi Rajesh, On 9/4/24 11:44 AM, Rajesh Kumar wrote: > > ... I have two openshift environments in different data centers. I > want to move one data from one DC to another Data center. > it is not 100% clear what exactly you want to achieve. But ... if you want to migrate your postgres from location A to location B (that is what it somehow sounds like) I guess ... 1. setting up a replica on the target (B) via pg_basebackup 2. stopping your application and the old main (A) 3. promoting the replica (B) to become the new main 4. re-directing your application to the target (B) could be quite efficient. > > On Wed, 4 Sept 2024, 13:49 Asad Ali, wrote: > > Hi Rajesh, > > Here are a few differences between basebackup and rsync. > > *pg_basebackup* is easier, as it's a single command with > PostgreSQL support. Data consistency is automatically ensured by > postgresql. It transfers the entire database, potentially high > network bandwidth is required. It is less flexible, due to mostly > predefined options. > > *rsync *is more complex, it requires multiple manual steps. This > method requires stopping or ensuring the primary server's data > directory is in a consistent state before starting the > synchronization, Which can cause downtime or performance impact. > It requires careful handling to ensure data consistency. It is > more efficient with bandwidth, as it only transfers changes.  It > is more flexible with control over what gets copied. > > *You can use basebackup* if you want a straightforward, reliable > way to create a base backup. If you are looking for a method that > integrates directly with PostgreSQL's replication capabilities. > Network bandwidth and performance impact on the primary server are > not critical concerns. If you want an automated process that > requires less manual intervention. > > *You can use rsync* if you have specific requirements for how the > data should be copied (e.g., selective file copying). If you need > more control over the synchronization process or want to optimize > for minimal network usage. If you have a large dataset and want to > minimize the data transfer by only copying changes after an > initial sync. If you are comfortable with handling data > consistency and can manage the additional complexity. > > Regards, > Asad Ali > > > On Tue, Sep 3, 2024 at 5:31 PM Rajesh Kumar > wrote: > > How different is basebackup from new server with primary host > and rsync from primary,  move to new server and start cluster? > --------------PPa2yzny1r5FwW70HJyFqqdg Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit hi Rajesh,

On 9/4/24 11:44 AM, Rajesh Kumar wrote:

... I have two openshift environments in different data centers. I want to move one data from one DC to another Data center.

it is not 100% clear what exactly you want to achieve.
But ... if you want to migrate your postgres from location A to location B (that is what it somehow sounds like) I guess ...
  1. setting up a replica on the target (B) via pg_basebackup
  2. stopping your application and the old main (A)
  3. promoting the replica (B) to become the new main
  4. re-directing your application to the target (B)
could be quite efficient.


On Wed, 4 Sept 2024, 13:49 Asad Ali, <asadalinagri@gmail.com> wrote:
Hi Rajesh,

Here are a few differences between basebackup and rsync.

pg_basebackup is easier, as it's a single command with PostgreSQL support. Data consistency is automatically ensured by postgresql. It transfers the entire database, potentially high network bandwidth is required. It is less flexible, due to mostly predefined options.

rsync is more complex, it requires multiple manual steps. This method requires stopping or ensuring the primary server's data directory is in a consistent state before starting the synchronization, Which can cause downtime or performance impact. It requires careful handling to ensure data consistency.  It is more efficient with bandwidth, as it only transfers changes.  It is more flexible with control over what gets copied.

You can use basebackup if you want a straightforward, reliable way to create a base backup. If you are looking for a method that integrates directly with PostgreSQL's replication capabilities.
Network bandwidth and performance impact on the primary server are not critical concerns. If you want an automated process that requires less manual intervention.

You can use rsync if you have specific requirements for how the data should be copied (e.g., selective file copying). If you need more control over the synchronization process or want to optimize for minimal network usage. If you have a large dataset and want to minimize the data transfer by only copying changes after an initial sync. If you are comfortable with handling data consistency and can manage the additional complexity.

Regards,
Asad Ali


On Tue, Sep 3, 2024 at 5:31 PM Rajesh Kumar <rajeshkumar.dba09@gmail.com> wrote:
How different is basebackup from new server with primary host and rsync from primary,  move to new server and start cluster?
--------------PPa2yzny1r5FwW70HJyFqqdg--