> For the complete documentation index, see [llms.txt](https://docs.aamsystems.ru/passoffice/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aamsystems.ru/passoffice/passoffice-guide/admin-guide-doc/ustanovka-passoffice/sistemnye-trebovaniya/vneshnyaya-baza-dannykh-postgresql.md).

# Внешняя база данных PostgreSQL

PassOffice может использовать PostgreSQL, установленный на отдельном сервере.

При создании сервера PostgreSQL руководствуйтесь минимальными требованиями к [аппаратному и программному обеспечению](/passoffice/passoffice-guide/admin-guide-doc/ustanovka-passoffice/sistemnye-trebovaniya.md).

Установите и настройте PostrgeSQL требуемой версии, создайте базу данных и пользователя согласно официальной [инструкции производителя](https://www.postgresql.org/docs/current/tutorial-install.html).

В файле с настройками PassOffice `application.properties` укажите значения:

```properties
# PostgreSQL
passoffice.db.port=5432
passoffice.db.host=localhost
passoffice.db.name=passoffice
passoffice.db.user=postgres
passoffice.db.pw=1
```

где:

* `passoffice.db.host` - адрес сервера PostgreSQL;
* `passoffice.db.name` - имя созданной базы данных;
* `passoffice.db.user` - логин пользователя PostgreSQL;
* `passoffice.db.pw` - пароль пользователя PostgreSQL.

## Кластер PostgreSQL

PostgreSQL-кластер — это один или несколько хостов базы данных, между которыми можно настроить репликацию. Репликация работает по умолчанию в любом кластере из более чем одного хоста: хост-мастер принимает запросы на запись и дублирует изменения в репликах.

PassOffice поддерживает работу с кластером PostgreSQL. Для этого в файле с настройками PassOffice `application.properties` укажите в качестве значения `passoffice.db.url` строку типа:

```properties
# PostgreSQL

passoffice.db.url=jdbc:postgresql://pg-host-1:${passoffice.db.port},pg-host-2:${passoffice.db.port}/${passoffice.db.name}?targetServerType=master
```

где:

* `pg-host-1` и `pg-host-2` - адреса нод кластера PostgreSQL;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aamsystems.ru/passoffice/passoffice-guide/admin-guide-doc/ustanovka-passoffice/sistemnye-trebovaniya/vneshnyaya-baza-dannykh-postgresql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
