canonical / pgbouncer-operator

A charmed operator for running PgBouncer on virtual machines.
https://charmhub.io/pgbouncer?channel=1/stable
Apache License 2.0
4 stars 4 forks source link

Cannot add relation "data-integrator:postgresql pgbouncer:database": establishing a new relation for data-integrator:postgresql would exceed its maximum relation limit of 1 #219

Closed dparv closed 5 months ago

dparv commented 5 months ago

Steps to reproduce

Following on the tutorial here: https://discourse.charmhub.io/t/pgbouncer-tutorial-deploy-pgbouncer/12290/1 I can't relate the data-integrator with the pgboucher charm:

juju integrate data-integrator pgbouncer --debug --verbose
09:40:55 INFO  juju.cmd supercommand.go:56 running juju [3.4.2 a80becbb4da5985fa53c63824a4bd809e9d03954 gc go1.21.8]
09:40:55 DEBUG juju.cmd supercommand.go:57   args: []string{"/snap/juju/26968/bin/juju", "integrate", "data-integrator", "pgbouncer", "--debug", "--verbose"}
09:40:55 INFO  juju.juju api.go:86 connecting to API addresses: [192.168.2.32:17070 10.100.2.92:17070 253.2.92.1:17070]
09:40:55 DEBUG juju.api apiclient.go:1172 successfully dialed "wss://192.168.2.32:17070/model/0f46e0dd-74e1-4e91-8943-860640f2e2d1/api"
09:40:55 INFO  juju.api apiclient.go:707 connection established to "wss://192.168.2.32:17070/model/0f46e0dd-74e1-4e91-8943-860640f2e2d1/api"
09:40:55 DEBUG juju.api monitor.go:35 RPC connection died
ERROR cannot add relation "data-integrator:postgresql pgbouncer:database": establishing a new relation for data-integrator:postgresql would exceed its maximum relation limit of 1 (quota limit exceeded)
09:40:55 DEBUG cmd supercommand.go:549 error stack: 
cannot add relation "data-integrator:postgresql pgbouncer:database": establishing a new relation for data-integrator:postgresql would exceed its maximum relation limit of 1 (quota limit exceeded)
github.com/juju/juju/rpc.(*Conn).Call:178: 

Expected behavior

Be able to integrate the charms

Actual behavior

Integration fails

Versions

Model    Controller              Cloud/Region            Version  SLA          Timestamp
default  openstacklab-regionone  openstacklab/RegionOne  3.4.0    unsupported  09:41:48+03:00

App              Version  Status   Scale  Charm            Channel    Rev  Exposed  Message
data-integrator           active       1  data-integrator  stable      19  no       
pgbouncer                 unknown      0  pgbouncer        1/stable    88  no       
postgresql       14.10    active       3  postgresql       14/stable  363  no       

Unit                Workload  Agent  Machine  Public address  Ports     Message
data-integrator/0*  active    idle   5        10.100.2.109              
postgresql/0        active    idle   2        10.100.2.255    5432/tcp  
postgresql/1        active    idle   3        10.100.3.84     5432/tcp  
postgresql/2*       active    idle   4        10.100.1.186    5432/tcp  Primary

Machine  State    Address       Inst id                               Base          AZ    Message
2        started  10.100.2.255  5166fd77-b663-47c4-aad3-961773d26642  ubuntu@22.04  nova  ACTIVE
3        started  10.100.3.84   c0e19107-7eb0-4785-9793-7724f80583ab  ubuntu@22.04  nova  ACTIVE
4        started  10.100.1.186  5754ca24-3a65-4882-a36d-903b29a4abea  ubuntu@22.04  nova  ACTIVE
5        started  10.100.2.109  04bea12f-d1d7-4b45-a2e8-c000264e0c95  ubuntu@22.04  nova  ACTIVE

Integration provider                   Requirer                               Interface              Type     Message
data-integrator:data-integrator-peers  data-integrator:data-integrator-peers  data-integrator-peers  peer     
pgbouncer:pgb-peers                    pgbouncer:pgb-peers                    pgb_peers              peer     joining  
pgbouncer:upgrade                      pgbouncer:upgrade                      upgrade                peer     joining  
postgresql:database                    data-integrator:postgresql             postgresql_client      regular  
postgresql:database                    pgbouncer:backend-database             postgresql_client      regular  
postgresql:database-peers              postgresql:database-peers              postgresql_peers       peer     
postgresql:restart                     postgresql:restart                     rolling_op             peer     
postgresql:upgrade                     postgresql:upgrade                     upgrade                peer     

Operating system: jammy Juju CLI: 3.4.2-genericlinux-amd64 Juju agent: 3.4.0 postgresql charm revision: 14/stable 363 pgbouncer charm revision: 1/stable 88

LXD: N/A, runs on openstack

Log output

Juju debug log: N/A; client error

github-actions[bot] commented 5 months ago

https://warthogs.atlassian.net/browse/DPE-4169

dragomirp commented 5 months ago

Hi, @dparv, there's a limit on the relations to data integrator to 1 and postgresql is already related to it. You'll need to either use a different data-integrator for pgbouncer or remove the relation between data-integrator and postgresql to be able to relate with pgbouncer.

That being said, the 1/stable branch won't be very useful, since you won't be able to access pgb outside of the data-integrator's container. The changes to provide external service are still on 1/edge.

dparv commented 5 months ago

@dragomirp I tried with 1/edge also, removed the application, re-deployed with different name, related only to data-integrator and no success - the same error:

juju deploy pgbouncer pgbouncer1 --channel 1/edge --series jammy
WARNING series flag is deprecated, use --base instead
Deployed "pgbouncer1" from charm-hub charm "pgbouncer", revision 155 in channel 1/edge on ubuntu@22.04/stable

juju integrate pgbouncer1 data-integrator
ERROR cannot add relation "data-integrator:postgresql pgbouncer1:database": establishing a new relation for data-integrator:postgresql would exceed its maximum relation limit of 1 (quota limit exceeded)

And the tutorial states I have to relate to both postgresql and to data-integrator - otherwise how would I get the database connection pool?

image

dragomirp commented 5 months ago

@dparv, you need to relate pgbouncer to postgresql and data-integrator to pgbouncer, not postgresql to data-integrator. If postgresql is already related to data-integrator, the limit is exceeded and juju will reject the relation.

This is how to deploy on a clean model:

> juju deploy pgbouncer --channel 1/edge  
Deployed "pgbouncer" from charm-hub charm "pgbouncer", revision 155 in channel 1/edge on ubuntu@22.04/stable
> juju deploy data-integrator          
Deployed "data-integrator" from charm-hub charm "data-integrator", revision 19 in channel latest/stable on ubuntu@22.04/stable
> juju deploy postgresql --config profile=testing
Deployed "postgresql" from charm-hub charm "postgresql", revision 363 in channel 14/stable on ubuntu@22.04/stable
> juju integrate postgresql pgbouncer
> juju integrate pgbouncer data-integrator
> juju config data-integrator database-name=testdb

On the existing model, you should be able to do juju remove-relation postgresql data-integrator and then you should be able to relate pgbouncer with data-integrator.

dparv commented 5 months ago

Okay, that made it work, thanks!