mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 11:17:51 +00:00
deploy: 5ef2f87569
This commit is contained in:
1 parent
79c12e8ee6
commit
5266b3761e
4 files changed
+192
-2
No files matched your search
@@ -4184,6 +4184,101 @@ see <a href="usage/configuration/../../postgres.html">here</a>.</p>
|
||||
cp_max: 10
|
||||
</code></pre>
|
||||
<hr />
|
||||
<h3 id="databases"><a class="header" href="#databases"><code>databases</code></a></h3>
|
||||
<p>The <code>databases</code> option allows specifying a mapping between certain database tables and
|
||||
database host details, spreading the load of a single Synapse instance across multiple
|
||||
database backends. This is often referred to as "database sharding". This option is only
|
||||
supported for PostgreSQL database backends.</p>
|
||||
<p><strong>Important note:</strong> This is a supported option, but is not currently used in production by the
|
||||
Matrix.org Foundation. Proceed with caution and always make backups.</p>
|
||||
<p><code>databases</code> is a dictionary of arbitrarily-named database entries. Each entry is equivalent
|
||||
to the value of the <code>database</code> homeserver config option (see above), with the addition of
|
||||
a <code>data_stores</code> key. <code>data_stores</code> is an array of strings that specifies the data store(s)
|
||||
(a defined label for a set of tables) that should be stored on the associated database
|
||||
backend entry.</p>
|
||||
<p>The currently defined values for <code>data_stores</code> are:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>"state"</code>: Database that relates to state groups will be stored in this database.</p>
|
||||
<p>Specifically, that means the following tables:</p>
|
||||
<ul>
|
||||
<li><code>state_groups</code></li>
|
||||
<li><code>state_group_edges</code></li>
|
||||
<li><code>state_groups_state</code></li>
|
||||
</ul>
|
||||
<p>And the following sequences:</p>
|
||||
<ul>
|
||||
<li><code>state_groups_seq_id</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>"main"</code>: All other database tables and sequences.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>All databases will end up with additional tables used for tracking database schema migrations
|
||||
and any pending background updates. Synapse will create these automatically on startup when checking for
|
||||
and/or performing database schema migrations.</p>
|
||||
<p>To migrate an existing database configuration (e.g. all tables on a single database) to a different
|
||||
configuration (e.g. the "main" data store on one database, and "state" on another), do the following:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Take a backup of your existing database. Things can and do go wrong and database corruption is no joke!</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Ensure all pending database migrations have been applied and background updates have run. The simplest
|
||||
way to do this is to use the <code>update_synapse_database</code> script supplied with your Synapse installation.</p>
|
||||
<pre><code class="language-sh">update_synapse_database --database-config homeserver.yaml --run-background-updates
|
||||
</code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy over the necessary tables and sequences from one database to the other. Tables relating to database
|
||||
migrations, schemas, schema versions and background updates should <strong>not</strong> be copied.</p>
|
||||
<p>As an example, say that you'd like to split out the "state" data store from an existing database which
|
||||
currently contains all data stores.</p>
|
||||
<p>Simply copy the tables and sequences defined above for the "state" datastore from the existing database
|
||||
to the secondary database. As noted above, additional tables will be created in the secondary database
|
||||
when Synapse is started.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Modify/create the <code>databases</code> option in your <code>homeserver.yaml</code> to match the desired database configuration.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Start Synapse. Check that it starts up successfully and that things generally seem to be working.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Drop the old tables that were copied in step 3.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<p>Only one of the options <code>database</code> or <code>databases</code> may be specified in your config, but not both.</p>
|
||||
<p>Example configuration:</p>
|
||||
<pre><code class="language-yaml">databases:
|
||||
basement_box:
|
||||
name: psycopg2
|
||||
txn_limit: 10000
|
||||
data_stores: ["main"]
|
||||
args:
|
||||
user: synapse_user
|
||||
password: secretpassword
|
||||
database: synapse_main
|
||||
host: localhost
|
||||
port: 5432
|
||||
cp_min: 5
|
||||
cp_max: 10
|
||||
|
||||
my_other_database:
|
||||
name: psycopg2
|
||||
txn_limit: 10000
|
||||
data_stores: ["state"]
|
||||
args:
|
||||
user: synapse_user
|
||||
password: secretpassword
|
||||
database: synapse_state
|
||||
host: localhost
|
||||
port: 5432
|
||||
cp_min: 5
|
||||
cp_max: 10
|
||||
</code></pre>
|
||||
<hr />
|
||||
<h2 id="logging"><a class="header" href="#logging">Logging</a></h2>
|
||||
<p>Config options related to logging. </p>
|
||||
<hr />
|
||||
|
||||
@@ -1 +1 @@
|
||||
Object.assign(window.search, {"doc_urls":["welcome_and_overview.html#introduction","welcome_and_overview.html#installing-and-using-synapse","welcome_and_overview.html#developing-on-synapse","welcome_and_overview.html#donating-to-synapse-development","welcome_and_overview.html#reporting-a-security-vulnerability","setup/installation.html#installation-instructions","setup/installation.html#choosing-your-server-name","setup/installation.html#installing-synapse","setup/installation.html#prebuilt-packages","setup/installation.html#installing-as-a-python-module-from-pypi","setup/installation.html#setting-up-synapse","setup/installation.html#using-postgresql","setup/installation.html#tls-certificates","setup/installation.html#client-well-known-uri","setup/installation.html#email","setup/installation.html#registering-a-user","setup/installation.html#setting-up-a-turn-server","setup/installation.html#url-previews","setup/installation.html#troubleshooting-installation","postgres.html#using-postgres","postgres.html#install-postgres-client-libraries","postgres.html#set-up-database","postgres.html#synapse-config","postgres.html#tuning-postgres","postgres.html#porting-from-sqlite","postgres.html#overview","postgres.html#using-the-port-script","postgres.html#troubleshooting","postgres.html#alternative-auth-methods","postgres.html#fixing-incorrect-collate-or-ctype","postgres.html#fixing-inconsistent-sequences-error","reverse_proxy.html#using-a-reverse-proxy-with-synapse","reverse_proxy.html#homeserver-configuration","reverse_proxy.html#reverse-proxy-configuration-examples","reverse_proxy.html#nginx","reverse_proxy.html#caddy-v1","reverse_proxy.html#caddy-v2","reverse_proxy.html#apache","reverse_proxy.html#haproxy","reverse_proxy.html#relayd","reverse_proxy.html#health-check-endpoint","reverse_proxy.html#synapse-administration-endpoints","setup/forward_proxy.html#using-a-forward-proxy-with-synapse","setup/forward_proxy.html#configure","setup/forward_proxy.html#connection-types","setup/forward_proxy.html#troubleshooting","turn-howto.html#overview","turn-howto.html#requirements","turn-howto.html#coturn-setup","turn-howto.html#initial-installation","turn-howto.html#configuration","turn-howto.html#synapse-setup","turn-howto.html#troubleshooting","delegate.html#delegation-of-incoming-federation-traffic","delegate.html#well-known-delegation","delegate.html#external-server","delegate.html#serving-a-well-knownmatrixserver-file-with-synapse","delegate.html#srv-dns-record-delegation","delegate.html#delegation-faq","delegate.html#when-do-i-need-delegation","delegate.html#should-i-use-a-reverse-proxy-for-federation-traffic","upgrade.html#upgrading-synapse","upgrade.html#rolling-back-to-older-versions","upgrade.html#upgrading-to-v1620","upgrade.html#new-signatures-for-spam-checker-callbacks","upgrade.html#upgrading-to-v1610","upgrade.html#removal-of-deprecated-communitygroups","upgrade.html#worker-endpoints","upgrade.html#upgrading-to-v1600","upgrade.html#adding-a-new-unique-index-to-state_group_edges-could-fail-if-your-database-is-corrupted","upgrade.html#on-postgres","upgrade.html#on-sqlite","upgrade.html#for-more-details","upgrade.html#new-signature-for-the-spam-checker-callback-check_event_for_spam","upgrade.html#upgrading-to-v1590","upgrade.html#device-name-lookup-over-federation-has-been-disabled-by-default","upgrade.html#deprecation-of-the-synapseappappservice-and-synapseappuser_dir-worker-application-types","upgrade.html#upgrading-to-v1580","upgrade.html#groupscommunities-feature-has-been-disabled-by-default","upgrade.html#upgrading-to-v1570","upgrade.html#changes-to-database-schema-for-application-services","upgrade.html#upgrading-to-v1560","upgrade.html#open-registration-without-verification-is-now-disabled-by-default","upgrade.html#groupscommunities-feature-has-been-deprecated","upgrade.html#change-in-behaviour-for-postgresql-databases-with-unsafe-locale","upgrade.html#upgrading-to-v1550","upgrade.html#synctl-script-has-been-moved","upgrade.html#compatibility-dropped-for-mjolnir-131-and-earlier","upgrade.html#upgrading-to-v1540","upgrade.html#legacy-structured-logging-configuration-removal","upgrade.html#upgrading-to-v1530","upgrade.html#dropping-support-for-webclient-listeners-and-non-https-web_client_location","upgrade.html#stablisation-of-msc3231","upgrade.html#time-based-cache-expiry-is-now-enabled-by-default","upgrade.html#deprecation-of-capability-orgmatrixmsc3283","upgrade.html#removal-of-user_may_create_room_with_invites","upgrade.html#upgrading-to-v1520","upgrade.html#twisted-security-release","upgrade.html#upgrading-to-v1510","upgrade.html#deprecation-of-webclient-listeners-and-non-https-web_client_location","upgrade.html#upgrading-to-v1500","upgrade.html#dropping-support-for-old-python-and-postgres-versions","upgrade.html#upgrading-to-v1470","upgrade.html#removal-of-old-room-admin-api","upgrade.html#deprecation-of-the-user_may_create_room_with_invites-module-callback","upgrade.html#upgrading-to-v1450","upgrade.htmlLine truncated
|
||||
Object.assign(window.search, {"doc_urls":["welcome_and_overview.html#introduction","welcome_and_overview.html#installing-and-using-synapse","welcome_and_overview.html#developing-on-synapse","welcome_and_overview.html#donating-to-synapse-development","welcome_and_overview.html#reporting-a-security-vulnerability","setup/installation.html#installation-instructions","setup/installation.html#choosing-your-server-name","setup/installation.html#installing-synapse","setup/installation.html#prebuilt-packages","setup/installation.html#installing-as-a-python-module-from-pypi","setup/installation.html#setting-up-synapse","setup/installation.html#using-postgresql","setup/installation.html#tls-certificates","setup/installation.html#client-well-known-uri","setup/installation.html#email","setup/installation.html#registering-a-user","setup/installation.html#setting-up-a-turn-server","setup/installation.html#url-previews","setup/installation.html#troubleshooting-installation","postgres.html#using-postgres","postgres.html#install-postgres-client-libraries","postgres.html#set-up-database","postgres.html#synapse-config","postgres.html#tuning-postgres","postgres.html#porting-from-sqlite","postgres.html#overview","postgres.html#using-the-port-script","postgres.html#troubleshooting","postgres.html#alternative-auth-methods","postgres.html#fixing-incorrect-collate-or-ctype","postgres.html#fixing-inconsistent-sequences-error","reverse_proxy.html#using-a-reverse-proxy-with-synapse","reverse_proxy.html#homeserver-configuration","reverse_proxy.html#reverse-proxy-configuration-examples","reverse_proxy.html#nginx","reverse_proxy.html#caddy-v1","reverse_proxy.html#caddy-v2","reverse_proxy.html#apache","reverse_proxy.html#haproxy","reverse_proxy.html#relayd","reverse_proxy.html#health-check-endpoint","reverse_proxy.html#synapse-administration-endpoints","setup/forward_proxy.html#using-a-forward-proxy-with-synapse","setup/forward_proxy.html#configure","setup/forward_proxy.html#connection-types","setup/forward_proxy.html#troubleshooting","turn-howto.html#overview","turn-howto.html#requirements","turn-howto.html#coturn-setup","turn-howto.html#initial-installation","turn-howto.html#configuration","turn-howto.html#synapse-setup","turn-howto.html#troubleshooting","delegate.html#delegation-of-incoming-federation-traffic","delegate.html#well-known-delegation","delegate.html#external-server","delegate.html#serving-a-well-knownmatrixserver-file-with-synapse","delegate.html#srv-dns-record-delegation","delegate.html#delegation-faq","delegate.html#when-do-i-need-delegation","delegate.html#should-i-use-a-reverse-proxy-for-federation-traffic","upgrade.html#upgrading-synapse","upgrade.html#rolling-back-to-older-versions","upgrade.html#upgrading-to-v1620","upgrade.html#new-signatures-for-spam-checker-callbacks","upgrade.html#upgrading-to-v1610","upgrade.html#removal-of-deprecated-communitygroups","upgrade.html#worker-endpoints","upgrade.html#upgrading-to-v1600","upgrade.html#adding-a-new-unique-index-to-state_group_edges-could-fail-if-your-database-is-corrupted","upgrade.html#on-postgres","upgrade.html#on-sqlite","upgrade.html#for-more-details","upgrade.html#new-signature-for-the-spam-checker-callback-check_event_for_spam","upgrade.html#upgrading-to-v1590","upgrade.html#device-name-lookup-over-federation-has-been-disabled-by-default","upgrade.html#deprecation-of-the-synapseappappservice-and-synapseappuser_dir-worker-application-types","upgrade.html#upgrading-to-v1580","upgrade.html#groupscommunities-feature-has-been-disabled-by-default","upgrade.html#upgrading-to-v1570","upgrade.html#changes-to-database-schema-for-application-services","upgrade.html#upgrading-to-v1560","upgrade.html#open-registration-without-verification-is-now-disabled-by-default","upgrade.html#groupscommunities-feature-has-been-deprecated","upgrade.html#change-in-behaviour-for-postgresql-databases-with-unsafe-locale","upgrade.html#upgrading-to-v1550","upgrade.html#synctl-script-has-been-moved","upgrade.html#compatibility-dropped-for-mjolnir-131-and-earlier","upgrade.html#upgrading-to-v1540","upgrade.html#legacy-structured-logging-configuration-removal","upgrade.html#upgrading-to-v1530","upgrade.html#dropping-support-for-webclient-listeners-and-non-https-web_client_location","upgrade.html#stablisation-of-msc3231","upgrade.html#time-based-cache-expiry-is-now-enabled-by-default","upgrade.html#deprecation-of-capability-orgmatrixmsc3283","upgrade.html#removal-of-user_may_create_room_with_invites","upgrade.html#upgrading-to-v1520","upgrade.html#twisted-security-release","upgrade.html#upgrading-to-v1510","upgrade.html#deprecation-of-webclient-listeners-and-non-https-web_client_location","upgrade.html#upgrading-to-v1500","upgrade.html#dropping-support-for-old-python-and-postgres-versions","upgrade.html#upgrading-to-v1470","upgrade.html#removal-of-old-room-admin-api","upgrade.html#deprecation-of-the-user_may_create_room_with_invites-module-callback","upgrade.html#upgrading-to-v1450","upgrade.htmlLine truncated
|
||||
@@ -1 +1 @@
|
||||
{"doc_urls":["welcome_and_overview.html#introduction","welcome_and_overview.html#installing-and-using-synapse","welcome_and_overview.html#developing-on-synapse","welcome_and_overview.html#donating-to-synapse-development","welcome_and_overview.html#reporting-a-security-vulnerability","setup/installation.html#installation-instructions","setup/installation.html#choosing-your-server-name","setup/installation.html#installing-synapse","setup/installation.html#prebuilt-packages","setup/installation.html#installing-as-a-python-module-from-pypi","setup/installation.html#setting-up-synapse","setup/installation.html#using-postgresql","setup/installation.html#tls-certificates","setup/installation.html#client-well-known-uri","setup/installation.html#email","setup/installation.html#registering-a-user","setup/installation.html#setting-up-a-turn-server","setup/installation.html#url-previews","setup/installation.html#troubleshooting-installation","postgres.html#using-postgres","postgres.html#install-postgres-client-libraries","postgres.html#set-up-database","postgres.html#synapse-config","postgres.html#tuning-postgres","postgres.html#porting-from-sqlite","postgres.html#overview","postgres.html#using-the-port-script","postgres.html#troubleshooting","postgres.html#alternative-auth-methods","postgres.html#fixing-incorrect-collate-or-ctype","postgres.html#fixing-inconsistent-sequences-error","reverse_proxy.html#using-a-reverse-proxy-with-synapse","reverse_proxy.html#homeserver-configuration","reverse_proxy.html#reverse-proxy-configuration-examples","reverse_proxy.html#nginx","reverse_proxy.html#caddy-v1","reverse_proxy.html#caddy-v2","reverse_proxy.html#apache","reverse_proxy.html#haproxy","reverse_proxy.html#relayd","reverse_proxy.html#health-check-endpoint","reverse_proxy.html#synapse-administration-endpoints","setup/forward_proxy.html#using-a-forward-proxy-with-synapse","setup/forward_proxy.html#configure","setup/forward_proxy.html#connection-types","setup/forward_proxy.html#troubleshooting","turn-howto.html#overview","turn-howto.html#requirements","turn-howto.html#coturn-setup","turn-howto.html#initial-installation","turn-howto.html#configuration","turn-howto.html#synapse-setup","turn-howto.html#troubleshooting","delegate.html#delegation-of-incoming-federation-traffic","delegate.html#well-known-delegation","delegate.html#external-server","delegate.html#serving-a-well-knownmatrixserver-file-with-synapse","delegate.html#srv-dns-record-delegation","delegate.html#delegation-faq","delegate.html#when-do-i-need-delegation","delegate.html#should-i-use-a-reverse-proxy-for-federation-traffic","upgrade.html#upgrading-synapse","upgrade.html#rolling-back-to-older-versions","upgrade.html#upgrading-to-v1620","upgrade.html#new-signatures-for-spam-checker-callbacks","upgrade.html#upgrading-to-v1610","upgrade.html#removal-of-deprecated-communitygroups","upgrade.html#worker-endpoints","upgrade.html#upgrading-to-v1600","upgrade.html#adding-a-new-unique-index-to-state_group_edges-could-fail-if-your-database-is-corrupted","upgrade.html#on-postgres","upgrade.html#on-sqlite","upgrade.html#for-more-details","upgrade.html#new-signature-for-the-spam-checker-callback-check_event_for_spam","upgrade.html#upgrading-to-v1590","upgrade.html#device-name-lookup-over-federation-has-been-disabled-by-default","upgrade.html#deprecation-of-the-synapseappappservice-and-synapseappuser_dir-worker-application-types","upgrade.html#upgrading-to-v1580","upgrade.html#groupscommunities-feature-has-been-disabled-by-default","upgrade.html#upgrading-to-v1570","upgrade.html#changes-to-database-schema-for-application-services","upgrade.html#upgrading-to-v1560","upgrade.html#open-registration-without-verification-is-now-disabled-by-default","upgrade.html#groupscommunities-feature-has-been-deprecated","upgrade.html#change-in-behaviour-for-postgresql-databases-with-unsafe-locale","upgrade.html#upgrading-to-v1550","upgrade.html#synctl-script-has-been-moved","upgrade.html#compatibility-dropped-for-mjolnir-131-and-earlier","upgrade.html#upgrading-to-v1540","upgrade.html#legacy-structured-logging-configuration-removal","upgrade.html#upgrading-to-v1530","upgrade.html#dropping-support-for-webclient-listeners-and-non-https-web_client_location","upgrade.html#stablisation-of-msc3231","upgrade.html#time-based-cache-expiry-is-now-enabled-by-default","upgrade.html#deprecation-of-capability-orgmatrixmsc3283","upgrade.html#removal-of-user_may_create_room_with_invites","upgrade.html#upgrading-to-v1520","upgrade.html#twisted-security-release","upgrade.html#upgrading-to-v1510","upgrade.html#deprecation-of-webclient-listeners-and-non-https-web_client_location","upgrade.html#upgrading-to-v1500","upgrade.html#dropping-support-for-old-python-and-postgres-versions","upgrade.html#upgrading-to-v1470","upgrade.html#removal-of-old-room-admin-api","upgrade.html#deprecation-of-the-user_may_create_room_with_invites-module-callback","upgrade.html#upgrading-to-v1450","upgrade.html#changes-required-to-media-stLine truncated
|
||||
{"doc_urls":["welcome_and_overview.html#introduction","welcome_and_overview.html#installing-and-using-synapse","welcome_and_overview.html#developing-on-synapse","welcome_and_overview.html#donating-to-synapse-development","welcome_and_overview.html#reporting-a-security-vulnerability","setup/installation.html#installation-instructions","setup/installation.html#choosing-your-server-name","setup/installation.html#installing-synapse","setup/installation.html#prebuilt-packages","setup/installation.html#installing-as-a-python-module-from-pypi","setup/installation.html#setting-up-synapse","setup/installation.html#using-postgresql","setup/installation.html#tls-certificates","setup/installation.html#client-well-known-uri","setup/installation.html#email","setup/installation.html#registering-a-user","setup/installation.html#setting-up-a-turn-server","setup/installation.html#url-previews","setup/installation.html#troubleshooting-installation","postgres.html#using-postgres","postgres.html#install-postgres-client-libraries","postgres.html#set-up-database","postgres.html#synapse-config","postgres.html#tuning-postgres","postgres.html#porting-from-sqlite","postgres.html#overview","postgres.html#using-the-port-script","postgres.html#troubleshooting","postgres.html#alternative-auth-methods","postgres.html#fixing-incorrect-collate-or-ctype","postgres.html#fixing-inconsistent-sequences-error","reverse_proxy.html#using-a-reverse-proxy-with-synapse","reverse_proxy.html#homeserver-configuration","reverse_proxy.html#reverse-proxy-configuration-examples","reverse_proxy.html#nginx","reverse_proxy.html#caddy-v1","reverse_proxy.html#caddy-v2","reverse_proxy.html#apache","reverse_proxy.html#haproxy","reverse_proxy.html#relayd","reverse_proxy.html#health-check-endpoint","reverse_proxy.html#synapse-administration-endpoints","setup/forward_proxy.html#using-a-forward-proxy-with-synapse","setup/forward_proxy.html#configure","setup/forward_proxy.html#connection-types","setup/forward_proxy.html#troubleshooting","turn-howto.html#overview","turn-howto.html#requirements","turn-howto.html#coturn-setup","turn-howto.html#initial-installation","turn-howto.html#configuration","turn-howto.html#synapse-setup","turn-howto.html#troubleshooting","delegate.html#delegation-of-incoming-federation-traffic","delegate.html#well-known-delegation","delegate.html#external-server","delegate.html#serving-a-well-knownmatrixserver-file-with-synapse","delegate.html#srv-dns-record-delegation","delegate.html#delegation-faq","delegate.html#when-do-i-need-delegation","delegate.html#should-i-use-a-reverse-proxy-for-federation-traffic","upgrade.html#upgrading-synapse","upgrade.html#rolling-back-to-older-versions","upgrade.html#upgrading-to-v1620","upgrade.html#new-signatures-for-spam-checker-callbacks","upgrade.html#upgrading-to-v1610","upgrade.html#removal-of-deprecated-communitygroups","upgrade.html#worker-endpoints","upgrade.html#upgrading-to-v1600","upgrade.html#adding-a-new-unique-index-to-state_group_edges-could-fail-if-your-database-is-corrupted","upgrade.html#on-postgres","upgrade.html#on-sqlite","upgrade.html#for-more-details","upgrade.html#new-signature-for-the-spam-checker-callback-check_event_for_spam","upgrade.html#upgrading-to-v1590","upgrade.html#device-name-lookup-over-federation-has-been-disabled-by-default","upgrade.html#deprecation-of-the-synapseappappservice-and-synapseappuser_dir-worker-application-types","upgrade.html#upgrading-to-v1580","upgrade.html#groupscommunities-feature-has-been-disabled-by-default","upgrade.html#upgrading-to-v1570","upgrade.html#changes-to-database-schema-for-application-services","upgrade.html#upgrading-to-v1560","upgrade.html#open-registration-without-verification-is-now-disabled-by-default","upgrade.html#groupscommunities-feature-has-been-deprecated","upgrade.html#change-in-behaviour-for-postgresql-databases-with-unsafe-locale","upgrade.html#upgrading-to-v1550","upgrade.html#synctl-script-has-been-moved","upgrade.html#compatibility-dropped-for-mjolnir-131-and-earlier","upgrade.html#upgrading-to-v1540","upgrade.html#legacy-structured-logging-configuration-removal","upgrade.html#upgrading-to-v1530","upgrade.html#dropping-support-for-webclient-listeners-and-non-https-web_client_location","upgrade.html#stablisation-of-msc3231","upgrade.html#time-based-cache-expiry-is-now-enabled-by-default","upgrade.html#deprecation-of-capability-orgmatrixmsc3283","upgrade.html#removal-of-user_may_create_room_with_invites","upgrade.html#upgrading-to-v1520","upgrade.html#twisted-security-release","upgrade.html#upgrading-to-v1510","upgrade.html#deprecation-of-webclient-listeners-and-non-https-web_client_location","upgrade.html#upgrading-to-v1500","upgrade.html#dropping-support-for-old-python-and-postgres-versions","upgrade.html#upgrading-to-v1470","upgrade.html#removal-of-old-room-admin-api","upgrade.html#deprecation-of-the-user_may_create_room_with_invites-module-callback","upgrade.html#upgrading-to-v1450","upgrade.html#changes-required-to-media-stLine truncated
|
||||
@@ -1173,6 +1173,101 @@ see <a href="../../postgres.html">here</a>.</p>
|
||||
cp_max: 10
|
||||
</code></pre>
|
||||
<hr />
|
||||
<h3 id="databases"><a class="header" href="#databases"><code>databases</code></a></h3>
|
||||
<p>The <code>databases</code> option allows specifying a mapping between certain database tables and
|
||||
database host details, spreading the load of a single Synapse instance across multiple
|
||||
database backends. This is often referred to as "database sharding". This option is only
|
||||
supported for PostgreSQL database backends.</p>
|
||||
<p><strong>Important note:</strong> This is a supported option, but is not currently used in production by the
|
||||
Matrix.org Foundation. Proceed with caution and always make backups.</p>
|
||||
<p><code>databases</code> is a dictionary of arbitrarily-named database entries. Each entry is equivalent
|
||||
to the value of the <code>database</code> homeserver config option (see above), with the addition of
|
||||
a <code>data_stores</code> key. <code>data_stores</code> is an array of strings that specifies the data store(s)
|
||||
(a defined label for a set of tables) that should be stored on the associated database
|
||||
backend entry.</p>
|
||||
<p>The currently defined values for <code>data_stores</code> are:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>"state"</code>: Database that relates to state groups will be stored in this database.</p>
|
||||
<p>Specifically, that means the following tables:</p>
|
||||
<ul>
|
||||
<li><code>state_groups</code></li>
|
||||
<li><code>state_group_edges</code></li>
|
||||
<li><code>state_groups_state</code></li>
|
||||
</ul>
|
||||
<p>And the following sequences:</p>
|
||||
<ul>
|
||||
<li><code>state_groups_seq_id</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>"main"</code>: All other database tables and sequences.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>All databases will end up with additional tables used for tracking database schema migrations
|
||||
and any pending background updates. Synapse will create these automatically on startup when checking for
|
||||
and/or performing database schema migrations.</p>
|
||||
<p>To migrate an existing database configuration (e.g. all tables on a single database) to a different
|
||||
configuration (e.g. the "main" data store on one database, and "state" on another), do the following:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Take a backup of your existing database. Things can and do go wrong and database corruption is no joke!</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Ensure all pending database migrations have been applied and background updates have run. The simplest
|
||||
way to do this is to use the <code>update_synapse_database</code> script supplied with your Synapse installation.</p>
|
||||
<pre><code class="language-sh">update_synapse_database --database-config homeserver.yaml --run-background-updates
|
||||
</code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy over the necessary tables and sequences from one database to the other. Tables relating to database
|
||||
migrations, schemas, schema versions and background updates should <strong>not</strong> be copied.</p>
|
||||
<p>As an example, say that you'd like to split out the "state" data store from an existing database which
|
||||
currently contains all data stores.</p>
|
||||
<p>Simply copy the tables and sequences defined above for the "state" datastore from the existing database
|
||||
to the secondary database. As noted above, additional tables will be created in the secondary database
|
||||
when Synapse is started.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Modify/create the <code>databases</code> option in your <code>homeserver.yaml</code> to match the desired database configuration.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Start Synapse. Check that it starts up successfully and that things generally seem to be working.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Drop the old tables that were copied in step 3.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<p>Only one of the options <code>database</code> or <code>databases</code> may be specified in your config, but not both.</p>
|
||||
<p>Example configuration:</p>
|
||||
<pre><code class="language-yaml">databases:
|
||||
basement_box:
|
||||
name: psycopg2
|
||||
txn_limit: 10000
|
||||
data_stores: ["main"]
|
||||
args:
|
||||
user: synapse_user
|
||||
password: secretpassword
|
||||
database: synapse_main
|
||||
host: localhost
|
||||
port: 5432
|
||||
cp_min: 5
|
||||
cp_max: 10
|
||||
|
||||
my_other_database:
|
||||
name: psycopg2
|
||||
txn_limit: 10000
|
||||
data_stores: ["state"]
|
||||
args:
|
||||
user: synapse_user
|
||||
password: secretpassword
|
||||
database: synapse_state
|
||||
host: localhost
|
||||
port: 5432
|
||||
cp_min: 5
|
||||
cp_max: 10
|
||||
</code></pre>
|
||||
<hr />
|
||||
<h2 id="logging"><a class="header" href="#logging">Logging</a></h2>
|
||||
<p>Config options related to logging. </p>
|
||||
<hr />
|
||||
|
||||
Reference in new issue
Block a user