oschwald / geoip2-golang

Unofficial MaxMind GeoIP2 Reader for Go
ISC License
1.87k stars 193 forks source link

Update Procedure #39

Closed chrisprobst closed 5 years ago

chrisprobst commented 5 years ago

Hi,

what are the implications of using geoipupdate using cron while having an open reference to the database? Is this problematic? How can an update be performed? We are using this library extensively for StriveCDN and would like to know how this situation can have negative impacts.

Best, Chris

oschwald commented 5 years ago

On a Linux or similar OS, there should be no problems running geiopupdate while using this library. The default mode is memory map, and it will continue to use the old file until it is closed.

If you want to switch to the new file, you will need to replace the reader with one for the new file. In a web service I wrote that uses this library, I use fsnotify to watch for a new database and then replace it as needed.