querybara test
- CLI
- PostgreSQL
- MySQL
- MariaDB
- MongoDB
- Redis / Valkey
- Elasticsearch
querybara test runs the same stepwise check as Test Connection in the desktop app: DNS, TCP, SSH,
TLS, authentication, ping and server version. It stops at the step that fails and prints a hint
for fixing it. Use it before a job that depends on a database, or to find out why a connection
does not work. It works with every engine the CLI supports.
Usage: querybara test [options] <target>
test a connection step by step: DNS, TCP, SSH, TLS, auth, ping, version
Arguments: target profile name or id, or connection URI
Options: --tls <mode> TLS mode for this run: disable, require, verify-ca or verify-full --json print the steps as JSON --ssh <user@host[:port]> reach URI targets through this SSH server; repeat for jump hosts, in order --ssh-key <path> SSH private key file (OpenSSH, PEM or PuTTY .ppk) --ssh-password-env <VAR> take the SSH password from this variable (default QUERYBARA_SSH_PASSWORD, else a prompt) --ssh-agent log in with the keys of ssh-agent (SSH_AUTH_SOCK) or Pageant --proxy <url> reach URI targets (or their first SSH server) through socks5://host:port or http://host:port --ssh-accept-new trust and remember an SSH host key not seen before (a changed key is always refused) --known-hosts <path> SSH known hosts file (default: the desktop app's) -h, --help show help for a command
Exit code 0 when every step passes, 1 when one fails (with a fix hint), 2 on errors.
Examples: querybara test prod-db querybara test "postgres://[email protected]:5432/app?sslmode=verify-full" querybara test "postgres://[email protected]/app" --ssh [email protected] --ssh-agent querybara test "https://[email protected]:9200"The --tls and SSH options are described in
Global options.
Examples
Section titled “Examples”Test a saved profile:
querybara test shop-prodTest a URI with TLS verification:
Test a server that is reachable only through a bastion:
Test the other engines:
querybara test "redis://cache.example.com:6379/0"Use the result in a script. --json prints an object with target, engine, ok and the
steps:
if querybara test shop-prod --json > test.json; then echo "shop-prod is reachable"fiExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | Every step passed |
| 1 | A step failed; the output names it and gives a fix hint |
| 2 | An error before the check could run, such as a bad target |
| 130 | Interrupted with Ctrl + C |
When the authentication step fails because no password was given and a terminal is attached, the CLI asks for the password and runs the check again.
Related
Section titled “Related”Documents Querybara 0.1.1 · built frombc9f5aa