Kong

安裝

下载安装 Kong

我的系统是 CentOS 7,kong 的版本选择 1.4.3(因为后续用到的kong-dashboard只支持到1.4.x)。

1
2
3
yum install -y epel-release
wget https://bintray.com/kong/kong-rpm/download_file?file_path=centos/7/kong-1.4.3.el7.amd64.rpm
yum install -y kong-1.4.3.el7.amd64.rpm --nogpgcheck

数据库配置

1
2
3
cd /etc/kong
cp kong.conf.default kong.conf
vi kong.conf
kong.conf
1
2
3
4
5
6
7
8
# 找到并修改 DATASTORE 部分
database = postgres
pg_host = 127.0.0.1
pg_port = 5432
pg_timeout = 5000
pg_user = kong
pg_password = kong
pg_database = kong

安装数据库

使用PostgreSQL作为Kong的数据库,安装步骤见《PostgreSQL 快速安装》

初始化数据库

1
2
3
4
5
6
psql -h 127.0.0.1 -U postgres

# CREATE USER kong WITH PASSWORD 'kong'; CREATE DATABASE kong OWNER kong;
# \q

kong migrations bootstrap [-c /etc/kong/kong.conf]

启动

1
kong start

参考:https://www.jianshu.com/p/a68e45bcadb6