geoipmaxmindgeoip2

Updating Maxmind DatabaseReader between mmdb file manipulations


I have read many pages of documentation, and cannot find a clear answer regarding that. Is it allowed to modify the mmdb file (for example, by geoipupdate) while a DatabaseReader is open? Or does any such manipulation render the existing Reader instances as corrupt, and a new one should be created? I see that the Legacy format has a cache flag which handles mmdb updates, but can't find anything explicit regarding the new one.


Solution

  • You don't say which API or OS you are using, but, using any of the official APIs on Linux, you may replace the database file using geoipupdate or moving the new file over the old one when both are on the same file system. The old file is not physically deleted until it is no longer in use. You will, however, need to reopen the database if you want the new file to be available to your application.