GeoIP Database Setup¶
Client-location lookups — the geo-ip filter-chain step, Regions,
prox geo-proximity routing, latency region bonuses, carbon/cost-aware
routing, and the client.geo script binding — are all served by one shared MaxMind
GeoIP2/GeoLite2 database reader per node.
This page covers both manually uploading a database and configuring scheduled auto-fetch directly from MaxMind.
How it's stored¶
Each node keeps its database at a managed path (/var/lib/gslbd/geoip/current.mmdb by
default, or wherever loadBalancer.latency.geoIPDBPath / loadBalancer.geoIP.dbPath points if
you've set one in gslbd.yaml). A node with nothing uploaded yet still starts up normally —
GeoIP-dependent features simply treat every client as unlocatable until a database is provided
(unless a bundled fallback is available, see below).
Uploading a new database (via the WebUI or gslbctl) validates it, then swaps it in live —
no daemon restart. The previous database keeps serving until a candidate actually passes
validation, so a bad upload never takes GeoIP lookups down.
Validation¶
Before a candidate database is accepted, it's checked that it:
- Opens as a genuine MaxMind-format database (
geoip2.Opensucceeds and the metadata'sdatabase_typeis non-empty). - Has a
build_epochnewer than the currently-live database (skipped on a node's first-ever upload — there's nothing to compare against). - Has an internal
node_countand file size within 15% of the currently-live database — guards against an accidentally truncated or otherwise corrupted download. - Passes every configured fixture (see below) — an IP that no longer resolves to its expected country rejects the candidate outright.
A rejected candidate is discarded entirely; the error is returned in the API response / CLI output and nothing changes on disk.
When the size check is wrong¶
The 15% bound exists to catch a truncated download, but a genuine rebuild of an edition can also
shrink or grow by more than that. MaxMind's own checksum is verified before this check runs, so a
candidate that fails only the size check is usually an intact file from a new build — not a
corrupt one. It is still worth looking at before overriding: compare a handful of IPs against the
live database (for example with mmdblookup), and note that the fixture checks have not run yet
on a candidate rejected here.
The override waives only the size/node_count comparison. The file must still be a genuine
MaxMind database, newer than the live one, and pass every fixture. There are two scopes:
- One node — upload with force.
gslbctl geoip upload <file> --force, or Upload anyway in the WebUI after a size rejection (POST /api/v1/geoip/database?force=true). It only updates the node that received the upload. - Every node — accept the build.
gslbctl geoip accept, or Accept latest build for all nodes in the WebUI (POST /api/v1/geoip/accept). This records MaxMind's current build date in the shared datastore, and each node's auto-fetch applies that build on its next poll. It matches that one build only, so it stops applying as soon as MaxMind publishes the next release.
Fixture set¶
A fixture is a {ip, expectedCountry} assertion — "this IP must resolve to this country" — run
against every candidate database as part of validation. Configure your own under Admin →
GeoIP → Fixture Set: add IPs for your own POPs, the regions you actually route to, or known
large-customer prefixes, so a MaxMind release that mis-locates something you care about is
caught before it goes live rather than after.
An empty configured set falls back to a small built-in default (currently Google Public DNS → US and a RIPE NCC root-server IP → NL) — illustrative, not a substitute for fixtures meaningful to your own deployment. Nexus ships to many customers with different regions and POPs, so there's no one fixed list that makes sense for everyone.
gslbctl geoip fixtures list
gslbctl geoip fixtures add 203.0.113.1 AU --description "Sydney POP"
gslbctl geoip fixtures remove <id>
WebUI — Admin → GeoIP¶
Navigate to Admin → GeoIP. The status card shows the source (unconfigured / manual /
MaxMind auto-fetch / bundled fallback), database type, build date, size, and any recent
failures. Operators with settings:write see an upload button — pick a .mmdb file and it's
validated and swapped in immediately. An upload only updates the node you are connected to.
If a MaxMind account ID and license key are saved, Download latest .mmdb from MaxMind fetches the current database for the configured edition and hands it to your browser, so you can inspect it and upload it without needing a MaxMind login. The licence key stays on the server. Each download counts against MaxMind's daily download limit, so it only runs when clicked. When auto-fetch is being rejected by the size check, the status card also offers Accept latest build for all nodes (see When the size check is wrong).
gslbctl¶
gslbctl geoip status
gslbctl geoip upload /path/to/GeoLite2-City.mmdb
gslbctl geoip upload /path/to/GeoLite2-City.mmdb --force # waive the size check, this node only
gslbctl geoip download -o GeoLite2-City.mmdb # MaxMind's current build, MD5-checked
gslbctl geoip accept # let every node take the current build
gslbctl geoip fixtures list
API¶
GET /api/v1/geoip/status — requires settings:read
POST /api/v1/geoip/database — multipart upload, field name "database"; ?force=true waives the size check; requires settings:write
GET /api/v1/geoip/download — streams MaxMind's current .mmdb using the saved credentials; requires settings:write
POST /api/v1/geoip/accept — accepts MaxMind's current build cluster-wide despite the size check; requires settings:write
GET /api/v1/geoip/fixtures — requires settings:read
POST /api/v1/geoip/fixtures — requires settings:write
DELETE /api/v1/geoip/fixtures/{id} — requires settings:write
GET /api/v1/settings/geoip — requires settings:read
PUT /api/v1/settings/geoip — requires settings:write
DELETE /api/v1/settings/geoip — requires settings:write
POST /api/v1/settings/geoip/test — requires settings:write
Where to get a database¶
MaxMind's GeoLite2 (free,
requires a MaxMind account) or GeoIP2 (paid, more accurate/frequently updated) City edition
gives full city/subdivision/country/continent resolution. The Country edition works too, at
country/continent granularity only — every location-dependent feature (the geo-ip filter
step, Regions, prox, latency region
bonuses, carbon/cost-aware routing) degrades gracefully to country/continent-tier matching
rather than erroring when city/subdivision/coordinate fields are absent. The status card and
gslbctl geoip status both show the loaded database's actual granularity under Granularity,
so you can confirm what you're actually getting before relying on city-level routing.
The query tracer additionally shows a ±Nkm confidence radius
next to the resolved client region whenever the loaded database reports one (City databases
only) — useful as a sanity check on how precisely a given client was actually located.
MaxMind scheduled auto-fetch¶
Instead of manually re-uploading, each node can independently poll MaxMind and pull in a newer database on its own — no restart, no manual step, and no single coordinating node (every node in the cluster fetches, validates, and swaps identically; a real download only happens when MaxMind's own metadata reports a genuinely different database, so there's no meaningful extra load on MaxMind even with several nodes each checking).
Configure it under Admin → GeoIP → MaxMind Auto-Fetch:
| Field | Description |
|---|---|
| Account ID | Your MaxMind account ID |
| License Key | Your MaxMind license key — write-only; leave blank on a later save to keep the existing one |
| Edition ID | The database edition to track, e.g. GeoLite2-City, GeoIP2-City (default GeoLite2-City) |
| Poll Interval | How often each node checks for an update, in seconds (default 21600 = 6h) |
| Proxy URL (optional) | http://user:pass@host:port — supports an authenticated proxy |
| CA Bundle Path (optional) | PEM file on disk, for a custom/internal CA in front of the MaxMind endpoint |
| Enabled | Turns polling on/off without discarding the saved credentials |
Test validates the account ID and license key against MaxMind's metadata endpoint only — it never counts against your daily database download limit. Save persists the settings; every node picks them up on its next poll cycle (at most one interval later).
Every fetch attempt reuses the exact same validation described above (genuine-database check,
build_epoch-newer, size/node_count sanity bounds) plus an MD5 integrity check against the
value MaxMind's own metadata reports for the edition, before the atomic swap. A rejected or
failed fetch leaves the previously-serving database completely untouched, and is visible in the
status card's "Consecutive Failures" / "Last Error" fields. A sustained failure (e.g. an expired
license key) triggers an alert through your configured alerting channels
— sent once per outage, not once per cluster node, and at most hourly while it persists.
gslbctl/Terraform have no equivalent for these settings — same as
SMTP settings, this is WebUI-only, since it's a write-once secret-holding
configuration resource rather than a managed infrastructure object.
Bundled fallback database¶
No dataset ships today. gslbd has the code path to fall back to a small database
embedded directly in the binary when a node has never had one manually uploaded or
MaxMind-fetched, but the binary doesn't actually embed one — redistributing a real
third-party dataset commits Nexus to that dataset's license obligations, which needs a
legal/product decision this page can't make for you. Until that's cleared, a node with
nothing configured simply treats every client as unlocatable, exactly as described above.
If a dataset is embedded in a future release, the status card and gslbctl geoip status
show source: bundled with a Reduced accuracy badge/warning — a signal to upload a
real database or configure auto-fetch rather than relying on the fallback long-term. It's
only ever used when nothing else is; any manual upload or successful MaxMind fetch takes
over immediately and permanently (until the managed database file is deleted outside of
gslbd entirely, which isn't a supported operation).