diff --git a/apps/nsqadmin/main.go b/apps/nsqadmin/main.go index cae3144ad..f6ae4ea5a 100644 --- a/apps/nsqadmin/main.go +++ b/apps/nsqadmin/main.go @@ -56,6 +56,7 @@ func nsqadminFlagSet(opts *nsqadmin.Options) *flag.FlagSet { flagSet.Var(&nsqlookupdHTTPAddresses, "lookupd-http-address", "lookupd HTTP address (may be given multiple times)") nsqdHTTPAddresses := app.StringArray{} flagSet.Var(&nsqdHTTPAddresses, "nsqd-http-address", "nsqd HTTP address (may be given multiple times)") + flagSet.Bool("skip-resolve-on-startup", false, "skip DNS lookup of addresses on startup") adminUsers := app.StringArray{} flagSet.Var(&adminUsers, "admin-user", "admin user (may be given multiple times; if specified, only these users will be able to perform privileged actions; acl-http-header is used to determine the authenticated user)") diff --git a/nsqadmin/nsqadmin.go b/nsqadmin/nsqadmin.go index f27801a25..7d67a4c9c 100644 --- a/nsqadmin/nsqadmin.go +++ b/nsqadmin/nsqadmin.go @@ -82,17 +82,19 @@ func New(opts *Options) (*NSQAdmin, error) { n.httpClientTLSConfig.RootCAs = tlsCertPool } - for _, address := range opts.NSQLookupdHTTPAddresses { - _, err := net.ResolveTCPAddr("tcp", address) - if err != nil { - return nil, fmt.Errorf("failed to resolve --lookupd-http-address (%s) - %s", address, err) + if !opts.SkipResolveOnStartup { + for _, address := range opts.NSQLookupdHTTPAddresses { + _, err := net.ResolveTCPAddr("tcp", address) + if err != nil { + return nil, fmt.Errorf("failed to resolve --lookupd-http-address (%s) - %s", address, err) + } } - } - for _, address := range opts.NSQDHTTPAddresses { - _, err := net.ResolveTCPAddr("tcp", address) - if err != nil { - return nil, fmt.Errorf("failed to resolve --nsqd-http-address (%s) - %s", address, err) + for _, address := range opts.NSQDHTTPAddresses { + _, err := net.ResolveTCPAddr("tcp", address) + if err != nil { + return nil, fmt.Errorf("failed to resolve --nsqd-http-address (%s) - %s", address, err) + } } } diff --git a/nsqadmin/options.go b/nsqadmin/options.go index 8100af881..0540482a8 100644 --- a/nsqadmin/options.go +++ b/nsqadmin/options.go @@ -25,6 +25,7 @@ type Options struct { NSQLookupdHTTPAddresses []string `flag:"lookupd-http-address" cfg:"nsqlookupd_http_addresses"` NSQDHTTPAddresses []string `flag:"nsqd-http-address" cfg:"nsqd_http_addresses"` + SkipResolveOnStartup bool `flag:"skip-resolve-on-startup" cfg:"skip_resolve_on_startup"` HTTPClientConnectTimeout time.Duration `flag:"http-client-connect-timeout"` HTTPClientRequestTimeout time.Duration `flag:"http-client-request-timeout"`