MARWAN docs NOC knowledge base
DocsDNS

Clear DNS cache from knot-resolver

Flush the Knot Resolver (kresd) cache on demand through its control socket with socat.

Updated Sami Ait Ali Oulahcen

You can flush the Knot Resolver (kresd) cache on demand using socat to communicate with the running daemon:
socat - /run/knot-resolver/control/*

Inside the prompt type cache.clear()

> cache.clear()

You should get something like:

{
    ['count'] = 314182,
}
>

Type ctrl + C to exit.




If you run multiple kresd daemons. You might run into this error: socat[990255] E exactly 2 addresses required (there are 18); use option "-h" for help
In this case, You can clear the cache on one instance, and it will clear for all the instances because they all share the same cache database (LMDB).