【问题标题】:[Postgres Replication]Remote host is not reachable repmgr salve[Postgres Replication]远程主机无法访问repmgr salve
【发布时间】:2016-08-08 15:23:38
【问题描述】:

我正在尝试使用两台服务器创建一个 postgres 复制配置。步骤类似PostgreSQL 9.4 Replication with RepMgr and PgBouncer on Ubuntu 14.04 .我使用 repmgr + pgbouncer 作为我的复制配置。假设我有两个主机 dhost1 和 dhost2。 Repmgr 元数据 db 是 repmgrdb,用户是 repmgr_user
dhost1 有 pgbouncer 和 Repmgr 的配置,它是 master。 dbhost1中Repmgr的配置如下:

cluster = test

node = 1  
node_name = dhost1  
use_replication_slots = 1  
conninfo='host=dhost1 user=repmgr_user dbname=repmgrdb'  
pg_bindir=/usr/lib/postgresql/9.5/bin
## repmgr.conf at master ##

dhost2 也有 Repmgr 的配置,它处于从属模式。它的配置如下所述

cluster = test

node = 2  
node_name = dhost2  
use_replication_slots = 1  
conninfo='host=dhost2 user=repmgr_user dbname=repmgrdb'  
pg_bindir=/usr/lib/postgresql/9.5/bin
 ## repmgr.conf at slave ##

我可以成功注册到master,并且可以在cluster show命令中看到master。

在从机端我使用pg_basebackup 方法通过命令克隆主机

repmgr -f /etc/repmgr/repmgr.conf --force  -h dhost1_ip_address_goes_here> -U repmgr_user -d repmgrdb -v standby clone

对于上述命令,我得到以下错误:

[2016-08-08 10:05:26] [NOTICE] using configuration file "/etc/repmgr/repmgr.conf"
[2016-08-08 10:05:26] [NOTICE] setting data directory to: /var/lib/postgresql/9.5/main
[2016-08-08 10:05:26] [HINT] use -D/--data-dir to explicitly specify a data directory
[2016-08-08 10:05:26] [NOTICE] starting backup (using pg_basebackup)...
[2016-08-08 10:05:26] [HINT] this may take some time; consider using the -c/--fast-checkpoint option
[2016-08-08 10:05:31] [NOTICE] copying configuration files from master
[2016-08-08 10:05:31] [ERROR] aborting, remote host <dhost1_ip_address_goes_here> is not reachable.
[2016-08-08 10:05:31] [ERROR] unable to take a base backup of the master server>
[2016-08-08 10:05:31] [WARNING] destination directory (/var/lib/postgresql/9.5/main) may need to be cleaned up manually

我还为postgres 用户在dhost1dhost2 之间设置了无密码ssh。

我还可以从命令中获取pg_basebackup

pg_basebackup -h <dhost1_ip_address_goes_here> -P -v -U repmgr_user -X stream -D 9.5/main -R

我是 postgresql 复制的初学者,请给我建议答案。

【问题讨论】:

    标签: postgresql ssh replication pgbouncer repmgr


    【解决方案1】:

    我现在正在调查。您可能想再次运行该命令
    --log-level 调试 --verbose 这应该会提供更多关于那里发生的事情的信息......

    【讨论】:

      【解决方案2】:

      1-st

      rm -rf /var/lib/postgresql/9.5/main/*

      第二次

      repmgr -h masterhostname -p 5433 -U repmgr -d repmgr -D main -f /etc/repmgr.conf --copy-external-config-files=pgdata --verbose 备用克隆

      第三次

      pg_ctl -D /var/lib/postgresql/9.5/main --log=/var/log/postgresql/postgres_screen.log 开始 第 4 次

      repmgr -f /etc/repmgr/repmgr.conf 备用寄存器;

      repmgr -f /etc/repmgr/repmgr.conf 集群显示

      【讨论】:

      • 请补充说明。
      猜你喜欢
      • 1970-01-01
      • 2011-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多