mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 20:13:46 +00:00 
			
		
		
		
	docs: Document wal-g restore process.
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							dd92036550
						
					
				
				
					commit
					bdb2c921ba
				
			| @@ -587,6 +587,53 @@ analysis of recent application-level data changes. | |||||||
| You may also want to adjust the [incremental backups][incremental] | You may also want to adjust the [incremental backups][incremental] | ||||||
| configuration. | configuration. | ||||||
|  |  | ||||||
|  | ### Restoring from wal-g backups | ||||||
|  |  | ||||||
|  | The following steps will restore the database from the latest | ||||||
|  | backup. Note that this process will _delete your current database_. | ||||||
|  |  | ||||||
|  | 1. As `root` on your database host, check your list of backups; the | ||||||
|  |    most recent will be listed at the bottom, and is what will be | ||||||
|  |    restored by the commands below. | ||||||
|  |  | ||||||
|  |    ```shell | ||||||
|  |    env-wal-g backup-list --pretty | ||||||
|  |    ``` | ||||||
|  |  | ||||||
|  | 1. Stop Zulip, if it is running. On your application host (which may | ||||||
|  |    or may not be different from your database host, depending on your | ||||||
|  |    configuration): | ||||||
|  |  | ||||||
|  |    ```shell | ||||||
|  |    /home/zulip/deployments/current/scripts/stop-server | ||||||
|  |    ``` | ||||||
|  |  | ||||||
|  | 1. As `root` on your database host, stop PostgreSQL: | ||||||
|  |  | ||||||
|  |    ```shell | ||||||
|  |    service postgresql stop | ||||||
|  |    ``` | ||||||
|  |  | ||||||
|  | 1. As `root` on your database host, delete the current database, and | ||||||
|  |    restore from the backup. This may take some time, depending on the | ||||||
|  |    size of your database and your connection to your backup storage. | ||||||
|  |  | ||||||
|  |    ```shell | ||||||
|  |    pg_version=$(crudini --get /etc/zulip/zulip.conf postgresql version) | ||||||
|  |    rm -rf "/var/lib/postgresql/$pg_version/main" | ||||||
|  |    env-wal-g backup-fetch "/var/lib/postgresql/$pg_version/main" LATEST | ||||||
|  |    chown -R postgres.postgres "/var/lib/postgresql/$pg_version/main" | ||||||
|  |    touch "/var/lib/postgresql/$pg_version/main/recovery.signal" | ||||||
|  |    service postgresql start | ||||||
|  |    ``` | ||||||
|  |  | ||||||
|  | 1. As `root` on your application host, flush caches and start Zulip: | ||||||
|  |  | ||||||
|  |    ```shell | ||||||
|  |    /home/zulip/deployments/current/scripts/setup/flush-memcached | ||||||
|  |    /home/zulip/deployments/current/scripts/start-server | ||||||
|  |    ``` | ||||||
|  |  | ||||||
| [wal]: https://www.postgresql.org/docs/current/wal-intro.html | [wal]: https://www.postgresql.org/docs/current/wal-intro.html | ||||||
| [archive-timeout]: https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-ARCHIVE-TIMEOUT | [archive-timeout]: https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-ARCHIVE-TIMEOUT | ||||||
| [mobile-push]: ../production/mobile-push-notifications.md | [mobile-push]: ../production/mobile-push-notifications.md | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user