Update the database during runtime
Use the MaxMind Update feature to keep the contents of the geolocation database current. This allows you to keep multiple HAProxy Enterprise nodes synced with the latest data.
Install a web server of your choice and host the database file(s) at a URL where HAProxy Enterprise can access. For example, host the files at
http://192.168.122.1:8000/GeoIP2-City.mmdb
andhttp://192.168.122.1:8000/GeoIP2-ISP.mmdb
.-
Add the following lines to the
global
section of your configuration file, where the URL hosts an updated version of the file:global # ... other global settings maxmind-update url CITY
http://192.168.122.1:8000/GeoIP2-City.mmdburlISP http://192.168.122.1:8000/GeoIP2-ISP.mmdb delay 24h checksum hash log
With this configuration, HAProxy Enterprise downloads the database every 24 hours and displays a message in the logs when it succeeds or if it encountered errors during the update.
maxmind-update
The maxmind-update
directive enables updating the database over HTTP from a specified URL. You can specify multiple database types and their respective URLs. If there are multiple database types specified, they will download sequentially with a delay between each download. Updating a database with a newer version invalidates any cached lookups (if caching is used), unless you enable checksum
and the new and old database contents are identical.
The directive supports the following syntax:
maxmind-update url <db_type> <db_url>
[url <db_type> <db_url>]*
[delay <number>]
[timeout <number>]
[retries <number>]
[checksum]
[log]
[dontlog-normal]
Parameters | Description |
---|---|
| Required. Can be any of the following: - CITY - COUNTRY - ISP - ANONYMOUS You must have already used the <db_type> with the |
| Required. URL to connect to and download a new version of the database of type |
| Specifies the delay between each attempt to download a new database version. |
| Specifies the HTTP connect timeout for attempts to download a new database version. The default value is in milliseconds, but you can specify any other unit if you add it as a suffix to the number (default: 5 milliseconds). |
| Specifies the number of retries to download a new database version. If unspecified, the global retries value applies (default: 3). |
| If present, it specifies to use a SHA1 checksum to verify that a newly downloaded database is identical to the current one. If they are identical, then a live-reload of the database does not take place, thereby preserving cache contents (if using caching). |
| Specifies whether to log operation errors. |
| Deactivates logging for successful updates. |
Next up
MaxMind API Reference