Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcUZv-0004l3-Le for pgsql-admin@arkaria.postgresql.org; Tue, 10 Nov 2020 14:24:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kcUZu-0001t3-Kr for pgsql-admin@arkaria.postgresql.org; Tue, 10 Nov 2020 14:24:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcUZu-0001ss-9o for pgsql-admin@lists.postgresql.org; Tue, 10 Nov 2020 14:24:58 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kcUZs-0000A6-A1 for pgsql-admin@lists.postgresql.org; Tue, 10 Nov 2020 14:24:57 +0000 Received: by mail-ot1-x32a.google.com with SMTP id n11so12653548ota.2 for ; Tue, 10 Nov 2020 06:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=GwsC+w5koPMwTYKuYDKbCz851c2ei7SYV0G6fDvn4a8=; b=qEgazcH6eQj72hqxOmiCsL3H+ZvF8G+UgLf2hW79pP1WwQ4NfSghTX9d+1uAsiqH7y ktSPxT6lxT1qV+AgGe87YeF+U1Casvy4dD4yKizibTsC4NXeP0fIOJkcwmATFWIJCTn6 o7oN5viRbiFVnTFmio6loPVdOiV5JvuYXf0Oa/6xpXTjq4E8Za3ZDLQsDLngjv0Vd7V9 3pTP0x2Kpw3zmdIVDEdpJH/XytuH/C7S0oouAkqZyT+j+uvqc2iThL+Qd33rBkSjgpTL +5leoH0qNG/trNoG9F/I2wvNiB3BEGe3H/Xl/xyesck/VQml3Xw43zlZ9Pg1IvMukum0 Dvpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=GwsC+w5koPMwTYKuYDKbCz851c2ei7SYV0G6fDvn4a8=; b=q+FW4SoYxEbX0QHQEGJJLYgsKuIwz6xvyimqkUJDWyeBlOdK3xIQy7JXRBsuA30dHB C861dNfQwwIzMCiDu7N2En/wrFkGwugrewSi5ZjxzmMnRR6oVQ9UvhoP9Ft1DR7Lh46H BC6J853xXUu86hdn405nzsBamDT4nxZsBRMaUd7T3ttFVow/1hG0MkJ8m9wh18bQv8RN 8GC/ATRc2A4TeFLheM9lVHwXiEc7AOX7XPZ9VBJQOTiLE/e0vTT4GgdsfSdzRyDwA3ua aP4C4jFrvWrWOd3DKKx99IGRDWUhyiFb/iH1Wx1Uxt1M2uSWCW4pQxiQY9xSkUJxZjTK B9Sg== X-Gm-Message-State: AOAM530/hTLEimlRaJfPCyaFOESx7fahudVl+BxAUjMn8VlgI3+Qref+ CcTMouk9uG8Zhzg7IloR1xKwqYgmpuLc7g== X-Google-Smtp-Source: ABdhPJy4PvFLr/YMtmDepEW2UZjHIieQmmhTqKomKdNEaJt3LWp9d6Oi9L0ZKCvt3DyS2W/vqr0LUQ== X-Received: by 2002:a9d:69d5:: with SMTP id v21mr14583080oto.176.1605018295233; Tue, 10 Nov 2020 06:24:55 -0800 (PST) Received: from [192.168.1.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id u4sm240056oib.0.2020.11.10.06.24.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Nov 2020 06:24:54 -0800 (PST) Subject: Re: Move database To: pgsql-admin@lists.postgresql.org References: <100b9c34-6b52-c8a6-91de-3cbff6de87c6@gmail.com> From: Ron Message-ID: <07a5cf21-76f6-b47f-bd7c-22e1241e9f3a@gmail.com> Date: Tue, 10 Nov 2020 08:24:53 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------40D362D2EBD9BF8E303ADEFF" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------40D362D2EBD9BF8E303ADEFF Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 11/10/20 8:22 AM, Yambu wrote: > Hi > > Same version of database, the old server will remain running with other > databases, we just want to move one database. If that's the case, then you either must: * do a pg_dump/pg_restore, or * depending on the version, logically replicate that one database. > > regards > > On Tue, Nov 10, 2020 at 4:16 PM Ron > wrote: > > On 11/10/20 8:11 AM, Paul Förster wrote: > > Hi Yambu, > > > >> On 10. Nov, 2020, at 14:48, Yambu > wrote: > >> What is the best way to move a database from one VM to another > without losing records from updating applications? > > I assume you want to minimize down time? If so, set up a streaming > replication on the new VM and let PostgreSQL copy the whole database > over by itself as a standby database. After copying is finished and > both databases are completely in sync, then shut down the old > (primary) database and promote the standby database. After that, you > can delete the old database. > > > > Assuming you can afford the down time, there is always the option of > shutting the database down and scp or rsync it to the new VM and start > it there. > > > > If you run it on some external storage like mounted NFS filesystems, > you can shut it down, umount the NFS volume(s) on the old VM, mount > the NFS volume(s) on the new VM and start it there. > > > > It really depends on your system (storage) architecture. > > Given this set of circumstances, they could dismount the LUNs from > VM-old, > and mount them on VM-new: > * it's on a SAN, > * they're keeping the same version number, > * the database files are on dedicated mount points. > > -- > Angular momentum makes the world go 'round. > > -- Angular momentum makes the world go 'round. --------------40D362D2EBD9BF8E303ADEFF Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 11/10/20 8:22 AM, Yambu wrote:
Hi

Same version of database, the old server will remain running with other databases, we just want to move one database.

If that's the case, then you either must:
* do a pg_dump/pg_restore, or
* depending on the version, logically replicate that one database.


regards

On Tue, Nov 10, 2020 at 4:16 PM Ron <ronljohnsonjr@gmail.com> wrote:
On 11/10/20 8:11 AM, Paul Förster wrote:
> Hi Yambu,
>
>> On 10. Nov, 2020, at 14:48, Yambu <hyambu@gmail.com> wrote:
>> What is the best way to move a database from one VM to another without losing records from updating applications?
> I assume you want to minimize down time? If so, set up a streaming replication on the new VM and let PostgreSQL copy the whole database over by itself as a standby database. After copying is finished and both databases are completely in sync, then shut down the old (primary) database and promote the standby database. After that, you can delete the old database.
>
> Assuming you can afford the down time, there is always the option of shutting the database down and scp or rsync it to the new VM and start it there.
>
> If you run it on some external storage like mounted NFS filesystems, you can shut it down, umount the NFS volume(s) on the old VM, mount the NFS volume(s) on the new VM and start it there.
>
> It really depends on your system (storage) architecture.

Given this set of circumstances, they could dismount the LUNs from VM-old,
and mount them on VM-new:
* it's on a SAN,
* they're keeping the same version number,
* the database files are on dedicated mount points.

--
Angular momentum makes the world go 'round.



--
Angular momentum makes the world go 'round.
--------------40D362D2EBD9BF8E303ADEFF--