What is this?
Backup tool for PowerDNS database (MySQL) to local or S3 storage in bind format. Open metrics are also computed on your feched zones.
PyPI
Deploy the pdnsbackup tool in your server with the pip command.
pip install pdnsbackup
Usage
After installation, you can execute the pdnsbackup to start-it.
$ pdnsbackup -h
usage: -c [-h] [-c C] [-e E] [-v]
options:
-h, --help show this help message and exit
-c C external config file
-e E env config file
-v debug mode
Configuration
This tool can be configurated with severals ways. See the default config file:
-
from external configuration file (
-c configargument) -
from environment variables (
-e env fileargument)
| Variables | Description |
|---|---|
| PDNSBACKUP_DEBUG | debug mode 1 or 0 |
| PDNSBACKUP_GMYSQL_ENABLED | set to 1 to enable gmysql backend, enabled by default |
| PDNSBACKUP_GMYSQL_HOST | mysql port, default is 127.0.0.1 |
| PDNSBACKUP_GMYSQL_PORT | mysql port, default is 3306 |
| PDNSBACKUP_GMYSQL_SSL | enable ssl, default is 0 |
| PDNSBACKUP_GMYSQL_DBNAME | mysql database name |
| PDNSBACKUP_GMYSQL_USER | mysql user |
| PDNSBACKUP_GMYSQL_PASSWORD | mysql password |
| PDNSBACKUP_FILE_ENABLED | set to 1 enable backup to file, enabled by default |
| PDNSBACKUP_FILE_PATH_BIND | zone bind path in named.conf |
| PDNSBACKUP_FILE_PATH_OUTPUT | output folder of the export |
| PDNSBACKUP_S3_ENABLED | set to 1 enable backup to S3 storage, disabled by default |
| PDNSBACKUP_S3_ENDPOINT_URL | your s3 url |
| PDNSBACKUP_S3_SSL_VERIFY | disable ssl verify |
| PDNSBACKUP_S3_ACCESS_KEY_ID | your access key |
| PDNSBACKUP_S3_SECRET_ACCESS_KEY | your secret access key |
| PDNSBACKUP_S3_BUCKET_NAME | bucket name |
| PDNSBACKUP_S3_BACKUP_FILE | backup file name |
| PDNSBACKUP_S3_BACKUP_DELETE_OLDER | delete backups older than xx days |
| PDNSBACKUP_METRICS_ENABLED | export open metrics |
| PDNSBACKUP_METRICS_PROM_FILE | write metrics to file path |
Metrics
This tool can be used to compute statistics on your DNS records.
| Variables | Description |
|---|---|
| pdnsbackup_status | Status of the backup process |
| pdnsbackup_zones_total | Total number of zones |
| pdnsbackup_zones_empty_total | Total number of empty zones |
| pdnsbackup_records_total | Total number of records per DNS zones |
| pdnsbackup_wildcards_total | Total number of DNS wilcards |
| pdnsbackup_delegations_total | Total number of DNS delegations |
| pdnsbackup_rrtypes_total | Total number of records per type (A, AAAA, CNAME, ...) |
Docker run
sudo docker run --rm --env-file ./.env --name=pdnsbackup dmachard/pdnsbackup:latest
Run from source
Create a .env file to populate your variable
Create a virtualenv
python -m venv venv
source venv/bin/activate
Install requirements and run-it
python3 -m pip install -r requirements.txt
python3 -c "import pdnsbackup; pdnsbackup.run();"
python3 -c "import pdnsbackup; pdnsbackup.run();" -c tests/config.yml
python3 -c "import pdnsbackup; pdnsbackup.run();" -e tests/.env
Build and run from docker image
sudo docker build . --file Dockerfile -t pdnsbackup
Run tests
Run all tests
python -m unittest discover -v tests/
Run one by one
python -m unittest -v tests.test_config
python -m unittest -v tests.test_parser
python -m unittest -v tests.test_import
python -m unittest -v tests.test_export_file
python -m unittest -v tests.test_export_metrics
Metadata
Release files for pdnsbackup 1.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pdnsbackup-1.0.12.tar.gz | 13.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pdnsbackup-1.0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / pdnsbackup-1.0.12.tar.gz
| Download URL | pdnsbackup-1.0.12.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ddcb942272d8e68a1dd96d8bc33c6ea100b1753d1bb044c27eef243164f73ff4
|
|
BLAKE2b-256 checksum How to use checksums |
b79f17f1d62a70b7354bd89cc9bd7a2661396d526dedda6a1d99246be07a8e2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / pdnsbackup-1.0.12-py3-none-any.whl
| Download URL | pdnsbackup-1.0.12-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ddd80caf1f56b74c858069de8aa26e2fad7475aa43a374de44ff1b2895e2d30a
|
|
BLAKE2b-256 checksum How to use checksums |
ebb1e68bd8189cb38030bbb6ccc98e54ec9e7e6876f63bdc5084babac78e09e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency log