postgresql - PGPOOL 从节点处于“等待”状态
问题描述
我正在尝试使用主从配置一个简单的 pgpool(都在同一台机器上 - 不同的端口)。每当我通过进入 pgpoolpsql -p 9999
并运行时,show pool_nodes;
我都会看到主从集群,但从属状态是waiting
(它们都在运行)。主从配置primary
为hot_standby
复制。但是每当我通过 pgpool 插入/选择时,所有这些都通过主...
su - postgres
mkdir production_server
mkdir slave1
mkdir slave_archive
create new cluster on production_server
changes for those values on postgresql.conf (production_server):
-------------------------------------------------------
wal_level = replica
archive_mode on
listen_address = *
archive_command= cp %p /var/lib/pgsql/slave_archive/%f
port=5435
-------------------------------------------------------
restart the cluster on production_server
pg_basebackup -p 5435 -D /var/lib/pgsql/slave1
changes for those values on postgresql.conf (slave1):
-------------------------------------------------------
port=5466
hot_standby=on
primary_conninfo= host =127.0.0.1 port=5435
restore_command = cp /var/lib/pgsql/slave_archive/%f %p
-------------------------------------------------------
create also a standby.signal file (we're using postgres version 12.x)
switch to root and chmod 700 on slave1 directory
switch back to postgres: su - postgres
start the cluster on -D /var/lib/pgsql/slave1
psql -p 5435
create table table1 as SELECT * FROM generate_series(1, 10000);
select pg_switch_wal();
---> on psql -p 5466 we will also see this insert/table
let's configure the pg_pool:
------------------------------------------------------------
cd /etc/pgpool-II
cp pgpool.conf.sample pgpool.conf
vi pgpool.conf:
----------------------------------------
listen_address=*
backend_hostname0=127.0.0.1
backend_port0=5435
backend_directory0=/var/lib/pgsql/production_server
backend_hostname0=127.0.0.1
backend_port0=5466
backend_directory0=/var/lib/pgsql/slave1
health_check_user=postgres
----------------------------------------
./pgpool &
psql -p 9999
in order to see the active nodes in the pool run:
show pool_nodes;
---> we need to recieve 2 nodes: 5435 / 5466
这是我配置 pgpool + master & slave 的脚本。如何解决等待状态?
解决方案
我在安装 pgpool-II-12* 包(4.1 版本)时遇到了同样的问题。找不到任何解决方案,因此我将其删除并从此处安装了 pgpool-II-pg12* 软件包(4.2 版本)并对其进行了配置。它适用于这个版本。
推荐阅读
- javascript - 点击按钮提交表格
- jquery - 如何计算顶部距离以将标题定位在另一个 div 之上?
- mysql - 如何将系统的日期插入表中
- angular - 防止组件在 DOM 中移动时被重置
- azure-devops - Yaml 步骤的名称无效
- python - 如何使用 ListView 构建此登录页面
- laravel - 带有 Spatie 权限检查的 Laravel 策略为客户端凭据 API 请求提供 403
- python - 在 dask 中生成批量图像
- xcode - 如何导出(从 Blender)和将 Alembic 文件导入 Xcode
- scala - 使用 Junit 运行 spark 作业时如何生成 XML 测试结果报告?