-
Notifications
You must be signed in to change notification settings - Fork 1.3k
NUTCH-3064 Upgrade index-geoip to GeoIP2 5.0.2 #825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
This PR now upgrades the ChangesDependency Updates
Performance Improvement — CHMCacheDatabase readers now use DatabaseReader reader = new DatabaseReader.Builder(db)
.withCache(new CHMCache())
.build();This caches parsed database nodes in memory, reducing disk I/O and improving throughput when the same IP prefixes are queried repeatedly during indexing. New Configuration Options in
|
| Property | Description |
|---|---|
index.geoip.db.anonymous |
Anonymous IP database — identifies VPNs, proxies, Tor exit nodes |
index.geoip.db.asn |
ASN database — autonomous system number and organization |
index.geoip.db.city |
City database — city, subdivision, country, continent, coordinates |
index.geoip.db.connection |
Connection Type database — Cable/DSL, Cellular, Corporate, Satellite |
index.geoip.db.domain |
Domain database — second-level domain for the IP |
index.geoip.db.isp |
ISP database — ISP name, organization, ASN |
MaxMind Insights Web Service Support
| Property | Description |
|---|---|
index.geoip.insights.userid |
User ID for MaxMind Precision Insights API |
index.geoip.insights.licensekey |
License key for the Insights API |
Architecture Improvements
- Refactored to support multiple databases via
EnumMap<DatabaseType, DatabaseReader> - Each database type is loaded independently and queried in sequence
- Proper resource cleanup via
Closeableimplementation - Graceful error handling per-database (one failure doesn't block others)
Files Modified
src/plugin/index-geoip/— plugin source, tests, dependencies, and configbuild.xml— root build configurationconf/nutch-default.xml— new GeoIP configuration propertiessrc/plugin/build.xml— plugin build configurationsrc/plugin/indexer-solr/schema.xml— Solr schema field definitions
|
Most recent updates address a field duplication issue which could result when chaining multiple GeoIP databases. Required configuration |
Work in Progress
This PR begins to address NUTCH-3064 by performing the upgrade of the com.maxmind.geoip2:geoip2 dependency to v4.2.0. It has not been tested in distributed Nutch deployment as of yet. I say this because although no additional dependencies have been added I will wish to test out a full deployment.
In addition to the proposed upgrade I performed some refactoring which I considered to be improvements.
Refactoring/Improvements
nutch-default.xml.insightsServiceas the default value for theindex.geoip.usageconfiguration property. The value is now empty.index.geoip.db.filewhich facilitates specifying the Maxmind DB file packaged with Nutch.job.trymethods; "...If you are looking up many IPs that are not contained in the database, the try method will be slightly faster as they do not need to construct and throw an exception."index.geoip.usageconfiguration property. Available values are nowanonymous,asn,city,connection,domain,insightsorisp. THIS IS A BACKWARDS INCOMPATIBLE BREAKING CHANGE which we would need to call out in the release notes. I decided to implement this change based on recent feedback which I agree with btw.Future work
I can anticipate a use case where multiple Maxmind DB's and/or Web service looksups may wish to be chained together with the results being aggregated within one
NutchDocument. I did not wish to complicate this PR any more though so any implementation will be described first in another Jira ticket.