Knot-Resolver Administration

Instances

The kresd instances can be generated on the fly with the help of the template unit file under systemd. Simultaneously with the creation of the service a control-socket is created.

For example: systemctl start kresd@foo.service

When the instances should be persistent these commands can be used:

systemctl enable --now kresd@1.service
systemctl enable --now kresd-control@1.socket

To manage all kresd instances a slice can be used. When changing something in the configuration file a restart of the slice is the recommended way to apply the changes. Furthermore when stopping the slice serivce all instances are going down (Not the same behaviour as restart). When the slice is taken down no instance comes up automatically even if a query comes in.

systemctl status system-kresd.slice
systemctl stop system-kresd.slice
systemctl start system-kresd.slice

Start all kresd instances at the same time.

systemctl --all start kresd@*.service

Start all kresd instances explicitly.

systemctl start kresd@{1,2,3,4}.service

A stopped kresd instance assumed that the slice is still running comes up automatically when a query comes in since it is a socket activated service.

Debugging

For debugging two methods are possible:
  • With restart
  • without restart

With restart

To enable verbosity add this line in the configuration file and restart (reload is not possible) the kresd slice:

verbose(true)

Without restart

To enable verbosity on a running kresd instances a connection to a control socket is necessary. This command have to be executed on every control socket because it is not clear which one is responding a query.

socat - UNIX-CONNECT:/run/knot-resolver/control@${socket}
$ verbose true

Clear cache

To clear the cache do the following. It is enough to do it only on one control socket because the cache is shared among them.

socat - UNIX-CONNECT:/run/knot-resolver/control@${socket}
$ cache.clear()