-
Notifications
You must be signed in to change notification settings - Fork 35
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
Use 'broadcast_address' instead of 'rpc_address' to contact local peer #123
Comments
We use rpc_address which is for client connections. In comparison, broadcast_address is used for inter-nodes communication. This driver aims at a similar behavior as other Datastax-maintained drivers, which use |
Hello, Where In addition, |
@nmeylan What is the value configured for rpc_address in your cluster's nodes? |
rpc_address is set at I tried with kong 1.0, and it "works" as now I go into this https://github.com/thibaultcha/lua-cassandra/blob/master/lib/resty/cassandra/cluster.lua#L501
BTW, thanks for your answer |
My case was about Cassandra in containers as well. |
Please note that changed in 1.3.3 c176a9c |
How so? The JS driver uses @viossat How are you connecting your containers (Kong <-> Cassandra) together? Are you linking them, or using Docker a network? |
My Cassandra instances are located in multiple datacenters and sub-networks, same for the clients. |
@viossat So, if I understand you correctly, your complaint is that the Lua driver overrides the specified Help me understand: why would only your contact point be reachable by the the driver (or Kong, for that is?). Since the driver load balances across all peers (including the contact point), it treats both the local contact point and the peers the same way, and assumes that all of them can be contacted by their |
Sorry, my issue was not clear and didn't take 1.3.3 changes into account. The JS driver from DataStax works as follow:
With the Lua driver:
When working with Cassandra in container:
(before 1.3.3) While most of Cassandra clusters have more than one node, someone may not notice the issue as the first responding contact point returns the others peers before its (unreachable) |
Reopening this since the discussion is active. |
This library does not embed a DNS resolver, so contact points must be specified as IP addresses. Kong uses a clever hack that makes it possible to pass contact points as hostnames.
Similarly to the JS driver, iirc.
Since we only refer to contact points by IP address (from
I have considered making this warning silent when opts.silent is enabled. A PR here is welcome.
Which property do you suggest we fallback to then? |
1.3.3 works in my case. imo the saved IP of the local peer should always be the contact point, not |
Absent DNS capabilities in the driver,
https://github.com/thibaultcha/lua-cassandra/blob/1.3.4/lib/resty/cassandra/cluster.lua#L477 will retrieve the coordinator hostname, so it can wind up in the state described in 8b9fcd9#diff-745de875635774250552720721ac4fd5L496 |
@rainest Would you be willing to send a PR to this repository? In the same vein, we could also PR Kong to resolve its provide contact points before instantiating the cluster instance. |
On second thought, I wonder if we shouldn't just follow my second suggestion, but keep this driver as-is for now (so as to stay aligned to the Datastax implementations)? |
Here is the Kong PR: Kong/kong#4296 Note that this fix is only relevant in versions of Kong that create several |
I think
broadcast_address
is more suitable asrpc_address
is usually set to0.0.0.0
or a local sub-network IP.The text was updated successfully, but these errors were encountered: