mmdb
Manage GeoLite2 MMDB assets and inspect GeoIP lookup configuration.
xrat mmdb <command> [flags]
Subcommands
| Command | Description |
|---|---|
download | Download one or more GeoLite2 MMDB editions |
update | Refresh all supported GeoLite2 MMDB editions |
path | Print the resolved MMDB directory |
status | Show MMDB presence and size for each supported edition |
lookup | Look up a single IP through the configured GeoIP backend |
backend | Print the active GeoIP backend configuration |
download
Download one or more GeoLite2 MMDB editions.
xrat mmdb download [flags]
| Flag | Description |
|---|---|
--edition <name> | Edition to download. Repeatable: GeoLite2-Country, GeoLite2-City, GeoLite2-ASN or country, city, asn |
--all | Download all supported editions |
--output <dir> | Override the MMDB target directory for this command |
--force | Re-download even when the destination file already exists |
--url <url> | Override the download URL template. Use {edition} as a placeholder |
--timeout <secs> | Override the HTTP request timeout in seconds |
--quiet | Suppress progress bar output |
If neither --edition nor --all is given, the configured default_editions
from [mmdb] are used.
Examples
Download all editions to the default MMDB directory:
xrat mmdb download --all
Download a single edition:
xrat mmdb download --edition city
Download to a custom directory:
xrat mmdb download --all --output ./testdata/xrat/mmdb
update
Refresh all supported GeoLite2 MMDB editions. Equivalent to
download --all --force.
xrat mmdb update [flags]
| Flag | Description |
|---|---|
--output <dir> | Override the MMDB target directory for this command |
--url <url> | Override the download URL template. Use {edition} as a placeholder |
--timeout <secs> | Override the HTTP request timeout in seconds |
--quiet | Suppress progress bar output |
Example
xrat mmdb update
path
Print the resolved MMDB directory.
xrat mmdb path [flags]
| Flag | Description |
|---|---|
--output <dir> | Override the MMDB target directory for this command |
Resolution order:
--outputflag, if provided[mmdb].dirfrom config (resolved relative toXRAT_PATHor config file location)- Default:
~/.config/xrat/mmdb
Examples
xrat mmdb path
xrat mmdb path --output /custom/path
status
Show MMDB presence and size for each supported edition.
xrat mmdb status [flags]
| Flag | Description |
|---|---|
--output <dir> | Override the MMDB target directory for this command |
--strict | Exit non-zero when any supported edition is missing |
--json | Print status as JSON |
Example
xrat mmdb status --strict
xrat mmdb status --json
lookup
Look up a single IP address through the configured GeoIP backend.
xrat mmdb lookup <ip> [flags]
| Argument | Description |
|---|---|
ip | IP address to look up |
| Flag | Description |
|---|---|
--backend <name> | Override backend: mmdb, ipwhois, ip-api |
--no-cache | Bypass the configured in-memory cache for this invocation |
--json | Print the lookup result as JSON |
The lookup returns country code, city/region, and ASN information when available.
Examples
xrat mmdb lookup 8.8.8.8
xrat mmdb lookup 8.8.8.8 --backend ipwhois
xrat mmdb lookup 2001:4860:4860::8888 --json
backend
Print the active GeoIP backend configuration.
xrat mmdb backend [flags]
| Flag | Description |
|---|---|
--backend <name> | Override backend: mmdb, ipwhois, ip-api |
--no-cache | Describe the backend chain without cache wrapping |
--json | Print the backend configuration as JSON |
Shows lookup backend, fallback, cache settings, remote provider settings, and local MMDB paths.
Example
xrat mmdb backend
Troubleshooting
If mmdb status --strict reports missing files, download the supported MMDB
editions:
xrat mmdb download --all
If MMDB lookup fails but remote lookup works, check the resolved directory:
xrat mmdb path
xrat mmdb lookup 8.8.8.8 --backend ipwhois
Remote backends can be rate-limited by the provider. Use the default cache
unless you specifically need --no-cache for diagnostics.
Related
[mmdb]config — MMDB asset configuration[testing.geoip]config — GeoIP lookup backend configuration- GeoIP Enrichment — test result enrichment feature