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 1kcUS1-0004Qf-HC for pgsql-admin@arkaria.postgresql.org; Tue, 10 Nov 2020 14:16:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kcUS0-00013s-Fn for pgsql-admin@arkaria.postgresql.org; Tue, 10 Nov 2020 14:16:48 +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 1kcUS0-00013k-5u for pgsql-admin@lists.postgresql.org; Tue, 10 Nov 2020 14:16:48 +0000 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kcURy-00005f-3n for pgsql-admin@lists.postgresql.org; Tue, 10 Nov 2020 14:16:47 +0000 Received: by mail-ot1-x32f.google.com with SMTP id 30so6861786otx.9 for ; Tue, 10 Nov 2020 06:16:46 -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-transfer-encoding:content-language; bh=sVNiPSB9QlhAexh/D7MHNODgH3hRBa9D+OFfHLp3q6I=; b=fsj9Z7Zy5H/kv6wvWXiZwYQvgN8N3ZupVQljSjg4dNG8vAEPe2c5UnQkfAafXUTWAQ VxbyCmAXqxbFrPYdg/KekrcZbZUFtjVe6O/vced6RfElrSVPXowbpJZQgQvjgrkH6DrS LYx0m4hIqgjYftoBR8GHuIEjfAkoKuv0P6XiQ+iCPLNJDz+DH8L88G0TJ8gp48fuxlUE RYSc/q46DYT+sobFjlvqKOrPgyyLDZMSDrdSw/GkB3uY745CeXZ/gOaTC0DNrUZDY9Za cjywzFIlFt4kjtxDWz+OpQy0JwbBMiSLs2eqBAWmWYhbGVhsMTQPFWU1LA4vWEiYA8ud NSEA== 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-transfer-encoding :content-language; bh=sVNiPSB9QlhAexh/D7MHNODgH3hRBa9D+OFfHLp3q6I=; b=RoaxJBZvgPoxV5LcKu0pm5JaAGquXhvKPLoW6K8jk33+tiii2a6pH05N4GTRtN1qi8 otYDWKBy/ZYRtRVSFTKbWuUQbXi7+/Hoxtl9phXQ7UNqqg7Tdh4t4UehkYzDCYUx2R5Z W+pOTZx/1j3/xAY4BXW/fU1S1P7qf8PMDpvOOr+B5N3k8gbvJPPqDwN5fpYv6XWrbpWQ iLsK03inQPf/35e3JdUoighCksa0+EOO3pNiSN3E1ZnU2Y9j6H2EjNRHJAd7Tiw+mtpf 6O65FTd1KCPfIk0c1Z5hJmsECBKwKudl2dx4hAZCW0jIZEYLjAkYZqvvBCcdyZTi2OEG 1P2A== X-Gm-Message-State: AOAM53081c+GjkEYd47BoU5L7S1wbbbhEU6NFNLosLAzoz7vGTJsMpBA AOErC7BbdhvmvZDc7sgunxBhug62Y2/GgQ== X-Google-Smtp-Source: ABdhPJyLyOzI/fWDmEw9XHF9xd3QS3jsmX+6RaAPlUXNztXFSAGBXxClFTHCw1+O7EhSH96XotDKOQ== X-Received: by 2002:a9d:1b4f:: with SMTP id l73mr13848021otl.178.1605017804936; Tue, 10 Nov 2020 06:16:44 -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 u10sm3226939otj.31.2020.11.10.06.16.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Nov 2020 06:16:44 -0800 (PST) Subject: Re: Move database To: pgsql-admin@lists.postgresql.org References: From: Ron Message-ID: <100b9c34-6b52-c8a6-91de-3cbff6de87c6@gmail.com> Date: Tue, 10 Nov 2020 08:16:43 -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: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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.