API gateway 之 kong0.12.3 安装

kong安装:
https://getkong.org/install/centos/
下载指定版本rpm:
wget https://bintray.com/kong/kong-community-edition-rpm/download_file?file_path=centos/7/kong-community-edition-0.12.3.el7.noarch.rpm
yum install epel-release
yum install xxx.rpm

kong数据库安装:
kong支持2种数据库存储(postgreSQL 和 Cassandra )
postgreSQL官网:https://www.postgresql.org/download/
Cassandra官网:http://cassandra.apache.org/download/
安装postgreSQL:
yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm
yum install postgresql94
yum install postgresql94-server
/usr/pgsql-9.4/bin/postgresql94-setup initdb
修改postgreSQL配置文件:
vim /var/lib/pgsql/9.4/data/postgresql.conf
修改为:listen_addresses = '*'
vim /var/lib/pgsql/9.4/data/pg_hba.conf
修改为:host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 trust
启动postgreSQL:
systemctl enable postgresql-9.4
systemctl start postgresql-9.4
创建kong需要的库、授权 并 把相关的数据写入库:
#su - postgres
-bash-4.2$ psql
postgres=# CREATE USER kong; CREATE DATABASE kong OWNER kong;
postgres=# \q
-bash-4.2$ exit

kong migrations up

启动kong:

cp /etc/kong/kong.conf.default /etc/kong/kong.conf

修改 kong.conf
#proxy_listen = 127.0.0.1:8000 改为 proxy_listen = 0.0.0.0:80
#admin_listen = 127.0.0.1:8001 改为 admin_listen = 0.0.0.0:8001
database = postgres # Determines which of PostgreSQL or Cassandra

this node will use as its datastore.

                             # Accepted values are `postgres` and
                             # `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 = kong # The password to authenticate if required.
pg_database = kong

kong start

curl -i -X GET http://localhost:8001/

HTTP/1.1 200 OK
Date: Thu, 10 May 2018 07:43:18 GMT
....
安装kong-dashboard:
安装说明:https://github.com/PGBI/kong-dashboard
安装kong管理工具的环境依赖 nodejs 及 npm
nodejs 及 npm安装教程:https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora

curl --silent --location https://rpm.nodesource.com/setup_9.x | sudo bash -
yum install -y nodejs
npm install -g kong-dashboard
nohup kong-dashboard start --kong-url http://0.0.0.0:8001 &

也可以基于basic 认证,在登录是要求输入密码
nohup kong-dashboard start --kong-url http://0.0.0.0:8001 --basic-auth admin=123456 &
API gateway 之 kong0.12.3 安装

参考
https://hacpai.com/article/1525765478649

转载于:https://blog.51cto.com/10158955/2177052

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值