databendlabs/databend · error
no metasrv running on
Error message
no metasrv running on: {} What it means
keys_layout_from_grpc picks the first address in the configured list where a metasrv service is actually running (checked via is_service_running). If none of the addresses respond, it fails with 'no metasrv running on: <endpoint>'.
Solutions
- Start the databend-meta service before running the command
- Verify the --grpc-api-address host and port (default 9191) match a running metasrv
- Test reachability: curl or nc to the address to confirm the gRPC port is open
- Check metasrv logs for startup failure and confirm the address list in the config includes a live node
Example fix
// before metactl --grpc-api-address 127.0.0.1:9192 # nothing listens here // after metactl --grpc-api-address 127.0.0.1:9191 # live metasrv admin API
Defensive patterns
Strategy: validation
Validate before calling
#!/bin/bash
ADDR=127.0.0.1:9191
nc -z $(cut -d: -f1 $ADDR) $(cut -d: -f2 $ADDR) || { echo "metasrv not reachable on $ADDR"; exit 1; }
# then run metactl with --grpc-api-address $ADDR Try / catch
match result {
Err(e) if e.to_string().contains("no metasrv running on") => {
eprintln!("metasrv is not up at the given address; start databend-meta and retry");
}
other => other?,
} Prevention
- Check metasrv health (admin API) before metactl commands
- Confirm the gRPC/admin port (default 9191) in configs
- Ensure network/firewall allows the metactl host to reach metasrv
- Add a readiness wait loop in automation before invoking metactl
When it happens
Trigger: Running `metactl` subcommands that inspect key layout from a live node when the provided --grpc-api-address points at a host/port where no metasrv listens, or where all candidates in the address list are down.
Common situations: Metasrv not started yet, wrong port in --grpc-api-address, firewall/DNS issues, metasrv crashed, or running metactl on a machine that cannot reach the cluster.
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
- no metasrv running on
- Failed to create client
- ContextVar has no value
- not implemented
- grpc_api_address MUST not be empty!
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/32f4c7cbfdd58221.
Report an issue: GitHub.
Appendix: source
Thrown at src/meta/control/src/keys_layout_from_grpc.rs:59
/// if port is open, service is running
async fn is_service_running(addr: SocketAddr) -> Result<bool, io::Error> {
let socket = TcpSocket::new_v4()?;
let stream = socket.connect(addr).await;
Ok(stream.is_ok())
}
/// try to get available grpc api socket address
async fn get_available_socket_addr(endpoint: &str) -> Result<SocketAddr, anyhow::Error> {
let addrs_iter = endpoint.to_socket_addrs()?;
for addr in addrs_iter {
if is_service_running(addr).await? {
return Ok(addr);
}
eprintln!("WARN: {} is not available", addr);
}
Err(anyhow!("no metasrv running on: {}", endpoint))
}
pub async fn keys_layout_from_grpc(addr: &str, depth: Option<u32>) -> anyhow::Result<()> {
let client = MetaGrpcClient::<DatabendRuntime>::try_create(
vec![addr.to_string()],
"root",
"xxx",
None,
None,
None,
DEFAULT_GRPC_MESSAGE_SIZE,
)?;
let mut grpc_client = client.make_established_client().await?;
let request = protobuf::KeysLayoutRequest { depth };
let response = grpc_client.snapshot_keys_layout(request).await?;
View on GitHub (pinned to 288d84d76e)