rabbitmq / rabbitmq-cli

Command line tools for RabbitMQ
Other
105 stars 34 forks source link

Introduce 'rabbitmq-diagnostics resolve_hostname' #431

Closed michaelklishin closed 4 years ago

michaelklishin commented 4 years ago

Helps with troubleshooting host name resolution behavior on nodes and locally for CLI tools:

rabbitmq-diagnostics resolver_info

rabbitmq-diagnostics resolver_info --offline

rabbitmq-diagnostics resolver_info --formatter=json

rabbitmq-diagnostics resolve_hostname rabbitmq.com

rabbitmq-diagnostics resolve_hostname rabbitmq.com --offline

rabbitmq-diagnostics resolve_hostname rabbitmq.com --offline --formatter=json

This is obviously not meant to be a replacement for existing tools such as dig, only a way to quickly spot obvious irregularities, e.g. those in environments that use custom Erlang inetrc files.

Per discussion @harshac.

michaelklishin commented 4 years ago

Backported to v3.8.x.

lukebakken commented 4 years ago

@michaelklishin these will be handy commands, thanks!

$ cat ~/.erl_inetrc 
{host, {192, 168, 1, 5}, ["shostakovich"]}.

$ ERL_INETRC="/home/lbakken/.erl_inetrc" ./sbin/rabbitmq-diagnostics resolver_info --offline
Displaying effective hostname resolver (inetrc) configuration used by CLI tools...
Runtime Hostname Resolver (inetrc) Settings

Lookup order: native
Hosts file: /etc/hosts
Resolver conf file: /etc/resolv.conf
Cache size: 

inetrc File Host Entries

192.168.1.5 shostakovich