kong 网关安装

Posted lidezhen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

 

以上是关于kong 网关安装的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu安装kong网关2..0.4

开源API网关Kong基本介绍和安装验证

Kong网关介绍与安装小记

微服务之API网关:Kong:概要与安装

kong 网关安装

2.Kong入门与实战 基于Nginx和OpenResty的云原生微服务网关 --- Kong 的安装和基本概念