旧バージョンのドキュメントを参照しています。 最新のドキュメントはこちらをご参照ください。
Kong設定ファイル
Kong Gatewayにはデフォルトの構成ファイル、kong.confが付属します。公式パッケージを使用してKong Gatewayをインストールした場合、このファイルは/etc/kong/kong.conf.defaultにあります。
Kong Gateway構成ファイルは、Kongインスタンスの個々のプロパティを構成するために使用できるYAMLファイルです。このガイドでは、 kong.confファイルを使用してKong Gatewayを構成する方法について説明します。
kong.confで使用可能なすべてのパラメータについては、構成パラメータリファレンスを参照してください。
Kong Gatewayの構成
Kong Gateway を構成するには、デフォルトの構成ファイルのコピーを作成します。
cp /etc/kong/kong.conf.default /etc/kong/kong.conf
このファイルには、構成プロパティとドキュメントが含まれています。
#upstream_keepalive_pool_size = 60 # Sets the default size of the upstream
# keepalive connection pools.
# Upstream keepalive connection pools
# are segmented by the `dst ip/dst
# port/SNI` attributes of a connection.
# A value of `0` will disable upstream
# keepalive connections by default, forcing
# each upstream request to open a new
# connection.
プロパティを構成するには、コメントを解除して値を変更します。
upstream_keepalive_pool_size = 40
ブール値は、on/offまたはtrue/falseとして指定できます。
#dns_no_sync = off # If enabled, then upon a cache-miss every
# request will trigger its own dns query.
# When disabled multiple requests for the
# same name/type will be synchronised to a
# single query.
Kong Gatewayは、
kong.conf内のコメントアウトされた値に対してデフォルト設定を使用します。
構成を確認
構成が使用可能であることを確認するには、 checkコマンドを使用します。checkコマンドは、現在設定されている環境変数を評価し、
設定が無効な場合はエラーを出力します。
kong check /etc/kong/kong.conf
設定が有効な場合、シェルは次のように出力します。
configuration at /etc/kong/kong.conf is valid
カスタムパスの設定
デフォルトでは、Kong Gatewayは2つのデフォルトロケーションでkong.confを検索します。
/etc/kong/kong.conf
/etc/kong.conf
この動作は、自分のカスタムパスを指定することで無効にできます。CLIで -c / --conf 引数を使用する設定ファイル:
kong start --conf /path/to/kong.conf
デバッグモード
Kong Gateway CLIをデバッグモードで使用して、シェルに設定プロパティを出力できます。
kong start -c /etc/kong.conf --vv
2016/08/11 14:53:36 [verbose] no config file found at /etc/kong.conf
2016/08/11 14:53:36 [verbose] no config file found at /etc/kong/kong.conf
2016/08/11 14:53:36 [debug] admin_listen = "0.0.0.0:8001"
2016/08/11 14:53:36 [debug] database = "postgres"
2016/08/11 14:53:36 [debug] log_level = "notice"
[...]