vitessio/vitess · error
FindReplicas: LookupHost failed
Error message
FindReplicas: LookupHost failed %v
What it means
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.
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
Example fix
// before: report_host = replica-1.internal (unresolvable) // after: in replica my.cnf // report_host = 10.0.0.5 // or a DNS-resolvable name
Defensive patterns
Strategy: retry
Validate before calling
// pre-check resolvability of replica hosts
host := "replica-1.internal"
if ips, err := net.LookupHost(host); err != nil {
log.Warnf("host %s not resolvable: %v", host, err)
} else {
_ = ips
} Try / catch
addrs, err := mysqld.FindReplicas()
if err != nil && strings.Contains(err.Error(), "LookupHost failed") {
time.Sleep(2 * time.Second) // transient DNS
addrs, err = mysqld.FindReplicas()
} Prevention
- Use IPs or DNS-resolvable names in report_host
- Monitor DNS health in the cluster
- Keep /etc/hosts entries current in static environments
When it happens
Trigger: 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.
Common situations: Kubernetes/container environments where pod hostnames change; DNS outages or misconfigured resolv.conf; replication configured with hostnames that no longer exist.
Related errors
- FindReplicas: malformed addr
- can't dial mysqlctld
- Connection DNS for has changed; old: new
- Connection DNS for reporting as empty, ignoring
- err
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/3458b85c482daf66.
Report an issue: GitHub.
Appendix: source
Thrown at go/vt/mysqlctl/replication.go:1164
for _, row := range qr.Rows {
// Check for prefix, since it could be "Binlog Dump GTID".
if strings.HasPrefix(row[colCommand].ToString(), binlogDumpCommand) {
host := row[colClientAddr].ToString()
if host == "localhost" {
// If we have a local binlog streamer, it will
// show up as being connected
// from 'localhost' through the local
// socket. Ignore it.
continue
}
host, _, err = netutil.SplitHostPort(host)
if err != nil {
return nil, fmt.Errorf("FindReplicas: malformed addr %v", err)
}
var ips []string
ips, err = net.LookupHost(host)
if err != nil {
return nil, fmt.Errorf("FindReplicas: LookupHost failed %v", err)
}
addrs = append(addrs, ips...)
}
}
return addrs, nil
}
// GetGTIDMode gets the GTID mode for the server
func (mysqld *Mysqld) GetGTIDMode(ctx context.Context) (string, error) {
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return "", err
}
defer conn.Recycle()
return conn.Conn.GetGTIDMode()
}View on GitHub (pinned to 01a25a7d17)