Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

mmdb

Manage GeoLite2 MMDB assets and inspect GeoIP lookup configuration.

xrat mmdb <command> [flags]

Subcommands

CommandDescription
downloadDownload one or more GeoLite2 MMDB editions
updateRefresh all supported GeoLite2 MMDB editions
pathPrint the resolved MMDB directory
statusShow MMDB presence and size for each supported edition
lookupLook up a single IP through the configured GeoIP backend
backendPrint the active GeoIP backend configuration

download

Download one or more GeoLite2 MMDB editions.

xrat mmdb download [flags]
FlagDescription
--edition <name>Edition to download. Repeatable: GeoLite2-Country, GeoLite2-City, GeoLite2-ASN or country, city, asn
--allDownload all supported editions
--output <dir>Override the MMDB target directory for this command
--forceRe-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
--quietSuppress 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]
FlagDescription
--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
--quietSuppress progress bar output

Example

xrat mmdb update

path

Print the resolved MMDB directory.

xrat mmdb path [flags]
FlagDescription
--output <dir>Override the MMDB target directory for this command

Resolution order:

  1. --output flag, if provided
  2. [mmdb].dir from config (resolved relative to XRAT_PATH or config file location)
  3. 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]
FlagDescription
--output <dir>Override the MMDB target directory for this command
--strictExit non-zero when any supported edition is missing
--jsonPrint 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]
ArgumentDescription
ipIP address to look up
FlagDescription
--backend <name>Override backend: mmdb, ipwhois, ip-api
--no-cacheBypass the configured in-memory cache for this invocation
--jsonPrint 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]
FlagDescription
--backend <name>Override backend: mmdb, ipwhois, ip-api
--no-cacheDescribe the backend chain without cache wrapping
--jsonPrint 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.