I am trying to setup synapse in my vps Ubuntu 20.04, synapse start ok with default sqlite3. But when I switch to postgres, it started fail with log, could you please help why I missing database config?
May 22 03:08:54 example.com matrix-synapse[1265]: Error in configuration:
May 22 03:08:54 example.com matrix-synapse[1265]: No database config provided
May 22 03:08:54 example.com systemd[1]: matrix-synapse.service: Main process exited, code=exited, status=1/FAILURE
I installed postgres
apt install libpq5 postgresql -y
su – postgres
createuser –pwprompt synapse
createdb –encoding=UTF8 –locale=C –template=template0 –owner=synapse synapse
check it with qspl /l, database synapse was created.
postgres=# l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
—————-+——————-+———-+————-+————-+———————–
matrix_synapse | matrix_synapse_rw | UTF8 | C | C |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
synapse | synapse | UTF8 | C | C |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
enable password authentication to synapse database.
cat /etc/postgresql/12/main/pg_hba.conf
host synapse synapse ::1/128 md5
check postgresql ok
~# ps -ef|grep postgresql
postgres 884 1 0 03:07 ? 00:00:00 /usr/lib/postgresql/12/bin/postgres -D /var/lib/postgresql/12/main -c config_file=/etc/postgresql/12/main/postgresql.conf
The I modify homeserver.yaml to postgres.
database:
name: psycopg2
args:
user: synapse
password: synapse
database: synapse
host: localhost
port: 5432
cp_min: 5
cp_max: 10
I tried the other user and database matrix_synapse, but still the same error. If I switch back to sqlite3, it started normally.
luo jacky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.