8000 [Need Help] no pg_hba.conf entry for host xx.xx.xx.xx error · Issue #460 · Vonng/pigsty · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Need Help] no pg_hba.conf entry for host xx.xx.xx.xx error #460

Closed
TonnyXu opened this issue Oct 18, 2024 · 2 comments
Closed

[Need Help] no pg_hba.conf entry for host xx.xx.xx.xx error #460

TonnyXu opened this issue Oct 18, 2024 · 2 comments

Comments

@TonnyXu
Copy link
TonnyXu commented Oct 18, 2024

Basic Info

  • Machine_01
    • 6C8G
    • Public IP: x.y.z.1
    • Pigsty 3.0.3
  • Machine_02
    • 4C4G
    • Public IP: x.y.z.2

Steps

  1. Installed pigsty on machine_01(public IP: x.y.z.1) using default install script as single node cluster. Followed the steps in this doc, the pg-meta cluster
  2. Tried to add machine_02 as a replica
  3. Error during executing bin/pgsql-add <cls> <ip>

Detailed commands on machine_01

Installing first node as single node cluster

$ curl -fsSL https://repo.pigsty.io/get | bash; cd ~/pigsty;
$ ./bootstrap
$ ./configure
$ ./install.yml

Add second node

$ vi pigsty.yml # added new node definition to 

Detailed changes in pigsty.yml

    pg-meta:
      hosts:
        x.y.z.1: { pg_seq: 1, pg_role: primary } # <---- primary instance with read-write capability (generated by configure)
        x.y.z.2: { pg_seq: 2, pg_role: replica } # <---- read only replica for read-only online traffic (manually added)
        #x.xx.xx.xy: { pg_seq: 3, pg_role: offline } # <---- offline instance of ETL & interactive queries

Commands tried to add machine_02 as replica

$ bin/node-add x.y.z.2 # executed OK, no errors
$ bin/pgsql-add pg-meta x.y.z.2 # <- Error

Detailed error info

TASK [pgsql : check replication connectivity] *************************************
fatal: [x.y.z.2]: FAILED! => {"changed": true, "cmd": "/usr/pgsql/bin/psql -w -h x.y.z.1 -p 5432 -U replicator -d postgres -Atc 'SELECT 1;'\n", "delta": "0:00:00.031199", "end": "2024-10-18 15:21:54.403876", "msg": "non-zero return code", "rc": 2, "start": "2024-10-18 15:21:54.372677", "stderr": "psql: error: connection to server at \"x.y.z.1\", port 5432 failed: FATAL:  no pg_hba.conf entry for host \"x.y.z.2\", user \"replicator\", database \"postgres\", SSL encryption\nconnection to server at \"x.y.z.1\", port 5432 failed: FATAL:  no pg_hba.conf entry for host \"x.y.z.2\", user \"replicator\", database \"postgres\", no encryption", "stderr_lines": ["psql: error: connection to server at \"x.y.z.1\", port 5432 failed: FATAL:  no pg_hba.conf entry for host \"x.y.z.2\", user \"replicator\", database \"postgres\", SSL encryption", "connection to server at \"x.y.z.1\", port 5432 failed: FATAL:  no pg_hba.conf entry for host \"x.y.z.2\", user \"replicator\", database \"postgres\", no encryption"], "stdout": "", "stdout_lines": []}

What I have tried

$ bin/pgsql-hba pg-meta

Got error as well:

TASK [pgsql : reload postgres config] **********************************************************************************************************
changed: [x.y.z.1]
fatal: [x.y.z.2]: FAILED! => {"changed": true, "cmd": "/usr/pgsql/bin/pg_ctl -D /pg/data reload\n", "delta": "0:00:00.003757", "end": "2024-10-18 15:31:53.378339", "msg": "non-zero return code", "rc": 1, "start": "2024-10-18 15:31:53.374582", "stderr": "pg_ctl: directory \"/pg/data\" is not a database cluster directory", "stderr_lines": ["pg_ctl: directory \"/pg/data\" is not a database cluster directory"], "stdout": "", "stdout_lines": []}

Any help is welcome!

Tonny

@Vonng
Copy link
Owner
Vonng commented Oct 24, 2024

Are you using non local IP addrdss?

If so, add them to pg_default_hba_rules or pg_hba_rules.

@TonnyXu
Copy link
Author
TonnyXu commented Oct 24, 2024

@Vonng Thanks!

Yes, I'm using non-local IP and I have fixed this issue by adding local IP to hba rules.

@TonnyXu TonnyXu closed this as completed Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0