Bug 51740 - psql: подключиться к серверу через сокет "/tmp/.s.PGSQL.9999" не удалось
Summary: psql: подключиться к серверу через сокет "/tmp/.s.PGSQL.9999" не удалось
Status: CLOSED NOTABUG
Alias: None
Product: Sisyphus
Classification: Development
Component: postgresql15-pgpool-II (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Alexei Takaseev
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-17 15:17 MSK by Aleksandr Sysoev
Modified: 2024-11-25 13:43 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aleksandr Sysoev 2024-10-17 15:17:13 MSK
server-11.0.alpha20240611-x86-64 обновленный до Sisyphus

Версии:
postgresql15-pgpool-II-4.2.19-alt1.x86_64
postgresql15-15.8-alt3.x86_64
postgresql-common-1.0-alt9.noarch
postgresql15-server-15.8-alt3.x86_64

Шаги воспроизведения:
1. Настроить pgpool. Например, 2 ноды - primary и standy. Убедиться, что они корректно запущены и статус ОК:
# pcp_node_info -n 0 -U postgres -h localhost --verbose
Password: 
Hostname               : <host0-ip>
Port                   : 5432
Status                 : 2
Weight                 : 0.500000
Status Name            : up
Role                   : primary
Replication Delay      : 0
Replication State      : 
Replication Sync State : 
Last Status Change     : 2024-10-17 15:02:17

# pcp_node_info -n 1 -U postgres -h localhost --verbose
Password: 
Hostname               : <host1-ip>
Port                   : 5432
Status                 : 2
Weight                 : 0.500000
Status Name            : up
Role                   : standby
Replication Delay      : 27007272
Replication State      : 
Replication Sync State : 
Last Status Change     : 2024-10-17 15:02:17

2. Создать базу для репликации:
# psql -U postgres -p 9999 -c "CREATE DATABASE test_db;"

3. Попытаться добавить таблицу в созданную базу test_db:
# psql -U postgres -p 9999 -d test_db -c "CREATE TABLE test_table (id int, name varchar);"

Ожидаемый результат: таблица добавилась успешно

Реальный результат:
# psql -U postgres -p 9999 -d test_db -c "CREATE TABLE test_table (id int, name varchar);"
psql: ошибка: подключиться к серверу через сокет "/tmp/.s.PGSQL.9999" не удалось: ERROR:  unable to read message kind
ПОДРОБНОСТИ:  kind does not match between main(53) slot[1] (45)

В journalctl:
окт 17 15:13:21 server-11-0-alpha20240611-x86-64-minimal-20241017.localdomain pgpool[8245]: 2024-10-17 15:13:21: pid 8245: LOG:  pool_read_kind: error message from 1 th backend:база данных "test_db" не существует
окт 17 15:13:21 server-11-0-alpha20240611-x86-64-minimal-20241017.localdomain pgpool[8245]: 2024-10-17 15:13:21: pid 8245: ERROR:  unable to read message kind
окт 17 15:13:21 server-11-0-alpha20240611-x86-64-minimal-20241017.localdomain pgpool[8245]: 2024-10-17 15:13:21: pid 8245: DETAIL:  kind does not match between main(53) slot[1] (45)

При этом фактически БД существует:
# psql -p 9999 -U postgres -l | grep test_db
 test_db   | postgres | UTF8      | ru_RU.UTF-8 | ru_RU.UTF-8 |            | libc             | 

Доп: аналогичное поведение и с другими версиями postgress postgresql1*-pgpool-II
Comment 1 Alexei Takaseev 2024-11-25 12:36:46 MSK
Можете привести описание процедуры развертывания pgpool по которой вы следовали?
Comment 2 Alexei Takaseev 2024-11-25 13:43:24 MSK
Проверил на конфигурации

postgresql15-15.8-alt1.x86_64
postgresql15-pgpool-II-4.5.4-alt1.x86_64
postgresql15-server-15.8-alt1.x86_64

стенд из отдельной виртуалки с pgpool и двумя нодами с postgres с репликацией между ними. После поднятия репликации и настройки pgpool такая картина.

нода с pgpool:

psql -U postgres -h localhost -p 9999 postgres
Пароль пользователя postgres: 
psql (15.8)
Введите "help", чтобы получить справку.

postgres=# create database test;
CREATE DATABASE
postgres=# \c test
Вы подключены к базе данных "test" как пользователь "postgres".
test=# create table t (f1 int);
CREATE TABLE
test=# \dt
         Список отношений
 Схема  | Имя |   Тип   | Владелец 
--------+-----+---------+----------
 public | t   | таблица | postgres
(1 строка)

test=# insert into t values (1);
INSERT 0 1
test=# insert into t values (2);
INSERT 0 1
test=# insert into t values (3);
INSERT 0 1
test=# select * from t;
 f1 
----
  1
  2
  3
(3 строки)

test=#


нода мастер pg-node1:

# psql -U postgres -l 
Пароль пользователя postgres: 
                                                  Список баз данных
    Имя    | Владелец | Кодировка | LC_COLLATE  |  LC_CTYPE   | локаль ICU | Провайдер локали |     Права дос
тупа     
-----------+----------+-----------+-------------+-------------+------------+------------------+--------------
---------
 postgres  | postgres | UTF8      | ru_RU.UTF-8 | ru_RU.UTF-8 |            | libc             | 
 template0 | postgres | UTF8      | ru_RU.UTF-8 | ru_RU.UTF-8 |            | libc             | =c/postgres  
        +
           |          |           |             |             |            |                  | postgres=CTc/
postgres
 template1 | postgres | UTF8      | ru_RU.UTF-8 | ru_RU.UTF-8 |            | libc             | =c/postgres  
        +
           |          |           |             |             |            |                  | postgres=CTc/
postgres
 test      | postgres | UTF8      | ru_RU.UTF-8 | ru_RU.UTF-8 |            | libc             | 
(4 строки)

[root@pg-node1 base]# psql -U postgres test
Пароль пользователя postgres: 
psql (15.8)
Введите "help", чтобы получить справку.

test=# \dt
         Список отношений
 Схема  | Имя |   Тип   | Владелец 
--------+-----+---------+----------
 public | t   | таблица | postgres
(1 строка)

test=# select * from t;
 f1 
----
  1
  2
  3
(3 строки)

test=#


нода реплика pg-node2:

# psql -U postgres -l
Пароль пользователя postgres: 
                                                  Список баз данных
    Имя    | Владелец | Кодировка | LC_COLLATE  |  LC_CTYPE   | локаль ICU | Провайдер локали |     Права дос
тупа     
-----------+----------+-----------+-------------+-------------+------------+------------------+--------------
---------
 postgres  | postgres | UTF8      | ru_RU.UTF-8 | ru_RU.UTF-8 |            | libc             | 
 template0 | postgres | UTF8      | ru_RU.UTF-8 | ru_RU.UTF-8 |            | libc             | =c/postgres  
        +
           |          |           |             |             |            |                  | postgres=CTc/
postgres
 template1 | postgres | UTF8      | ru_RU.UTF-8 | ru_RU.UTF-8 |            | libc             | =c/postgres  
        +
           |          |           |             |             |            |                  | postgres=CTc/
postgres
 test      | postgres | UTF8      | ru_RU.UTF-8 | ru_RU.UTF-8 |            | libc             | 
(4 строки)

[root@pg-node2 base]# psql -U postgres test
Пароль пользователя postgres: 
psql (15.8)
Введите "help", чтобы получить справку.

test=# \dt
         Список отношений
 Схема  | Имя |   Тип   | Владелец 
--------+-----+---------+----------
 public | t   | таблица | postgres
(1 строка)

test=# select * from t;
 f1 
----
  1
  2
  3
(3 строки)

test=#

Похоже, что по какой-то причине у вас не работает репликация между мастером и репликой, что непосредственно к pgpool отношения не имеет.