{"record":{"id":"3458b85c482daf66","repo":"vitessio/vitess","slug":"findreplicas-lookuphost-failed-v","errorCode":null,"errorMessage":"FindReplicas: LookupHost failed %v","messagePattern":"FindReplicas: LookupHost failed (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/replication.go","lineNumber":1164,"sourceCode":"\tfor _, row := range qr.Rows {\n\t\t// Check for prefix, since it could be \"Binlog Dump GTID\".\n\t\tif strings.HasPrefix(row[colCommand].ToString(), binlogDumpCommand) {\n\t\t\thost := row[colClientAddr].ToString()\n\t\t\tif host == \"localhost\" {\n\t\t\t\t// If we have a local binlog streamer, it will\n\t\t\t\t// show up as being connected\n\t\t\t\t// from 'localhost' through the local\n\t\t\t\t// socket. Ignore it.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thost, _, err = netutil.SplitHostPort(host)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"FindReplicas: malformed addr %v\", err)\n\t\t\t}\n\t\t\tvar ips []string\n\t\t\tips, err = net.LookupHost(host)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"FindReplicas: LookupHost failed %v\", err)\n\t\t\t}\n\t\t\taddrs = append(addrs, ips...)\n\t\t}\n\t}\n\n\treturn addrs, nil\n}\n\n// GetGTIDMode gets the GTID mode for the server\nfunc (mysqld *Mysqld) GetGTIDMode(ctx context.Context) (string, error) {\n\tconn, err := getPoolReconnect(ctx, mysqld.dbaPool)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer conn.Recycle()\n\n\treturn conn.Conn.GetGTIDMode()\n}","sourceCodeStart":1146,"sourceCodeEnd":1182,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/replication.go#L1146-L1182","documentation":"After splitting a replica address into host and port, FindReplicas performs net.LookupHost(host) to resolve the hostname to IPs. DNS resolution failure produces this error and aborts the lookup of all replica IPs.","triggerScenarios":"Calling FindReplicas/GetReplicas when a replica hostname from replication status cannot be resolved by DNS — e.g. stale DNS entries, replicas behind NAT, or hostnames absent from /etc/hosts.","commonSituations":"Kubernetes/container environments where pod hostnames change; DNS outages or misconfigured resolv.conf; replication configured with hostnames that no longer exist.","solutions":["Verify `getent hosts <replica-host>` (or nslookup) resolves on the machine running FindReplicas","Fix DNS configuration or add the replica hostnames to /etc/hosts","Update replication report_host settings to use resolvable names or IPs","Retry after DNS recovers; if transient, consider caching/resilient resolution upstream"],"exampleFix":"// before: report_host = replica-1.internal (unresolvable)\n// after: in replica my.cnf\n// report_host = 10.0.0.5  // or a DNS-resolvable name","handlingStrategy":"retry","validationCode":"// pre-check resolvability of replica hosts\nhost := \"replica-1.internal\"\nif ips, err := net.LookupHost(host); err != nil {\n    log.Warnf(\"host %s not resolvable: %v\", host, err)\n} else {\n    _ = ips\n}","typeGuard":null,"tryCatchPattern":"addrs, err := mysqld.FindReplicas()\nif err != nil && strings.Contains(err.Error(), \"LookupHost failed\") {\n    time.Sleep(2 * time.Second) // transient DNS\n    addrs, err = mysqld.FindReplicas()\n}","preventionTips":["Use IPs or DNS-resolvable names in report_host","Monitor DNS health in the cluster","Keep /etc/hosts entries current in static environments"],"tags":["network","dns","mysqlctl","replication"],"backgroundTag":"dns-resolution-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}