-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Synapse database maintenance tools
List of useful tools and scripts for maintenance Synapse database:
The purge remote media API allows server admins to purge old cached remote 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.
Warning 1, 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.
Warning 2, what contents, the next command applies to local_content local_thumbnails remote_content remote_thumbnail
(that are the subdirectories of media directory), remote content should use Purge History API, and maybe you want to delete just the local_content
?
find /path/to/synapse/media_store -atime +365 -delete
This will delete media that hasn't been accessed in 365 days.
I think this section is missing some coherence with the database structure
The purge history API allows server admins to purge historic events from their database, reclaiming disk space.
- this project is unmantained and dangerous
- USE WITH CAUTION. It may cause database corruption (see https://github.com/matrix-org/synapse/issues/7305 for example).
- "Our team hasn't used any of these scripts for some time (possibly years) (...) if anyone wants to volunteer to maintain this repo I'd be happy to transfer ownership.
Cleans a synapse Postgres database of deleted messages and abandoned rooms.
Delete images and thumbnails created by URL previews in Synapse
NOTE: This is not required anymore as of Synapse 0.24, it now deletes those images by itself.
Tool for compressing (deduplicating) state_groups_state
table.
Some easy SQL queries that reports useful stat about Matrix Synapse database.