BlueXIII's Blog

热爱技术,持续学习

0%

Kong部署笔记

Postgre安装

官网

https://www.postgresql.org/

rpm方式安装

https://yum.postgresql.org/rpmchart.php
postgresql11-11.4-1PGDG.rhel7.x86_64.rpm
postgresql11-contrib-11.4-1PGDG.rhel7.x86_64.rpm
postgresql11-libs-11.4-1PGDG.rhel7.x86_64.rpm
postgresql11-server-11.4-1PGDG.rhel7.x86_64.rpm

1
rpm -ivh postgresql11*

初始化DB

1
2
3
/usr/pgsql-11/bin/postgresql-11-setup initdb
or
postgresql-setup initdb

启动

1
2
systemctl enable postgresql-11
systemctl start postgresql-11

修改配置

cd /var/lib/pgsql/11/data

vi postgresql.conf

1
listen_addresses = '*'

vi pg_hba.conf

1
host    all all 0.0.0.0/0   md5

添加名为kong的用户

1
2
3
useradd kong;
su - postgres
psql
1
2
CREATE USER kong; CREATE DATABASE kong OWNER kong;
CREATE USER kong WITH PASSWORD '123456';
1
psql -U kong -d kong -h 127.0.0.1 -p 5432 

Kong安装

Kong官网

https://konghq.com/

参考文档

https://docs.konghq.com/install/centos/?_ga=2.146470708.1859714253.1563239338-1792454818.1563239338

RPM方式安装

1
rpm -ivh kong-1.2.1.el7.noarch.rpm

配置

1
2
cp /etc/kong/kong.conf.defaul /etc/kong/kong.conf
vi /etc/kong/kong.conf
1
2
3
4
5
6
7
8
database = postgres              # Determines which of PostgreSQL or Cassandra
pg_host = 127.0.0.1 # The PostgreSQL host to connect to.
pg_port = 5432 # The port to connect to.
pg_user = kong # The username to authenticate if required.
pg_password = 123456 # The password to authenticate if required.
pg_database = kong # The database name to connect to.
pg_ssl = off # Toggles client-server TLS connections
pg_ssl_verify = off # Toggles server certificate verification if

初始化

1
2
kong migrations bootstrap -c /etc/kong/kong.conf
kong start /etc/kong/kong.conf

测试

curl -i http://localhost:8001/

GUI

Kong Admin GUI

https://docs.konghq.com/enterprise/0.31-x/admin-gui/

Konga

https://github.com/pantsel/konga