Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Работа с БД через сервисную учетную запись
Пулл соединений и параметры соединений
*sqlx.DB
библиотекиgithub.com/jmoiron/sqlx
. Решили ограничиться 10 открытыми соединениями и 10 соединениями в пулле.db.SetMaxIdleConns(10)
db.SetMaxOpenConns(10)
listen_addresses = '192.168.243.1, 192.168.243.2, 192.168.243.3, 192.168.243.4, 192.168.243.5, 192.168.243.6, 192.168.243.7
Логгирование и протоколирование медленных запросов
log_destination = 'jsonlog'
logging_collector = on
log_rotation_age = 12h
log_rotation_size = 8MB
log_truncate_on_rotation = on
log_min_duration_statement = 512ms
log_line_prefix = '%t [%p]: user=%u,db=%d,app=%a,client=%h '
log_checkpoints = on
log_connections = on
log_disconnections = on
log_lock_waits = on
log_temp_files = 0
log_autovacuum_min_duration = 0
log_error_verbosity = default
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_directory = '/var/log/postgresql'
Для генерации отчетов с помощью pgBadger создали отдельную цель в Makefile(pgbadger) pgbadger