Table of Contents

Installation

Kong can be installed by downloading an installation package or from our yum repository

Setup

Prepare your database or declarative configuration file

Kong can run either with or without a database.

When using a database, you will use the kong.conf configuration file for setting Kong’s configuration properties at start-up and the database as storage of all configured entities, such as the Routes and Services to which Kong proxies.

When not using a database, you will use kong.conf its configuration properties and a kong.yml file for specifying the entities as a declarative configuration.

Using a database

Configure Kong so it can connect to your database. Kong supports both PostgreSQL 9.5+ and Cassandra 3.x.x as its datastore.

If you are using Postgres, please provision a database and a user before starting Kong, ie:

CREATE USER kong; CREATE DATABASE kong OWNER kong;

Now, run the Kong migrations:

$ kong migrations bootstrap [-c /path/to/kong.conf]

Without a database

If you are going to run Kong in DB-less mode, you should start by generating declarative config file. The following command will generate a kong.yml file in your current folder. It contains instructions about how to fill it up.

$ kong config init

After filling up the kong.yml file, edit your kong.conf file. Set the database option to off and the declarative_config option to the path of your kong.yml file:

database = off
declarative_config = /path/to/kong.yml

Run Kong

Start Kong

Note: When you start Kong, the NGINX master process runs as root and the worker processes as kong by default. If this is not the desired behavior, you can switch the NGINX master process to run on the built-in kong user or to a custom non-root user before starting Kong. For more information, see Running Kong as a Non-Root User.
$ kong start [-c /path/to/kong.conf]

Use Kong

Check that Kong is running:

$ curl -i http://localhost:8001/

Quickly learn how to use Kong with the 5-minute Quickstart.


Having Trouble? We're here to help!