From f7a3b7ed7f4078d5022fdc4e6183c35975536a21 Mon Sep 17 00:00:00 2001 From: H-Shay Date: Wed, 1 Dec 2021 18:12:48 +0000 Subject: deploy: 84dc50e160a2ec6590813374b5a1e58b97f7a18d --- .../administration/database_maintenance_tools.html | 279 +++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 develop/usage/administration/database_maintenance_tools.html (limited to 'develop/usage/administration/database_maintenance_tools.html') diff --git a/develop/usage/administration/database_maintenance_tools.html b/develop/usage/administration/database_maintenance_tools.html new file mode 100644 index 0000000000..f9e86c1bc6 --- /dev/null +++ b/develop/usage/administration/database_maintenance_tools.html @@ -0,0 +1,279 @@ + + + + + + Database Maintenance Tools - Synapse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + +
+
+ +
+ +
+ +

This blog post by Victor Berger explains how to use many of the tools listed on this page: https://levans.fr/shrink-synapse-database.html

+

List of useful tools and scripts for maintenance Synapse database:

+

Purge Remote Media API

+

The purge remote media API allows server admins to purge old cached remote media.

+

Purge local media

+

There is no purge API for local media because you may be the only one with a copy. If you are sure you want to delete local media you could use something like the following to delete media that hasn't been accessed in a while.

+
find /path/to/synapse/media_store/local_content -atime +365 -delete
+find /path/to/synapse/media_store/local_thumbnails -atime +365 -delete
+
+

This will delete media that hasn't been accessed in 365 days.

+

Warning, check noatime flag: You also have to double-check that the filesystem where synapse's media store don't have noatime flag. Check it with mount, noatime is something that is usually enabled by default to reduce read-write operations in the filesystem for a feature is not so demanded.

+

Purge History API

+

The purge history API allows server admins to purge historic events from their database, reclaiming disk space.

+

synapse_janitor.sql

+ +

Cleans a synapse Postgres database of deleted messages and abandoned rooms.

+

synapse-compress-state

+

Tool for compressing (deduplicating) state_groups_state table.

+

SQL for analyzing Synapse PostgreSQL database stats

+

Some easy SQL that reports useful stat about Matrix Synapse database.

+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit 1.5.1