You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Barman配置、pg_receivexlog失败及barman check报错咨询:HA服务器需装PostgreSQL吗?

Hey there! Let's break down your questions and issues step by step.

Core Question: Do I need to install PostgreSQL on the Barman server when configuring it for an HA setup?

Nope! Barman is a Python-based backup tool that connects to your target PostgreSQL instance remotely (via SSH or PostgreSQL's replication protocol), so you don't need a full PostgreSQL service installed on the Barman server. That said, you do need to install PostgreSQL's client tool package (like postgresql-client on Debian/Ubuntu, or postgresql on RHEL/CentOS—just the client components) on the Barman server. This gives you access to tools like pg_receivexlog (or pg_receivewal in newer versions), which Barman relies on for streaming WAL backups.

Fixing Your barman check Failures

From your check output, there are two critical failures to address:

  1. replication slot: FAILED (slot 'barman' not initialised: is 'receive-wal' running?)
  2. backup maximum age: FAILED (interval provided: 1 day, latest backup age: No available backups)

Fix 1: Uninitialized Replication Slot

This error means the barman replication slot either doesn't exist on your PostgreSQL instance, or the barman receive-wal service isn't running to use it. Here's how to fix it:

  • First, verify if the slot exists on your PostgreSQL server. Log into the PostgreSQL instance and run:
    SELECT slot_name, slot_type FROM pg_replication_slots;
    
    If barman isn't listed, create it with a superuser account:
    SELECT pg_create_physical_replication_slot('barman');
    
  • Next, start and enable the barman receive-wal service on your Barman server to keep streaming WAL logs. For most systemd-based systems:
    # Start the service for your PostgreSQL server alias
    barman receive-wal --start <your_postgres_server_alias>
    # Set it to start on boot
    systemctl enable barman@<your_postgres_server_alias>
    systemctl start barman@<your_postgres_server_alias>
    
  • Re-run barman check <your_postgres_server_alias> to confirm the replication slot issue is resolved.

Fix 2: No Available Backups for Retention Policy

This failure is straightforward: you've configured a retention policy (1 day), but Barman has no successful backups to validate against. Just run your first full backup:

barman backup <your_postgres_server_alias>

Once the backup completes successfully, re-run barman check—this error will disappear because Barman now has a backup to check against your retention interval.

Bonus: Troubleshooting pg_receivexlog Failures

If pg_receivexlog is failing, common causes include:

  • Missing PostgreSQL client tools on the Barman server: Install the client package as mentioned earlier.
  • Incorrect pg_hba.conf settings on the PostgreSQL instance: Ensure the Barman server's IP is allowed for replication connections. Add a line like this:
    host    replication     barman_replication_user     <barman_server_ip>/32     scram-sha-256
    
  • Insufficient permissions for the replication user: Make sure your Barman replication user has the REPLICATION attribute:
    ALTER USER barman_replication_user WITH REPLICATION;
    

内容的提问来源于stack exchange,提问作者Eva Cheung

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 03:26:35