juicedata/juicefs · error
Can't connect to cluster %s: %s
Error message
Can't connect to cluster %s: %s
What it means
newCeph calls conn.Connect() to establish the actual network connection to the Ceph cluster after reading the config. If the connection attempt fails (monitors unreachable, authentication keyring missing/invalid), construction aborts with this message.
Source
Thrown at pkg/object/ceph.go:363
opt = "$run_dir/jfs-$cluster-$name-$pid.asok"
}
if err = conn.SetConfigOption("admin_socket", opt); err != nil {
logger.Warnf("Failed to set admin_socket to %s: %s", opt, err)
}
}
if opt := os.Getenv("CEPH_LOG_FILE"); opt != "none" {
if opt == "" {
opt = "/var/log/ceph/jfs-$cluster-$name.log"
}
if err = conn.SetConfigOption("log_file", opt); err != nil {
logger.Warnf("Failed to set log_file to %s: %s", opt, err)
}
}
if err := conn.ReadDefaultConfigFile(); err != nil {
return nil, fmt.Errorf("Can't read default config file: %s", err)
}
if err := conn.Connect(); err != nil {
return nil, fmt.Errorf("Can't connect to cluster %s: %s", cluster, err)
}
return &ceph{
name: name,
conn: conn,
free: make(chan *rados.IOContext, 50),
}, nil
}
func init() {
Register("ceph", newCeph)
}
View on GitHub (pinned to c9a67b23e8)
Solutions
- Verify monitor addresses in ceph.conf are reachable (ping/telnet mon host ports)
- Ensure the client keyring for the configured user exists and is readable (e.g. /etc/ceph/ceph.client.admin.keyring)
- Update mon_host in ceph.conf to the current monitor list
- Check `ceph -s --name <user> --keyring <path>` works before mounting
Example fix
// before mon_host = 10.0.0.1 # stale monitor // after mon_host = 10.0.0.10 10.0.0.11 10.0.0.12 keyring = /etc/ceph/ceph.client.admin.keyring
Defensive patterns
Strategy: validation
Validate before calling
// Shell: preflight connectivity and auth
ceph -s --name client.admin --keyring /etc/ceph/ceph.client.admin.keyring || {
echo "cluster unreachable or auth failed"; exit 1;
} Try / catch
// Go
obj, err := object.NewCeph(endpoint, cluster, user, "")
if err != nil && strings.Contains(err.Error(), "Can't connect to cluster") {
// check monitors reachable and keyring present; do not hot-retry blindly
} Prevention
- Keep mon_host current in ceph.conf (use DNS mon host where possible)
- Distribute and permission client keyrings via config management
- Monitor ports 6789/3300 open between client and monitors
When it happens
Trigger: conn.Connect() errors: monitor addresses unreachable from this host, client keyring missing for the configured user, or authentication rejected by the cluster.
Common situations: Network/firewall blocking monitor ports (6789/3300); missing or misplaced /etc/ceph/ceph.client.admin.keyring; monitor list in ceph.conf stale after cluster re-IP; clock skew or auth cap changes.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- Can't create connection to cluster %s for user %s: %s
- Can't read default config file: %s
- ceph: can't put empty file
- Failed to create bucket %s: %s, previous error: %s
- (max tries) upload block %s: %s (after %d tries)
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/250f3a9ad5b0aa78.
Report an issue: GitHub.