首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自动创建复制槽不能在Barman 2.11上工作?

自动创建复制槽不能在Barman 2.11上工作?
EN

Stack Overflow用户
提问于 2020-07-29 03:51:21
回答 1查看 1.6K关注 0票数 0

我使用酒吧2.11和postgres 9.5在我的设置。我在服务器配置中指定了"create_slot = auto“,用于自动创建复制槽,就像文档中提到的那样,但不幸的是,它似乎没有任何效果&酒保检查报告了下面的问题,

我的服务器配置:

代码语言:javascript
复制
[postgres-source-db]
; Configuration options for the server named 'postgres-source-db'

description =  "Config for PostgreSQL Database Backup via rsync/SSH with WAL streaming"
ssh_command = ssh -q postgres@postgres-source-db
conninfo = host=postgres-source-db user=barman dbname=dcmdb
backup_method = rsync
parallel_jobs = 1
reuse_backup = link
archiver = on
backup_options = exclusive_backup

streaming_conninfo = host=postgres-source-db user=barman
streaming_archiver = on
slot_name = barman
create_slot = auto

===

酒保检查输出:

代码语言:javascript
复制
barman@4f5c93878899:~$ barman check postgres-source-db
Server postgres-source-db:
    WAL archive: FAILED (please make sure WAL shipping is setup)
    PostgreSQL: OK
    superuser or standard user with backup privileges: OK
    PostgreSQL streaming: OK
    wal_level: OK
    replication slot: FAILED (replication slot 'barman' doesn't exist. Please execute 'barman receive-wal --create-slot postgres-source-db')
    directories: OK
    retention policy settings: OK
    backup maximum age: FAILED (interval provided: 1 day, latest backup age: No available backups)
    compression settings: OK
    failed backups: OK (there are 0 failed backups)
    minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)
    ssh: OK (PostgreSQL server)
    not in recovery: OK
    systemid coherence: OK (no system Id stored on disk)
    pg_receivexlog: OK
    pg_receivexlog compatible: OK
    receive-wal running: FAILED (See the Barman log file for more details)
    archive_mode: OK
    archive_command: OK
    archiver errors: OK
barman@4f5c93878899:~$

我应该注意到,测试检查成功了,如下所示,

代码语言:javascript
复制
barman@4f5c93878899:~$ psql -U barman -h postgres-source-db   -c "IDENTIFY_SYSTEM"   replication=1
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
      systemid       | timeline |  xlogpos  | dbname
---------------------+----------+-----------+--------
 6854705426793291833 |        1 | 0/3000AE0 |
(1 row)

barman@4f5c93878899:~$

我是不是遗漏了什么?

更新(取得了部分进展,但仍未脱离险境):

还有一个要添加的更新信息。我是在码头容器上设置的&注意,尽管我是从PostgreSQL apt存储库安装的,但cron安装程序还是丢失了。一旦我登录到容器并运行

'/usr/bin/barman -q cron'

为了启动WAL接收器,我看到状态已经改变为成功。不知道为什么它不自动运行,有什么线索吗?

看起来不像是权限问题,但在我看来,'/etc/cron.d/barman'中内容的语法似乎很奇怪,

代码语言:javascript
复制
barman@bef22f0beec3:~$ cat /etc/cron.d/barman 
# /etc/cron.d/barman: crontab entries for the barman package
MAILTO=root
* * * * * barman [ -x /usr/bin/barman ] && /usr/bin/barman -q cron
barman@bef22f0beec3:~$ 

以下是终端输出,

代码语言:javascript
复制
barman@4f5c93878899:~$ crontab -l
no crontab for barman
barman@4f5c93878899:~$ su root
Password:
root@4f5c93878899:/var/lib/barman# crontab -l
no crontab for root
root@4f5c93878899:/var/lib/barman# exit
exit
barman@4f5c93878899:~$ id
uid=102(barman) gid=103(barman) groups=103(barman)
barman@4f5c93878899:~$ pwd
/var/lib/barman

barman@4f5c93878899:~$ cat /etc/cron.d/barman
# /etc/cron.d/barman: crontab entries for the barman package
MAILTO=root
* * * * * barman [ -x /usr/bin/barman ] && /usr/bin/barman -q cron
barman@4f5c93878899:~$ ls -ltr /etc/cron.d/barman
-rw-r--r-- 1 root root 140 Jul  9 11:18 /etc/cron.d/barman
barman@4f5c93878899:~$ /usr/bin/barman -q cron
barman@4f5c93878899:~$ ps -aef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 05:00 ?        00:00:00 /bin/bash /docker-entrypoint.sh barman
root        24     1  0 05:00 ?        00:00:00 /usr/sbin/sshd -D
root        27    24  0 05:03 ?        00:00:00 sshd: barman [priv]
barman      33    27  0 05:03 ?        00:00:00 sshd: barman@pts/0
barman      34    33  0 05:03 pts/0    00:00:00 -bash
barman     107     1  4 05:18 ?        00:00:00 /usr/bin/python3 /usr/bin/barman -c /etc/barman.conf -q receive-wal postgres-source-db
barman     111   107  1 05:18 ?        00:00:00 /usr/lib/postgresql/12/bin/pg_receivewal --dbname=dbname=replication host=postgres-source-db options=-cdatestyle=iso replication=true user=barman application_name
barman     114    34  0 05:18 pts/0    00:00:00 ps -aef
barman@4f5c93878899:~$

barman@4f5c93878899:~$ barman check postgres-source-db
Server postgres-source-db:
    PostgreSQL: OK
    superuser or standard user with backup privileges: OK
    PostgreSQL streaming: OK
    wal_level: OK
    replication slot: OK
    directories: OK
    retention policy settings: OK
    backup maximum age: FAILED (interval provided: 1 day, latest backup age: No available backups)
    compression settings: OK
    failed backups: OK (there are 0 failed backups)
    minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)
    ssh: OK (PostgreSQL server)
    not in recovery: OK
    systemid coherence: OK (no system Id stored on disk)
    pg_receivexlog: OK
    pg_receivexlog compatible: OK
    receive-wal running: OK
    archive_mode: OK
    archive_command: OK
    continuous archiving: OK
    archiver errors: OK
barman@4f5c93878899:~$

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-07 18:27:28

为了其他可能面临同样问题的人,我解决了这个问题。

这个问题似乎是由于酒保中的两个bug(我在Debian上看到的,对其他人不确定),

  1. -- cron.d条目(/etc/cron.d/barman)在结尾缺少一个新行&原来cron需要执行它们--至少在Debian上是这样的。默认情况下,cron不是自动启动的&我必须从我的入口点脚本启动它。

有了以上两个固定,它的工作就像一个魅力。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63146079

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档