# Pmm Connection Refused when I Installed Patroni

**URL:** <https://forums.percona.com/t/pmm-connection-refused-when-i-installed-patroni/20561>\
**Category:** Uncategorized\
**Created:** [March 14, 2023, 12:23pm UTC](https://forums.percona.com/t/pmm-connection-refused-when-i-installed-patroni/20561 "2023-03-14T12:23:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HKN\_MZ](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hkn_mz/32/9723_2.png) [@HKN\_MZ](https://forums.percona.com/u/HKN_MZ)\
**Post date:** [March 14, 2023, 12:23pm UTC](https://forums.percona.com/t/pmm-connection-refused-when-i-installed-patroni/20561/1 "2023-03-14T12:23:52Z")

</div>

I have 2 nodes. One of them is PmmClient, other is PmmServer.  
I installed Postgresql on the PmmClient node and successfully sent the queries to PmmServer node. There was no any problem.  
After days,  
I installed Patroni on the PmmClient node and I am getting this error message When I try to add postgresql.

> sudo pmm-admin add postgresql --username=‘pmm’ --password=‘pmm’  
> `Connection check failed: dial tcp 127.0.0.1:5432: connect: connection refused.`

Here is the listening port

> sudo lsof -i -P -n | grep LISTEN

```auto
patroni 623929 postgres 5u IPv4 752493 0t0 TCP x.x.x.198:8008 (LISTEN)
postgres 624009 postgres 5u IPv4 753603 0t0 TCP x.x.x.198:5432 (LISTEN)

```

Here is the pmm-admin status output

```auto
pmm-admin status
Agent ID : /agent_id/df4980d8-x-083606bb68f8
Node ID : /node_id/33e8b22b-x-6384422ab5d6
Node name: PmmClient

PMM Server:
        URL : https://x.x.x.195:443/
        Version: 2.35.0

PMM Client:
        Connected : true
        Time drift : -7.223401ms
        Latency : 1.320039ms
        Connection uptime: 100
        pmm-admin version: 2.35.0
        pmm-agent version: 2.35.0
Agents:
        /agent_id/0eb5621e-x-f546d617a4d2 node_exporter Running 42000
        /agent_id/5176d22a-x-bc27ddf36948 vmagent Running 42001

```

---

<div class="post-metadata">

**Author:** ![Pep\_Pla](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/pep_pla/32/9735_2.png) [@Pep\_Pla](https://forums.percona.com/u/Pep_Pla)\
**Post date:** [March 15, 2023, 1:25pm UTC](https://forums.percona.com/t/pmm-connection-refused-when-i-installed-patroni/20561/2 "2023-03-15T13:25:33Z")

</div>

Hi @HKN_MZ

Welcome to the Percona Forums. Thanks for being part of the community.

Could you try this?

```auto
sudo pmm-admin add postgresql --username='pmm' --password='pmm' --host=$(hostname) --port=5432

```

Thanks!

Pep

---

<div class="post-metadata">

**Author:** ![HKN\_MZ](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hkn_mz/32/9723_2.png) [@HKN\_MZ](https://forums.percona.com/u/HKN_MZ)\
**Post date:** [March 16, 2023, 7:07am UTC](https://forums.percona.com/t/pmm-connection-refused-when-i-installed-patroni/20561/3 "2023-03-16T07:07:43Z")

</div>

Thank you, this is the solution
