kong 网关安装
下载RPM包
https://docs.konghq.com/install/centos/?_ga=2.23907002.1080019063.1562941741-764980739.1562941741
放到/home/download
cd /home/download
安装
yum install kong-1.2.1.el7.noarch.rpm --nogpgcheck
在PostgreSQL建立database kong
su postgres
createdb kong
创建用户
create user kong with password 'abc123..'
用户权限
Alter database kong owner to kong
//把新建的数据库权限赋予kong
Grant all privileges on database kong to kong;
初始化
kong config init
更改配置文件的配置
/etc/kong/kong.conf
database = postgres # Determines which of PostgreSQL or Cassandra
# this node will use as its datastore.
# Accepted values are `postgres`,
# `cassandra`, and `off`.
pg_host = 127.0.0.1 # Host of the Postgres server.
pg_port = 5432 # Port of the Postgres server.
pg_timeout = 5000 # Defines the timeout (in ms), for connecting,
# reading and writing.
pg_user = kong # Postgres user.
pg_password = abc123.. # Postgres user's password.
pg_database = kong # The database name to connect to.
#pg_schema = # The database schema to use. If unspecified,
# Kong will respect the `search_path` value of
# your PostgreSQL instance.
pg_ssl = off # Toggles client-server TLS connections
初始化数据库
/usr/local/bin/kong migrations bootstrap
启动空
/usr/local/bin/kong start
添加自启动服务
vi /usr/lib/systemd/system/kong.service
内容
[Unit]
Description=kong gateway service
After=kong.service
[Service]
Type=forking
ExecStart=/usr/local/bin/kong start
ExecReload=/usr/local/bin/kong restart
ExecStop=/usr/local/bin/kong stop
[Install]
WantedBy=multi-user.target
保存
执行
chmod 754 /usr/lib/systemd/system/kong.service
systemctl daemon-reload
systemctl start kong.service
systemctl enable kong.service