[Unbound][redis][自分用メモ] Unboundでbackendにredisを利用できることを今さらながら知った

AIX、UNIX、Linux
Unbound logo

DNSのキャッシュサーバとして有名なUnboundですが(最近はコンテンツサーバ的な機能を実装しているみたいですが)、今さらながらバックエンドにredisなどを指定できるようになっていたこと知りました・・・

Changelogを確認する限り、1.7.1からみたいですね。

Unbound - Download

Add --with-libhiredis, unbound support for a new cachedb backend that uses a Redis server as the storage. This implementation depends on the hiredis client library (https://redislabs.com/lp/hiredis/). And unbound should be built with both --enable-cachedb and --with-libhiredis[=PATH] (where $PATH/include/hiredis/hiredis.h should exist). Patch from Jinmei Tatuya (Infoblox).

Unbound - unbound.conf.5
UNBOUND.CONF(5) Unbound UNBOUND.CONF(5) NAME unbound.conf - Unbound 1.24.0 configuration file. SYNOPSIS unbound.conf DES...

バックエンドのredisを使用する場合は、以下のパラメータを設定するだけのようです。

server:
  <snip>
  module-config: "subnetcache validator cachedb iterator"
<snip>
cachedb:
  backend: "redis"
  redis-server-host: 192.168.1.2
  redis-server-port: 6379
  redis-timeout: 100

パッケージをbuildする際は--enable-cachedb --with-libhiredisを付けてbuildすることが必要です(現在配布されているパッケージでデフォルトでこのフラグがONになっているかは未確認です)。

フロントエンドはdockerなどでscaleするようにして、バックエンドにredisを使用するようにしてやれば、ある程度性能を確保できそうな気がします(quad9とかCloudflare DNSとかもフロントエンドにknot-resolverで、バックエンドに何らかのDBの構成のようですが)。

タイトルとURLをコピーしました