Barman配置、pg_receivexlog失败及barman check报错咨询:HA服务器需装PostgreSQL吗?
Hey there! Let's break down your questions and issues step by step.
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.
barman check Failures From your check output, there are two critical failures to address:
- replication slot: FAILED (slot 'barman' not initialised: is 'receive-wal' running?)
- 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:
IfSELECT slot_name, slot_type FROM pg_replication_slots;barmanisn't listed, create it with a superuser account:SELECT pg_create_physical_replication_slot('barman'); - Next, start and enable the
barman receive-walservice 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.confsettings 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
REPLICATIONattribute:ALTER USER barman_replication_user WITH REPLICATION;
内容的提问来源于stack exchange,提问作者Eva Cheung

