A drop-in caching API for PeeringDB.
Various network automation tools rely on PeeringDB for network information. peeringdb-cache
creates a local mirror of PeeringDB and exposes a drop-in replacement query API, decreasing latency to PeeringDB resources and avoiding PeeringDB rate limits.
The cache supports the org
, fac
, net
, ix
, campus
, carrier
, carrierfac
, ixfac
, ixlan
, ixpfx
, netfac
, netixlan
, and poc
resource types.
See below to get started with Docker or docker-compose. The cache may take up to 15 minutes to sync with PeeringDB when it's first started up. You can preload it with a peeringdb.sqlite3
file in the data directory from another system that already has the database to speed up the initial sync. Subsequent syncs only update the database with changes so will be much faster.
To get network contact information, set the PEERINGDB_API_KEY
variable to your PeeringDB API key.
Once your cache is running, you can point your tools to the cache instead of PeeringDB. It should be as easy as replacing the URL from https://www.peeringdb.com/api
to http://your-peeringdb-cache:8080/api
.
The cache will automatically sync with PeeringDB approximately every 6 hours. You can also manually sync the cache by making a GET
request to /sync
.
A Prometheus metrics endpoint is available at /metrics
.
docker run \
-d \
--name peeringdb-cache \
-v ./peeringdb-cache:/data \
-p 8080:8080 \
-e PEERINGDB_API_KEY=your-peeringdb-api-key \
ghcr.io/natesales/peeringdb-cache:latest