> 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/cluster-configuration.md).

# Многосерверная конфигурация

**Настройка многосерверной конфигурации PassOffice**

**1. Базовая конфигурация PostgreSQL**

Отредактируйте `application.properties`:

```
passoffice.db.driver=org.postgresql.Driver
passoffice.db.port=5432
passoffice.db.url=jdbc:postgresql://localhost:5432/passoffice
passoffice.db.schema=passofficedb
passoffice.db.user=postgres
passoffice.db.pw=1
```

**2. Настройка Eureka Discovery Service**

```

spring.application.name=passoffice
eureka.client.enabled=passoffice.cluster.enabled
eureka.client.service-url.default-zone=http://localhost:8761/eureka
eureka.instance.preferIpAddress=true
eureka.instance.instance-id=instance.id
eureka.instance.hostname=localhost
eureka.instance.ipAddress=localhost - ip, на котором запущен сервис Discovery.

```

**3. Запуск кластера**

1. **Сервис Discovery**:

   ```
   java -jar eureka-server.jar --spring.profiles.active=discovery
   ```
2. **Ноды приложения**:
   * **Нода 1**:

     ```
     java -jar PassOfficeSrv.jar --server.port=4201 --instance.id=node1
     ```
   * **Нода 2**:

     ```
     java -jar PassOfficeSrv.jar --server.port=4202 --instance.id=node2
     ```

**4. Настройка Nginx для sticky sessions**

Для корректной работы всех возможностей PassOffice в многосерверной конфигурации, необходимо включить поддержку "липких сессий" (sticky sessions) на стороне балансировщика нагрузки.

Подробная информация по настройке Nginx в разделе «Enabling Session Persistence»: <https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/>

**5. Вход в PassOffice**

Войдите под разными операторами, все действия и изменения одного пользователя будут отображаться у другого и наоборот.


---

# 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/cluster-configuration.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.
