This commit is contained in:
313
platform/backup-and-recovery-with-wal-g-and-rclone.html
Normal file
313
platform/backup-and-recovery-with-wal-g-and-rclone.html
Normal file
@ -0,0 +1,313 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Back up and recover databases with WAL-G and Rclone</title>
|
||||
<meta name="generator" content="Help+Manual" />
|
||||
<meta name="keywords" content="" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="You can configure BRIX data backup and recovery using the following programs:" />
|
||||
<meta name="picture" content="" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Full documentation for BRIX365 platform. Low-code developer guide. User guide. Admin guide. Developer guide." />
|
||||
<meta property="og:url" content="https://brix365.com/en/help" />
|
||||
<meta property="og:image" content="" />
|
||||
<link rel="icon" href="favicon.png" type="image/png" />
|
||||
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="./jquery-ui.min.css" />
|
||||
<link rel="stylesheet" href="default.css" />
|
||||
<link rel="stylesheet" href="./search-yandex.css" />
|
||||
<link rel="stylesheet" href="./article.css" />
|
||||
<link rel="stylesheet" href="./glossary.css" />
|
||||
<link rel="stylesheet" href="./theme.css" />
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="helpman_settings.js"></script>
|
||||
<script type="text/javascript" src="helpman_topicinit.js"></script>
|
||||
|
||||
<script type="text/javascript" src="highlight.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){highlight();});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script>!function(e,t,c,n,r,a,m){e.ym=e.ym||function(){(e.ym.a=e.ym.a||[]).push(arguments)},e.ym.l=1*new Date;for(var s=0;s<document.scripts.length;s++)if(document.scripts[s].src===n)return;a=t.createElement(c),m=t.getElementsByTagName(c)[0],a.async=1,a.src=n,m.parentNode.insertBefore(a,m)}(window,document,"script","https://mc.yandex.ru/metrika/tag.js"),ym(83179930,"init",{clickmap:!0,trackLinks:!0,accurateTrackBounce:!0,webvisor:!0})</script><noscript><div><img alt=""src=https://mc.yandex.ru/watch/83179930 style=position:absolute;left:-9999px></div></noscript>
|
||||
|
||||
<header class="header elma-365">
|
||||
<div class="container">
|
||||
<a class="header__logo" href="https://brix365.com/en/help">
|
||||
<img src="./logo-en.svg" alt="header logo">
|
||||
</a>
|
||||
<!-- <div class="hero__search-form" id="search-panel">
|
||||
<form class="search-form" onsubmit="ym(83180416,'reachGoal','poisk')">
|
||||
<label class="search-form__label">
|
||||
<span id="reset-search" class="search__icon"></span>
|
||||
<input class="search-form__input" type="text">
|
||||
</label>
|
||||
<input class="search-form__submit" type="submit" value="Submit">
|
||||
</form>
|
||||
</div> -->
|
||||
|
||||
<div class="hero__search-form" id="search-panel"> <form class="search-form"> <label class="search-form__label"> <span id="reset-search" class="search__icon"></span> <input class="search-form__input" type="text"> </label> <input class="search-form__submit" type="submit" value="Submit"> </form> </div>
|
||||
<div class="hero__search">
|
||||
<a href="#" id="search-icon" class="hero__search-icon">
|
||||
<img src="search-icon-white.svg" alt="search string">
|
||||
</a>
|
||||
<a href="#" id="side-menu-icon" class="hero__side-icon">
|
||||
<img src="side_menu.svg" alt="side menu">
|
||||
</a>
|
||||
</div>
|
||||
<div class="header__navi">
|
||||
|
||||
<ul class="header__list"><li><span class="solution-select"><span class="solution-select__selected"></span><svg width="7" height="4" viewBox="0 0 7 4" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L3.5 3.5L6 1" stroke="white" stroke-linecap="round" stroke-linejoin="round"/></svg><ul class="solution-select__list"><li><a class="project-link" href="https://brix365.com/en/help/platform/get-trial.html">Platform</a></li><li><a class="project-link" href="https://brix365.com/en/help/ecm/ecm-functions.html">ECM</a></li><li><a class="project-link" href="https://brix365.com/en/help/crm/crm_overview.html">CRM</a></li><li><a class="project-link" href="https://brix365.com/en/help/service/service-functions.html">Service</a></li><li><a class="project-link" href="https://brix365.com/en/help/projects/projects-functions.html">Projects</a></li><li><a class="project-link" href="https://brix365.com/en/help/business_solutions/-elma365-store.html">Business Solutions</a></li></ul></span></li><li><a href="https://api.brix365.com/en/" target="_blank">API</a></li><li><a href="https://tssdk.brix365.com/" target="_blank">SDK</a></li></ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
|
||||
<main class="main container">
|
||||
|
||||
<aside class="sidebar" id="sidebar">
|
||||
<div class="sidebar__header">
|
||||
<a class="header__logo" href="https://brix365.com/en/help">
|
||||
<img src="./logo-light-en.svg">
|
||||
</a>
|
||||
<span class="sidebar__close elma-365-close" id="close"></span>
|
||||
</div>
|
||||
<div class="sidebar__wrapper" id="side-menu">
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<article class="article" id="article">
|
||||
<div class="article-inner">
|
||||
<div class="content">
|
||||
<header class="article__header">
|
||||
<div class="article__bread" style="display:flex; gap:10px;">
|
||||
<span id="subcategory" class="search-res__item-category search-res__item-category_subcategory subcategory article__badge"></span>
|
||||
|
||||
<div class="topic__breadcrumbs">
|
||||
<p><a href="elma365-on-premises.html">BRIX On-Premises</a> > <a href="elma365-enterprise.html">BRIX On-Premises Enterprise</a> / Back up and recover databases with WAL-G and Rclone</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="topic__title"><h1 class="p_Heading1"><span class="f_Heading1">Back up and recover databases with WAL-G and Rclone</span></h1>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<section class="article__content">
|
||||
<div class="scroll-top-inner">
|
||||
<a href="#h1-article" class="scroll-top"></a>
|
||||
</div>
|
||||
<!-- Placeholder for topic body. -->
|
||||
<p class="p_Normal">You can configure BRIX data backup and recovery using the following programs:</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal">WAL-G is a database backup and recovery utility that supports several DBMSs, including <a href="backup-and-recovery-with-wal-g-and-rclone.html#walg-pgsql" class="topiclink">PostgreSQL</a> and <a href="backup-and-recovery-with-wal-g-and-rclone.html#walg-mongo" class="topiclink">MongoDB</a>.<br />
|
||||
<br />
|
||||
It utilizes Continuous Archiving and Point-in-Time Recovery (PITR) to provide reliable data archiving and recovery.<br />
|
||||
<br />
|
||||
WAL-G supports storing backups in various cloud storage services such as Amazon S3, Google Cloud Storage, Azure Blob Storage, and others.</li></ul>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal"><a href="backup-and-recovery-with-wal-g-and-rclone.html#rclone" class="topiclink">Rclone</a> is an open-source, multi-threaded, command-line content management program. It allows you to move data to the cloud and other storage services.</li></ul>
|
||||
<p class="p_Normal">This article describes how to back up and restore PostgreSQL 15 and MongoDB 6 in Ubuntu Linux 22.04.</p>
|
||||
<h2 class="p_Heading2"><a id="walg-pgsql" class="hmanchor"></a><span class="f_Heading2">Configure WAL-G for PostgreSQL</span></h2>
|
||||
<p class="p_Normal">With WAL-G you can:</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal">Back up your data.</li><li class="p_Normal"><a href="backup-and-recovery-with-wal-g-and-rclone.html#psql-restore" class="topiclink">Restore data from a backup</a>.</li></ul>
|
||||
<h3 class="p_Heading3"><span class="f_Heading3">Backup for PostgreSQL</span></h3>
|
||||
<p class="p_Normal">Follow the steps below to back up your data using WAL-G:</p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" class="p_Normal">First install WAL-G from the <a href="https://github.com/wal-g/wal-g" target="_blank" class="weblink">official GitHub repository</a>:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">wget https://github.com/wal-g/wal-g/releases/download/v3.0.5/wal-g-pg-ubuntu-22.04-amd64.tar.gz</span><br />
|
||||
<span class="f_CodeExample">tar -xzf wal-g-pg-ubuntu-22.04-amd64.tar.gz </span><br />
|
||||
<span class="f_CodeExample">sudo mv wal-g-pg-ubuntu-22.04-amd64 /usr/local/bin/wal-g-pg</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="2">
|
||||
<li value="2" class="p_Normal">Configure environment variables to access the cloud storage. To do this, open the configuration file <code><b>/etc/postgresql/15/main/.walg.json</b></code> and add the following parameters:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">{</span><br />
|
||||
<span class="f_CodeExample">"WALG_S3_PREFIX": "s3://elma365-backup/postgres",</span><br />
|
||||
<span class="f_CodeExample">"AWS_ENDPOINT": "https://storage.yandexcloud.net"</span><br />
|
||||
<span class="f_CodeExample">"AWS_ACCESS_KEY_ID": "<your-access-key-id>",</span><br />
|
||||
<span class="f_CodeExample">"AWS_SECRET_ACCESS_KEY": "<your-secret-access-key>",</span><br />
|
||||
<span class="f_CodeExample">"AWS_REGION": "us-east-1",</span><br />
|
||||
<span class="f_CodeExample">"AWS_S3_FORCE_PATH_STYLE": "true",</span><br />
|
||||
<span class="f_CodeExample">"WALG_COMPRESSION_METHOD": "brotli",</span><br />
|
||||
<span class="f_CodeExample">"WALG_DELTA_MAX_STEPS": "6",</span><br />
|
||||
<span class="f_CodeExample">"PGHOST": "/var/run/postgresql",</span><br />
|
||||
<span class="f_CodeExample">"PGDATA": "/var/lib/postgresql/15/main",</span><br />
|
||||
<span class="f_CodeExample">"PGSSLMODE": "disable"</span><br />
|
||||
<span class="f_CodeExample">}</span></p>
|
||||
<p class="p_Normal" style="margin: 0 0 0 31px;">Where:</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal"><code><b>WALG_S3_PREFIX</b></code> specifies the path to the S3 repository where backups and <span style="font-weight: bold;">.WAL</span> files (Write-Ahead Logs) will be stored.</li><li class="p_Normal"><code><b>AWS_ENDPOINT</b></code> specifies the endpoint for the S3-compatible storage.</li><li class="p_Normal"><code><b>AWS_ACCESS_KEY_ID</b></code> is the access Key ID for authentication to S3-compliant storage.</li><li class="p_Normal"><code><b>AWS_SECRET_ACCESS_KEY</b></code> is the Secret Access Key for authentication in S3-compliant storage.</li><li class="p_Normal"><code><b>AWS_REGION</b></code> is the region where the S3-compatible storage is located.</li><li class="p_Normal"><code><b>AWS_S3_S3_FORCE_PATH_STYLE</b></code> indicates that the path style should be used to access S3 buckets.</li><li class="p_Normal"><code><b>WALG_COMPRESSION_METHOD</b></code> is the compression method used for backups. In this case, the <code><b>Brotli</b></code> algorithm is used, which provides a good balance between compression ratio and speed.</li><li class="p_Normal"><code><b>WALG_DELTA_MAX_STEPS</b></code> is the maximum number of steps (delta steps) that WAL-G can use for progressively larger (delta) backups. It allows you to save space by storing only changes between backups.</li><li class="p_Normal"><code><b>PGHOST</b></code> specifies the path to the PostgreSQL socket through which WAL-G will connect to the database. It is used to execute commands that require a connection to PostgreSQL.</li><li class="p_Normal"><code><b>PGDATA</b></code> is the path to the PostgreSQL data directory. WAL-G uses this parameter to determine where PostgreSQL data are stored for correct backup and recovery.</li><li class="p_Normal"><code><b>PGSSLMODE</b></code> indicates that SSL/TLS encryption for connection to PostgreSQL is disabled. This can be useful for local connections where encryption is not required.</li></ul>
|
||||
<ol style="list-style-type:upper-roman" start="3">
|
||||
<li value="3" class="p_Normal">Change the file owner:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">chown postgres: /etc/postgresql/15/main/.walg.json</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="4">
|
||||
<li value="4" class="p_Normal">To use WAL-G, configure PostgreSQL to work with continuous archiving. To do this, open the configuration file <code><b>/etc/postgresql/15/main/postgresql.conf</b></code> and add the following parameters:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">archive_mode = on</span><br />
|
||||
<span class="f_CodeExample">archive_timeout = 600s</span><br />
|
||||
<span class="f_CodeExample">archive_command = '/usr/local/bin/wal-g-pg wal-push "%p" --config /etc/postgresql/15/main/.walg.json >> /var/log/postgresql/archive_command.log 2>&1'</span><br />
|
||||
<span class="f_CodeExample">wal_level = replica</span><br />
|
||||
<span class="f_CodeExample">restore_command = '/usr/local/bin/wal-g-pg wal-fetch "%f" "%p" --config /etc/postgresql/15/main/.walg.json >> /var/log/postgresql/restore_command.log 2>&1'</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="5">
|
||||
<li value="5" class="p_Normal">To create a full database backup, run the command:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">sudo -u postgres /usr/local/bin/wal-g-pg backup-push --config /etc/postgresql/15/main/.walg.json /var/lib/postgresql/15/main/</span></p>
|
||||
<h3 class="p_Heading3"><a id="psql-restore" class="hmanchor"></a><span class="f_Heading3">Data restore for PostgreSQL</span></h3>
|
||||
<p class="p_Normal"><span style="font-weight: bold;">Important</span>: restore from backup to an empty database. First, make sure you have a backup copy of the database you want to delete. Only then proceed with deletion. Read more about preparing for restoration in the <a href="postgresql.html#prepare-to-restore" class="topiclink">PostgreSQL</a> article.</p>
|
||||
<p class="p_Normal">To restore a database from a backup using WAL-G, do the following:</p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" class="p_Normal">Stop PostgreSQL if it is running:</li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">sudo systemctl stop postgresql</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="2" class="p_Normal">Move or delete the contents of the <code><b>/var/lib/postgresql/15/main</b></code> directory:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">sudo mv /var/lib/postgresql/15/main /var/lib/postgresql/15/main_old</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="3" class="p_Normal">Create an empty directory for recovery:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">sudo mkdir /var/lib/postgresql/15/main</span><br />
|
||||
<span class="f_CodeExample">sudo chown postgres:postgres /var/lib/postgresql/15/main</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="4" class="p_Normal">To view the list of database backups, run the command:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">sudo -u postgres /usr/local/bin/wal-g-pg backup-list --config /etc/postgresql/15/main/.walg.json</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="5" class="p_Normal">Run the restore command:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">sudo -u postgres /usr/local/bin/wal-g-pg backup-fetch /var/lib/postgresql/15/main LATEST --config /etc/postgresql/15/main/.walg.json</span></p>
|
||||
<p class="p_Normal" style="margin: 0 0 0 24px;">Here <code><b>LATEST</b></code> points to the last backup. You can also enter the name of the desired backup obtained from the list in the previous step, for example: <span style="font-weight: bold;">base_000000000100000000000000000000000000000009</span>.</p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="6" class="p_Normal">Start PostgreSQL:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">sudo systemctl start postgresql</span></p>
|
||||
<h2 class="p_Heading2"><a id="walg-mongo" class="hmanchor"></a><span class="f_Heading2">Configure WAL-G for MongoDB</span></h2>
|
||||
<p class="p_Normal">With WAL-G you can:</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal">Back up your data.</li><li class="p_Normal"><a href="backup-and-recovery-with-wal-g-and-rclone.html#mongo-restore" class="topiclink">Restore data from a backup</a>.</li></ul>
|
||||
<h3 class="p_Heading3"><span class="f_Heading3">Backup for MongoDB</span></h3>
|
||||
<p class="p_Normal">To back up your data using WAL-G, follow these steps:</p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" class="p_Normal">Pre-install WAL-G from the <a href="https://github.com/wal-g/wal-g" target="_blank" class="weblink">official GitHub repository</a>:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">wget https://github.com/wal-g/wal-g/releases/download/v3.0.5/wal-g-mongo-ubuntu-22.04-amd64.tar.gz</span><br />
|
||||
<span class="f_CodeExample">tar -xzf wal-g-mongo-ubuntu-22.04-amd64.tar.gz</span><br />
|
||||
<span class="f_CodeExample">sudo mv wal-g-mongo-ubuntu-22.04-amd64 /usr/local/bin/wal-g-mongo</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="2">
|
||||
<li value="2" class="p_Normal">Configure environment variables to access the cloud storage. Open the configuration file <code><b>/home/user/.walg.json</b></code> and add the following parameters:</li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">{</span><br />
|
||||
<span class="f_CodeExample">“WALG_S3_PREFIX": ‘s3://elma365-backup/mongo’,</span><br />
|
||||
<span class="f_CodeExample">“AWS_ENDPOINT": ‘https://storage.yandexcloud.net’,</span><br />
|
||||
<span class="f_CodeExample">“AWS_ACCESS_KEY_ID": ‘<your-access-key-id>’,</span><br />
|
||||
<span class="f_CodeExample">“AWS_SECRET_ACCESS_KEY“:”<your-secret-access-key>”,</span><br />
|
||||
<span class="f_CodeExample">“AWS_REGION": ‘us-east-1’,</span><br />
|
||||
<span class="f_CodeExample">“AWS_S3_FORCE_PATH_STYLE": ‘true’,</span><br />
|
||||
<span class="f_CodeExample">“WALG_COMPRESSION_METHOD": ‘brotli’,</span><br />
|
||||
<span class="f_CodeExample">“MONGODB_URI": ‘mongodb://superuser:SecretPassword@mongodb-server.your_domain:27017/?authSource=admin&connect=direct&socketTimeoutMS=60000&connectTimeoutMS=10000’</span><br />
|
||||
<span class="f_CodeExample">“WALG_STREAM_CREATE_COMMAND“: ‘mongodump --archive --oplog --uri=’mongodb://superuser:SecretPassword@mongodb-server.your_domain:27017/?authSource=admin&connectTimeoutMS=10000'”</span><br />
|
||||
<span class="f_CodeExample">“WALG_STREAM_RESTORE_COMMAND": ‘mongorestore --archive --oplogReplay --uri=’mongodb://superuser:SecretPassword@mongodb-server.your_domain:27017/?authSource=admin&connectTimeoutMS=10000'”</span><br />
|
||||
<span class="f_CodeExample">}</span></p>
|
||||
<p class="p_Normal" style="margin: 0 0 0 32px;">Where:</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal"><code><b>WALG_S3_PREFIX</b></code> specifies the path to S3 where the backups and <span style="font-weight: bold;">.WAL</span> files (Write-Ahead Logs) will be stored.</li><li class="p_Normal"><code><b>AWS_ENDPOINT</b></code> specifies the endpoint for S3-compatible storage.</li><li class="p_Normal"><code><b>AWS_ACCESS_KEY_ID</b></code> access Key ID for authentication to S3-compliant storage.</li><li class="p_Normal"><code><b>AWS_SECRET_ACCESS_KEY</b></code> is the secret Access Key for authentication in S3-compliant storage.</li><li class="p_Normal"><code><b>AWS_REGION</b></code> is the region where the S3-compatible storage is located.</li><li class="p_Normal"><code><b>AWS_S3_S3_FORCE_PATH_STYLE</b></code> indicates that the path style should be used to access S3 buckets.</li><li class="p_Normal"><code><b>WALG_COMPRESSION_METHOD</b></code> is the compression method used for backups. In this case, the <code><b>Brotli</b></code> algorithm is used, which provides a good balance between compression ratio and speed.</li><li class="p_Normal"><code><b>MONGODB_URI</b></code> is the URI to connect to MongoDB.</li><li class="p_Normal"><code><b>WALG_STREAM_CREATE_COMMAND</b></code> is the command used by WAL-G to back up MongoDB.</li><li class="p_Normal"><code><b>ALG_STREAM_RESTORE_COMMAND</b></code> is the command used by the WAL-G to restore a MongoDB backup.</li></ul>
|
||||
<ol style="list-style-type:upper-roman" start="3">
|
||||
<li value="3" class="p_Normal">To create a full database backup, run the command:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">/usr/local/bin/wal-g-mongo backup-push --config /home/user/.walg.json</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="4">
|
||||
<li value="4" class="p_Normal">To view the list of database backups, run the command:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">/usr/local/bin/wal-g-mongo backup-list --config /home/user/.walg.json</span></p>
|
||||
<h3 class="p_Heading3"><a id="mongo-restore" class="hmanchor"></a><span class="f_Heading3">Data restore for MongoDB</span></h3>
|
||||
<p class="p_Normal"><span style="font-weight: bold;">Important</span>: restore from backup to an empty database. First, make sure you have a backup of the database you want to delete. Only then proceed with deletion. Read more about preparing for restoration in the <a href="mongodb.html#prepare-to-restore" class="topiclink">MongoDB</a> article.</p>
|
||||
<p class="p_Normal">To restore a database from a backup, run the command:</p>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">/usr/local/bin/wal-g-mongo backup-fetch LATEST --config /home/user/.walg.json</span></p>
|
||||
<p class="p_Normal">Here <code><b>LATEST</b></code> indicates the last backup. You can also specify the name of the desired backup obtained from the list in the previous step, for example: <span style="font-weight: bold;">stream_20250214T093724Z</span>.</p>
|
||||
<h2 class="p_Heading2"><a id="rclone" class="hmanchor"></a><span class="f_Heading2">Configure Rclone</span></h2>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" class="p_Normal">Install Rclone using the command:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">sudo -v ; curl https://rclone.org/install.sh | sudo bash</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="2">
|
||||
<li value="2" class="p_Normal">Configure Rclone to work with S3:</li></ol>
|
||||
<ol style="list-style-type:decimal">
|
||||
<li value="1" class="p_Normal">To configure the new S3 storage, run the command:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">rclone config</span></p>
|
||||
<ol style="list-style-type:decimal" start="2">
|
||||
<li value="2" class="p_Normal">In the opened window, select the <span style="font-weight: bold;">n</span> option to create a new storage.</li><li value="3" class="p_Normal">Enter a name for your storage. For example <span style="font-weight: bold;">source-s3</span> for the source repository and <span style="font-weight: bold;">backup-s3</span> for the target repository.</li><li value="4" class="p_Normal">Select the <span style="font-weight: bold;">s3 </span>storage type.</li><li value="5" class="p_Normal">Select the <span style="font-weight: bold;">Other </span>provider.</li><li value="6" class="p_Normal">Enter the access parameters for your s3 storage:</li></ol>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal"><code><b>access_key_id</b></code> is your access key identifier.</li><li class="p_Normal"><code><b>secret_access_key</b></code> is your secret key.</li><li class="p_Normal"><code><b>region</b></code> is the region of your S3 storage.</li><li class="p_Normal"><code><b>endpoint</b></code> specifies the access point of your S3 storage.</li></ul>
|
||||
<ol style="list-style-type:decimal" start="7">
|
||||
<li value="7" class="p_Normal">Repeat the steps to configure the second S3 storage.</li></ol>
|
||||
<ol style="list-style-type:upper-roman" start="3">
|
||||
<li value="3" class="p_Normal">Copy data from one S3 storage to another using the <code><b>rclone copy</b></code> command:</li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">rclone copy source-s3:bucket-name/path backup-s3:backup-bucket-name/path -v --ignore-errors --fast-list --checksum</span></p>
|
||||
<p class="p_Normal" style="margin: 0 0 0 23px;">Where:</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal"><code><b>source-s3</b></code> is the name of the remote storage configured for source S3.</li><li class="p_Normal"><code><b>bucket-name/path</b></code> is the bucket name and path to the data in the source storage.</li><li class="p_Normal"><code><b>backup-s3</b></code> is the name of remote storage configured for target S3.</li><li class="p_Normal"><code><b>backup-bucket-name/path</b></code> is the bucket name and path for the backup in the target storage.</li><li class="p_Normal"><code><b>-v</b></code> enables detailed output (verbose mode).</li><li class="p_Normal"><code><b>--ignore-errors</b></code> ignores errors occurring during command execution.</li><li class="p_Normal"><code><b>--fast-list</b></code> speeds up the process of creating a list of files and directories, especially when working with cloud storage such as S3, Google Drive and others.</li><li class="p_Normal"><code><b>--checksum</b></code> enables checksum (hash) checking of files when copying or synchronizing. </li></ul>
|
||||
|
||||
<div class="bottom-nav">
|
||||
|
||||
<a id="prev-link" class="topic__navi_prev" href="database-backup-and-recovery.html">
|
||||
<span class="bottom-nav__arrow bottom-nav__arrow--prev"></span> <span
|
||||
class="bottom-nav__link">database-backup-and-recovery.html</span>
|
||||
</a>
|
||||
|
||||
|
||||
<a id="next-link" class="topic__navi_next" href="dump_db.html">
|
||||
<span class="bottom-nav__link">dump_db.html</span> <span
|
||||
class="bottom-nav__arrow bottom-nav__arrow--next"></span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<!-- добавляет на страницу строку блок Была ли статья полезной? -->
|
||||
<div class="feedback" id="feedback"><div class="feedback-help"><span><b>Was this helpful?</b></span><form action="" method="POST" class="feedback-form" id="feedback-form"><div class="feedback__popup feedback__popup-response" id="feedback__popup_thx" style="display: none;">Thanks for your feedback!</div><div class="feedback__popup" id="feedback__popup_why" style="display: none;"><div class="feedback__popup-header">Please specify why:</div><input type="radio" name="category" id="bad_recommendation" value="bad_recommendation"><label for="bad_recommendation">Recommendations did not help me</label><input type="radio" name="category" id="difficult_text" value="difficult_text"><label for="difficult_text">Article is hard to understand</label><input type="radio" name="category" id="no_answer" value="no_answer"><label for="no_answer">Didn`t answer my question</label><input type="radio" name="category" id="bad_header" value="bad_header"><label for="bad_header">Content does not match the topic</label><input type="radio" name="category" id="other_reason" value="other_reason"><label for="other_reason">Other</label></div><div class="feedback__popup" id="feedback__popup-other" style="display: none;"><div class="feedback__popup-header">How we can improve it?</div><textarea class="feedback__textarea" name="other" id=""></textarea><input type="submit" class="feedback__other-btn" value="Submit"></div><div class="feedback-form__btn-group"><input type="radio" name="useful" id="feedback__useful_yes" value="true"><label for="feedback__useful_yes"><img src="like.svg" class="small-img" alt="like"><spanclass="feedback-form__btn-group_yes-btn">Yes</spanclass="feedback-form__btn-group_yes-btn"></label><input type="radio" name="useful" id="feedback__useful_no" value="false"><label for="feedback__useful_no"><img src="dislike.svg" class="small-img" alt="dislike"><spanclass="feedback-form__btn-group_no-btn">No</spanclass="feedback-form__btn-group_no-btn"></label></div><select name="category"><option disabled="">Please specify why</option><option value="bad_recommendation" selected="">Recommendations did not help me</option><option value="difficult_text">Article is hard to understand</option><option value="no_answer">Didn`t answer my question</option><option value="bad_header">Content does not match the topic</option><option value="other_reason">Other</option></select><input type="submit"></form></div><div class="found_typo"><p style="margin: 0px; margin-top: 16px !important;"><span><b>Found a typo?</b></span> Select it and press <i>Ctrl+Enter</i> to send us feedback</p></div></div>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
<aside class="article__sidebar" style="display:none">
|
||||
<input type="checkbox" />
|
||||
<div class="article__arrow"></div>
|
||||
<div class="table-of-contents elma365-right" id="toc2Content">
|
||||
<h3 class="h3-toc">In this topic</h3>
|
||||
<nav id="toc2"></nav>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</article>
|
||||
</main>
|
||||
<footer class="footer">
|
||||
<div class="footer-container">
|
||||
<div class="footer-mobile">
|
||||
|
||||
<ul class="footer-mobile__list"><li><a href="https://brix365.com/en/" target="_blank">BRIX</a></li><li><a href="https://tssdk.brix365.com/en/latest/" target="_blank">SDK</a></li><li><a href="https://api.brix365.com/en/" target="_blank">API</a></li></ul><ul class="footer-mobile__list"><li><a href="https://brix365.com/en/help/platform/get-trial.html">Platform</a></li><li><a href="https://brix365.com/en/help/ecm/ecm-functions.html">ECM</a></li><li><a href="https://brix365.com/en/help/service/service-functions.html">Service</a></li><li><a href="https://brix365.com/en/help/projects/projects-functions.html">Projects</a></li></ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="footer-wrap">
|
||||
|
||||
<div><span class="mobile-question-popup">Send feedback</span><form method="POST" action class="question__popup question-xs" id="question__popup"><div class="question-wrap"><span class="close"></span><span class="title">Ask a question</span><label for="help_question" style="display: none;"></label><textarea name="help_question" id="help_question"></textarea><input type="submit" value="Send"></div></form><div class="hidden fade-in question-success-xs">Sent</div></div>
|
||||
|
||||
<div class="footer-flex-b">
|
||||
<span class="footer-copy">© 2025 BRIX</span>
|
||||
<ul class="footer-list">
|
||||
|
||||
<li class="footer-item">
|
||||
<a href="#" class="arrow-top" style="display: block;"></a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
<iframe name="hmnavigation" style="display:none!important"></iframe>
|
||||
<script src="./jquery-ui.js"></script>
|
||||
<!--script src="//cdn.jsdelivr.net/npm/featherlight@1.7.14/release/featherlight.min.js" type="text/javascript" charset="utf-8"></script-->
|
||||
<script src="./jquery.tocify.min.js"></script>
|
||||
<script src="./TypoReporter.min.js"></script>
|
||||
<script src="./google-search.js"></script>
|
||||
<script src="./main.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user