Ip ranges/CIDR

,

Hi Again,

We are trying to load something similar to MaxMind City database into AeroSpike, and find the appropriate range for a specific IP address ( the ranges are all around , even /12 ranges . For simplicity let’s assume that there aren’t any collisions between them).

We are updating the ranges constantly, so saving all possible IPs in the world or saving them as C class is too much of a hassle.

I saw that you answered in How to query IP to Geo data from Aerospike - #2 by bbulkow :

“An alternate pattern is to think of the problem in a more relational way. If your geo information is supplied as a “network” (with a unique name and a range), you can insert a row per network, use the integer form of the IP address in a column, index that column, and look up using range queries — just like you would do in a relational or SQL system (but it’ll be parallel and distributed).”

But, we saw that the RANGE query cannot access 2 different columns… What are we missing ?

We also thought to build one 64bit column that contains the [ from_ip << 32|to_ip ] and then search for the IP using BETWEEN [current_ip << 32, with masking of the biggest possible network, e.g. /12] AND [current_ip << 32 | 0xFFFFFFFF ], but we will have a lot of results in return …

Maybe we can use lua script that will only return the last result ?

Will it be fast enough ( we need to perform this search for each http query ) ?

Also , what will happen if the database is spread across several nodes ?

Thanks again !!!

Zac.