Issue with Python SDK Connecting to Multinode Couchbase Cluster in Docker

Hello,

I am currently developing a multi-node Couchbase cluster on a single host using Docker Compose. While everything works well with a single node, I’m encountering connectivity issues when I increase the number of nodes. The Python SDK can connect from both my local machine and the server, but while it can run queries without any issues from the server, it cannot run any queries from my local machine.

After some troubleshooting with Wireshark, I discovered that the Python SDK is attempting to send requests to the internal IP addresses of the Docker containers.

I also ran the sdk-doctor tool to diagnose the issue, but the output wasn’t very helpful:

Note: Diagnostics can only provide accurate results when your cluster
is in a stable state. Active rebalancing and other cluster configuration
changes can cause the output of the doctor to be inconsistent or in the
worst cases, completely incorrect.

11:31:39.461 INFO ▶ Parsing connection string `couchbase://131.104.25.17/BCDM`
11:31:39.461 INFO ▶ Connection string identifies the following CCCP endpoints:
11:31:39.461 INFO ▶   1. 131.104.25.17:11210
11:31:39.461 INFO ▶ Connection string identifies the following HTTP endpoints:
11:31:39.461 INFO ▶   1. 131.104.25.17:8091
11:31:39.461 INFO ▶ Connection string specifies bucket `BCDM`
11:31:39.461 WARN ▶ Your connection string specifies only a single host. You should consider adding additional static nodes from your cluster to this list to improve your application's fault-tolerance
11:31:39.461 INFO ▶ Performing DNS lookup for host `131.104.25.17`
11:31:39.461 INFO ▶ Attempting to connect to cluster via CCCP
11:31:39.461 INFO ▶ Attempting to fetch config via cccp from `131.104.25.17:11210`
11:31:39.483 WARN ▶ Bootstrap host `131.104.25.17` is not using the canonical node hostname of `172.29.0.4`. This is not necessarily an error, but has been known to result in strange and challenging to diagnose errors when DNS entries are reconfigured.
11:31:39.483 INFO ▶ Attempting to connect to cluster via HTTP (Terse)
11:31:39.483 INFO ▶ Attempting to fetch terse config via http from `131.104.25.17:8091`
11:31:39.497 WARN ▶ Bootstrap host `131.104.25.17` is not using the canonical node hostname of `172.29.0.4`. This is not necessarily an error, but has been known to result in strange and challenging to diagnose errors when DNS entries are reconfigured.
11:31:39.497 INFO ▶ Attempting to connect to cluster via HTTP (Full)
11:31:39.497 INFO ▶ Failed to connect via HTTP (Full), as it is not yet supported by the doctor
11:31:39.497 INFO ▶ Selected the following network type: external
11:31:39.497 ERRO ▶ All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible
11:31:39.497 INFO ▶ Diagnostics completed

Summary:
[WARN] Your connection string specifies only a single host. You should consider adding additional static nodes from your cluster to this list to improve your application's fault-tolerance
[WARN] Bootstrap host `131.104.25.17` is not using the canonical node hostname of `172.29.0.4`. This is not necessarily an error, but has been known to result in strange and challenging to diagnose errors when DNS entries are reconfigured.
[WARN] Bootstrap host `131.104.25.17` is not using the canonical node hostname of `172.29.0.4`. This is not necessarily an error, but has been known to result in strange and challenging to diagnose errors when DNS entries are reconfigured.
[ERRO] All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible

Found multiple issues, see listing above.

I tried to set up alternate addresses for the containers as suggested in the documentation. However, since I only have one IP for my server, I am unsure how to configure the hostname and which value to use for it.

Any guidance on resolving this issue would be greatly appreciated. Thank you!

SDK Doctor says that alternateAddress → external is configured, but it cannot connect using what is configured.

That’s exactly the issue I’m facing. I’m not sure how to configure alternateAddress when I only have a single IP address for my server.

Here are the commands I used to configure alternateAddress inside the Index node with 172.29.0.2 as the private IP:

couchbase-cli setting-alternate-address -c 172.29.0.2:8091 --username Administrator \
   --password password --set --node 172.29.0.2 --hostname index.localcouchbase

I used a similar command for the query node. Additionally, I added the following lines to ‘/etc/hosts’:

131.104.25.17   index.localcouchbase
131.104.25.17   query.localcouchbase
131.104.25.17   data.localcouchbase

I understand that this configuration is incorrect, but I’m unsure about what value to use for the hostname in the couchbase-cli setting-alternate-address command. Any advice on the correct configuration would be greatly appreciated.

If I understand correctly, you have multiple nodes of the services with the same host ip - therefore some of them must be on non-default ports - so the alternate address mapping would need to specify the ports as well as the hostname.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.