This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
сервис_postgresql [2025/01/16 13:47] val [psql] |
сервис_postgresql [2025/04/07 16:12] (current) val [psql] |
||
---|---|---|---|
Line 2: | Line 2: | ||
* [[https://habr.com/ru/articles/578744/|Запускаем PostgreSQL в Docker: от простого к сложному]] | * [[https://habr.com/ru/articles/578744/|Запускаем PostgreSQL в Docker: от простого к сложному]] | ||
+ | * [[https://selectel.ru/blog/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04/|Установка и использование PostgreSQL]] и [[https://selectel.ru/blog/courses/dive-into-postgresql/|Погружение в PostgreSQL (Selectel)]] | ||
+ | * [[https://habr.com/ru/companies/oleg-bunin/articles/766898/|Операторы в Kubernetes]] и [[https://habr.com/ru/companies/flant/articles/684202/|Обзор операторов PostgreSQL для Kubernetes. Часть 3: CloudNativePG]] | ||
===== psql ===== | ===== psql ===== | ||
Line 9: | Line 11: | ||
<code> | <code> | ||
+ | $ sudo -u postgres psql | ||
+ | |||
postgres=# \l | postgres=# \l | ||
Line 14: | Line 18: | ||
blogs=# \dt | blogs=# \dt | ||
+ | |||
+ | blogs=# \d table_name | ||
+ | |||
+ | postgres=# ALTER USER postgres WITH PASSWORD 'strongpassword'; | ||
</code> | </code> | ||
+ | |||
+ | ===== Подключение по сети ===== | ||
+ | <code> | ||
+ | # diff postgresql.conf /etc/postgresql/15/main/postgresql.conf | ||
+ | 59a60 | ||
+ | > listen_addresses = '*' | ||
+ | |||
+ | # diff pg_hba.conf /etc/postgresql/15/main/pg_hba.conf | ||
+ | 97c97,98 | ||
+ | < host all all 127.0.0.1/32 scram-sha-256 | ||
+ | --- | ||
+ | > #host all all 127.0.0.1/32 scram-sha-256 | ||
+ | > host all all 0.0.0.0/0 scram-sha-256 | ||
+ | |||
+ | # systemctl restart postgresql | ||
+ | |||
+ | $ psql postgres://postgres:strongpassword@IP_OR_DNS_NAME:5432/postgres | ||
+ | </code> | ||
+ | |||
+ |