You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two machines that are running rethinkdb. Both are behind firewalls. Each machine has the intracluster ports forwarded to the internal IP address from the firewall. The error I am getting is:
error: received inconsistent routing information (wrong address) from xxx.xxx.xxx.xxx (expected_address = peer_address{ips=[xxx.xxx.xxx.xxx], port=29015}, other_address = peer_address{ips=[127.0.0.1, 127.0.1.1, 192.168.1.33], port=29015}), closing connection
Where xxx.xxx.xxx.xxx is my external IPv4 address.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/486#issuecomment-15066107
.
Here's the problem: Machine 1 thinks its address is peer_address{ips=[127.0.0.1, 127.0.1.1, 192.168.1.33], port=29015}. Machine 2 contacts it by connecting to peer_address{ips=[xxx.xxx.xxx.xxx], port=29015}. Suppose that we disable the check. Then Machine 2 will think that Machine 1's address is peer_address{ips=[127.0.0.1, 127.0.1.1, 192.168.1.33], port=29015}, because that's what Machine 1 told Machine 2 its address was. Now suppose Machine 3 contacts Machine 2 and says, "How do I contact Machine 1"? Unless Machine 3 is behind the same firewall as Machine 1, the address peer_address{ips=[127.0.0.1, 127.0.1.1, 192.168.1.33], port=29015} won't work.
Here's a solution: Add another command-line parameter. For the sake of discussion let's call it --canonical-address. Its argument is a host and port. If a machine anywhere in the cluster tries to make a connection to the canonical address, it must reach this machine's clustering port. So, for a machine behind a firewall, --canonical-address would be the external address and port. Whenever two machines make a connection, they will swap canonical addresses; whenever Machine 2 needs to tell Machine 3 how to contact Machine 1, Machine 2 will give Machine 1's canonical address to Machine 3. The assertion that was tripped that caused this issue would be removed.
That's the gist of it, but there are some subtleties to work out:
What should --canonical-address default to? Perhaps it should default to whatever address(es) were bound to. But then it needs to permit multiple values. That's okay; if --canonical-address is not specified, it defaults to our current behavior.
Here's a neat trick: If the user passes a hostname rather than an IP address to --canonical-address, we don't resolve the hostname until it's time to make the connection. That way, they can have the same machine be contacted by different addresses from different locations. For example, if Machine A and Machine B are behind different firewalls but Machine A and Machine C are connected by a crossover cable, then Machine A's canonical address can just be machine-a, and Machine C's hosts file can say that machine-a is whatever its IP is on the ethernet interface attached to the crossover cable, but Machine B's DNS lookup can say that machine-a is whatever external IP address the firewall will forward to Machine A.
I'm not 100% sure about this; someone who knows more about DNS and IP should take a look. I wonder how existing clustering products do it?
This also resolves the issue Michel saw, because --canonical-address can have a port that is not the port that the machine is listening on. But if the port is not specified, it should probably default to the port that the machine is listening on.
@digilord -- it looks like this is more complicated than it appears and unfortunately we don't have the resources to fix it now. I'm moving this to backlog. Could you post here if you didn't find a workaround, and we'll help you find one until we can fix this?
I'm running rethink inside an LXC container using Docker and am trying to connect using rethinkdb admin -j x.x.x.x:29015 from outside the container and have ran into this issue. I'm getting the exact same error as @digilord. What are the plans for fixing this issue, if there are any?
Alright, this is implemented pretty much to @timmaxw's specifications, and up in review 740. Some notes:
The new command-line option is --canonical-address HOST[:PORT] and can be specified multiple times. This option is available for all rethinkdb invocations that take a --join option, which would be porcelain, serve, proxy, and admin. If port is omitted, it will use whatever port the cluster ends up listening on. You cannot specify '0' for this port, as that would not make sense.
If no canonical addresses are given, we will use our bound local IP addresses (as we currently do) for intracluster routing. If there are any canonical addresses, we will only use those.
Peer addresses are now passed around the cluster as host/port pairs, which allows each node in the cluster to perform its own lookup of its peers' addresses.
This should allow port forwarding and tunneling and some other crazy stuff people do with their networks, but probably won't cover every situation.
Activity
coffeemug commentedon Mar 18, 2013
@timmaxw, @Tryneus -- you know the most about the routing code. What can we do to solve this problem? (Would turning off the checks be sufficient?)
neumino commentedon Mar 18, 2013
I think I had this issue before.
The ports used to forward traffic have to be the same (in and out ports).
On Mar 18, 2013 9:46 AM, "coffeemug" [email protected] wrote:
timmaxw commentedon Mar 18, 2013
Turning off the checks won't fix it.
Here's the problem: Machine 1 thinks its address is
peer_address{ips=[127.0.0.1, 127.0.1.1, 192.168.1.33], port=29015}. Machine 2 contacts it by connecting topeer_address{ips=[xxx.xxx.xxx.xxx], port=29015}. Suppose that we disable the check. Then Machine 2 will think that Machine 1's address ispeer_address{ips=[127.0.0.1, 127.0.1.1, 192.168.1.33], port=29015}, because that's what Machine 1 told Machine 2 its address was. Now suppose Machine 3 contacts Machine 2 and says, "How do I contact Machine 1"? Unless Machine 3 is behind the same firewall as Machine 1, the addresspeer_address{ips=[127.0.0.1, 127.0.1.1, 192.168.1.33], port=29015}won't work.Here's a solution: Add another command-line parameter. For the sake of discussion let's call it
--canonical-address. Its argument is a host and port. If a machine anywhere in the cluster tries to make a connection to the canonical address, it must reach this machine's clustering port. So, for a machine behind a firewall,--canonical-addresswould be the external address and port. Whenever two machines make a connection, they will swap canonical addresses; whenever Machine 2 needs to tell Machine 3 how to contact Machine 1, Machine 2 will give Machine 1's canonical address to Machine 3. The assertion that was tripped that caused this issue would be removed.That's the gist of it, but there are some subtleties to work out:
--canonical-addressdefault to? Perhaps it should default to whatever address(es) were bound to. But then it needs to permit multiple values. That's okay; if--canonical-addressis not specified, it defaults to our current behavior.--canonical-address, we don't resolve the hostname until it's time to make the connection. That way, they can have the same machine be contacted by different addresses from different locations. For example, if Machine A and Machine B are behind different firewalls but Machine A and Machine C are connected by a crossover cable, then Machine A's canonical address can just bemachine-a, and Machine C's hosts file can say thatmachine-ais whatever its IP is on the ethernet interface attached to the crossover cable, but Machine B's DNS lookup can say thatmachine-ais whatever external IP address the firewall will forward to Machine A.I'm not 100% sure about this; someone who knows more about DNS and IP should take a look. I wonder how existing clustering products do it?
timmaxw commentedon Mar 18, 2013
This also resolves the issue Michel saw, because
--canonical-addresscan have a port that is not the port that the machine is listening on. But if the port is not specified, it should probably default to the port that the machine is listening on.coffeemug commentedon Mar 20, 2013
@digilord -- it looks like this is more complicated than it appears and unfortunately we don't have the resources to fix it now. I'm moving this to backlog. Could you post here if you didn't find a workaround, and we'll help you find one until we can fix this?
digilord commentedon Mar 20, 2013
I will revisit this in a few weeks. Thanks for looking into it for me.
ConceitedCode commentedon Jul 1, 2013
I'm running rethink inside an LXC container using Docker and am trying to connect using
rethinkdb admin -j x.x.x.x:29015from outside the container and have ran into this issue. I'm getting the exact same error as @digilord. What are the plans for fixing this issue, if there are any?coffeemug commentedon Jul 1, 2013
This issue is currently unscheduled. I'll try to prioritize it and get this fixed in the 1.8 release. @Tryneus -- do you think this is doable?
Tryneus commentedon Jul 1, 2013
Absolutely, I'll start working on this once I finish up query/connection logging.
coffeemug commentedon Jul 1, 2013
Ok, in this case, @digilord @ConceitedCode -- this is scheduled for 1.8. Thanks for bringing it to our attention.
Tryneus commentedon Jul 15, 2013
Alright, this is implemented pretty much to @timmaxw's specifications, and up in review 740. Some notes:
The new command-line option is
--canonical-address HOST[:PORT]and can be specified multiple times. This option is available for allrethinkdbinvocations that take a--joinoption, which would be porcelain,serve,proxy, andadmin. If port is omitted, it will use whatever port the cluster ends up listening on. You cannot specify '0' for this port, as that would not make sense.If no canonical addresses are given, we will use our bound local IP addresses (as we currently do) for intracluster routing. If there are any canonical addresses, we will only use those.
Peer addresses are now passed around the cluster as host/port pairs, which allows each node in the cluster to perform its own lookup of its peers' addresses.
This should allow port forwarding and tunneling and some other crazy stuff people do with their networks, but probably won't cover every situation.
Tryneus commentedon Jul 17, 2013
This has been merged into next as of 5f487d0. Will be in the 1.8 release.