Postgresql
酒保和 Dockerized PostgreSQL:檢查超時:失敗(酒保檢查命令超時)
我正在嘗試配置
barman
以備份在 Docker 容器內執行的 PostgreSQL 11 數據庫。barman
v2.10 直接安裝在 Ubuntu 18.04.3 主機上。
barman check pgsql
給出錯誤:檢查超時:失敗(酒保檢查命令超時)
的輸出
barman check pgsql
$ time barman check pgsql Server pgsql: check timeout: FAILED (barman check command timed out) real 0m36.978s user 0m0.336s sys 0m0.025s
但是,使用相同的憑據立即連接到相同的數據庫沒有問題
psql
:的輸出
psql
$ psql -h 172.xxx.xxx.xxx -p 5432 -U postgres --dbname=app_development Password for user postgres: psql (11.7 (Ubuntu 11.7-1.pgdg18.04+1), server 11.6) Type "help" for help. app_development=#
**問題:**這裡可能有什麼問題
barman
?
/etc/barman.d/pgsql.conf
[pgsql] description = "PostgreSQL server" conninfo = host=172.xxx.xxx.xxx port=5432 user=postgres password=mypassword dbname=app_development ssh_command = ssh -p 2222 postgres@127.0.0.1 backup_method = rsync parallel_jobs = 1 reuse_backup = link archiver = on
/etc/barman.conf
[barman] barman_home = /var/lib/barman/pg barman_user = barman backup_options = exclusive_backup compression = gzip network_compression = true bandwidth_limit = 0 immediate_checkpoint = true last_backup_maximum_age = 2 DAYS retention_policy = RECOVERY WINDOW OF 3 MONTHS minimum_redundancy = 2 log_file = /var/log/barman/barman.log log_level = DEBUG
/var/log/barman/barman.log
2020-02-19 02:05:58,241 [21079] barman.config DEBUG: Including configuration file: pgsql.conf 2020-02-19 02:05:58,242 [21079] barman.cli DEBUG: Initialised Barman version 2.10 (config: /etc/barman.conf, args: {'color': 'auto', 'quiet': False, 'debug': False, 'format': 'console', 'server_name': ['pgsql'], 'nagios': False, 'command': 'check'}) 2020-02-19 02:05:58,249 [21079] barman.server DEBUG: Retention policy for server pgsql: RECOVERY WINDOW OF 3 MONTHS 2020-02-19 02:05:58,249 [21079] barman.server DEBUG: WAL retention policy for server pgsql: MAIN 2020-02-19 02:05:58,250 [21079] barman.server DEBUG: Starting check: 'WAL archive' 2020-02-19 02:05:58,250 [21079] barman.server DEBUG: Starting check: 'empty incoming directory' 2020-02-19 02:05:58,250 [21079] barman.server DEBUG: Starting check: 'empty streaming directory' 2020-02-19 02:05:58,250 [21079] barman.server DEBUG: Starting check: 'PostgreSQL' 2020-02-19 02:06:01,606 [21088] barman.config DEBUG: Including configuration file: pgsql.conf 2020-02-19 02:06:01,607 [21088] barman.cli DEBUG: Initialised Barman version 2.10 (config: /etc/barman.conf, args: {'color': 'auto', 'quiet': True, 'debug': False, 'format': 'console', 'keep_descriptors': False, 'command': 'cron'}) 2020-02-19 02:06:01,613 [21088] barman.server DEBUG: Retention policy for server pgsql: RECOVERY WINDOW OF 3 MONTHS 2020-02-19 02:06:01,613 [21088] barman.server DEBUG: WAL retention policy for server pgsql: MAIN 2020-02-19 02:06:01,613 [21088] barman.command_wrappers DEBUG: BarmanSubProcess: ['/usr/bin/python3', '/usr/bin/barman', '-c', '/etc/barman.conf', '-q', 'archive-wal', 'pgsql'] 2020-02-19 02:06:01,615 [21088] barman.command_wrappers DEBUG: BarmanSubProcess: subprocess started. pid: 21089 2020-02-19 02:06:01,915 [21089] barman.config DEBUG: Including configuration file: pgsql.conf 2020-02-19 02:06:01,916 [21089] barman.cli DEBUG: Initialised Barman version 2.10 (config: /etc/barman.conf, args: {'color': 'auto', 'quiet': True, 'debug': False, 'format': 'console', 'config': '/etc/barman.conf', 'server_name': 'pgsql', 'command': 'archive_wal'}) 2020-02-19 02:06:01,922 [21089] barman.server DEBUG: Retention policy for server pgsql: RECOVERY WINDOW OF 3 MONTHS 2020-02-19 02:06:01,922 [21089] barman.server DEBUG: WAL retention policy for server pgsql: MAIN 2020-02-19 02:06:01,939 [21089] barman.server DEBUG: Starting archive-wal for server pgsql 2020-02-19 02:06:01,939 [21089] barman.wal_archiver INFO: No xlog segments found from file archival for pgsql. 2020-02-19 02:06:35,308 [21079] barman.server DEBUG: Check command timed out executing 'PostgreSQL' check 2020-02-19 02:06:35,309 [21079] barman.server ERROR: Check 'check timeout' failed for server 'pgsql'
偉大的,
增加檢查超時。
在 /etc/barman.conf
check_timeout = 60
好。嘗試以下 barman 命令而不是固定超時:
barman cron barman switch-wal <server-name>
在酒保備份配置中添加新伺服器時,我面臨同樣的問題。它總是發生。在檢查了stackoverlog和barman docker之後,我注意到如果數據庫不是很忙,在新的伺服器配置期間不會生成wal(xlog)。如果數據庫很忙並且生成了 wal 或 xlog,則不會顯示此問題。要解決它,您可以讓 barman 手動詢問 postgresql db server switch wal(xlog)。命令是switch-wal。此外,酒保 cron 需要每分鐘由 crond 備份執行。
希望以上經驗可以幫到你。
如果你喜歡這個答案,請投票。