-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a default value for --nodename. (#16)
It is not always possible to obtain a default value for --nodename, because of the way Postgres HBA rules matching is implemented. We need to have an hostname for the local server that resoves in DNS to an IP that is on the same server. So in this patch we find which interface is used to connect to an external service, either the pg_auto_failover monitor or the Google 8.8.8.8:53 service, and then do a reverse DNS lookup for our local routed IP. If we get a candidate --nodename, we then do a DNS lookup of it and check that we get back an IP address that we have on the local server. When all those conditions are met then we take this hostname as a default --nodename. When we fail to do DNS lookups (reverse and then forward), keep the local IP address we found as the default --nodename, it might just work. Users can still easily override the discovered default by using the --nodename option if needed. When a --nodename is provided, we also check that we can resolve it with the current DNS setup, and WARN the user when that's not the case. It might be that we don't have enough information in our tests, so we continue with the --nodename.
- Loading branch information
Showing
22 changed files
with
1,075 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.