一、系统环境

[root@kong ~]# service iptables status
iptables: Firewall is not running.
[root@kong ~]# getenforce
Disabled
[root@kong ~]# cat /etc/system-release
CentOS release 6.7 (Final)
[root@kong ~]# uname -a
Linux kong 2.6.-.el6.x86_64 # SMP Thu Jul :: UTC x86_64 x86_64 x86_64 GNU/Linux

二、kong的安装

    根据kong的官网文档进行安装  官网:https://konghq.com/install/

  1、yum源配置

[root@kong ~]# cat /etc/yum.repos.d/bintray-kong-kong-community-edition-rpm.repo
[bintraybintray-kong-kong-community-edition-rpm]
name=bintray-kong-kong-community-edition-rpm
baseurl=https://kong.bintray.com/kong-community-edition-rpm/centos/6
gpgcheck=
repo_gpgcheck=
enabled=

  2、安装kong  默认安装的 kong-0.10.4-1.noarch,官网已经更新到了0.13.x了,也可以手动下载最新版的rpm包安装

[root@kong ~]# yum install -y kong

  如果安装是报如下错误,就在/etc/yum.conf 配置文件 sslverify=false后,重新执行上面命令

https://kong.bintray.com/kong-community-edition-rpm/centos/6/kong-community-edition-0.10.4.el6.noarch.rpm: [Errno 14] Peer cert cannot be verified or peer cert invalid

  3、安装 kong 需要的数据库,默认选择的是postgreSQL,kong支持2种数据库存储(postgreSQL 和 Cassandra

    postgreSQL官网:https://www.postgresql.org/download/

    Cassandra官网:http://cassandra.apache.org/download/

    

    这里我们以postgreSQL为例进行安装

    a、配置yum源

      https://www.postgresql.org/download/linux/redhat/

yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-centos10-10-2.noarch.rpm

yum install postgresql10

yum install postgresql10-server

service postgresql- initdb
chkconfig postgresql- on

    b、修改postgreSQL配置文件

      /var/lib/pgsql/10/data/postgresql.conf

listen_addresses = 'localhost'

替换成如下:

listen_addresses = '*'

      /var/lib/pgsql/10/data/pg_hba.conf

host    all             all             127.0.0.1/            ident

换成如下:

host    all             all             127.0.0.1/            trust

    c、启动postgreSQL

service postgresql- start

    d、创建kong需要的库、授权  并 把相关的数据写入库

[root@base ~]# su - postgres
-bash-4.1$ psql
psql (8.4., server 10.3)
WARNING: psql version 8.4, server version 10.0.
Some psql features might not work.
Type "help" for help. postgres=# CREATE USER kong; CREATE DATABASE kong OWNER kong;
CREATE ROLE
CREATE DATABASE
postgres=# quit
postgres-# \q
-bash-4.1$ exit
logout
[root@base ~]# kong migrations up
...................
response-ratelimiting migrated up to: ---321512_response-rate-limiting_policies
migrating acl for database kong
acl migrated up to: ---841841_init_acl
migrations ran

    e、修改普通用户描述符,至少4096

ulimit -HSn 65535
echo "ulimit -HSn 65535" >> /etc/rc.local

  4、启动 kong

[root@base ~]# kong start
Kong started [root@base ~]# netstat -lntp|grep nginx
tcp 0.0.0.0: 0.0.0.0:* LISTEN /nginx
tcp 0.0.0.0: 0.0.0.0:* LISTEN /nginx
tcp 0.0.0.0: 0.0.0.0:* LISTEN /nginx
tcp 0.0.0.0: 0.0.0.0:* LISTEN /nginx [root@base ~]# curl -i -X GET http://localhost:8001/
HTTP/1.1 OK
Date: Thu, Apr :: GMT
Content-Type: application/json; charset=utf-
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Server: kong/0.10. {"timers":{"running":,"pending":},"configuration":{"admin_error_log":"logs\/error.log","cassandra_lb_policy":"RoundRobin","admin_access_log":"logs\/admin_access.log","ca ..................
..............................

三、Kong UI管理工具

  安装说明:https://github.com/PGBI/kong-dashboard

  1、安装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 -y install nodejs

  2、使用 npm 安装 kong-dashboard

npm install -g kong-dashboard
nohup kong-dashboard start --kong-url http://192.168.1.128:8001 & 也可以基于basic 认证,在登录是要求输入密码 nohup kong-dashboard start --kong-url http://192.168.1.128:8001 --basic-auth admin=123456 &

  3、访问 kong-dashboard   http://192.168.1.128:8080 (输入刚刚配置的账号密码)

四、Kong 桌面管理工具

  Kong 桌面管理工具:https://github.com/ajaysreedhar/kongdash 有linux版本,windows版本,mac版本。

  下载地址:https://github.com/ajaysreedhar/kongdash/releases/download/v0.3.0/kongdash-0.3.0-ia32.exe

  访问地址:http://192.168.1.128:8001/

API gateway 之 kong 安装 (二)的更多相关文章

  1. API gateway 之 kong 安装

    kong安装: https://getkong.org/install/centos/ 下载指定版本rpm: wget https://bintray.com/kong/kong-community- ...

  2. API gateway 之 kong 基本操作 (三)

    一.演示环境准备 1.nginx配置 [root@nginx conf.d]# pwd /etc/nginx/conf.d [root@nginx conf.d]# ls conf_bak kong_ ...

  3. API gateway 之 kong 基本介绍 (一)

    一.API网关概念介绍 API 网关,即API Gateway,是大型分布式系统中,为了保护内部服务而设计的一道屏障,可以提供高性能.高可用的 API托管服务,从而帮助服务的开发者便捷地对外提供服务, ...

  4. API Gateway - KONG 安装与配置

    简介 Kong,是由Mashape公司开源的,基于Nginx的API gateway 特点 可扩展,支持分布式 模块化 功能:授权.日志.ip限制.限流.api 统计分析(存在商业插件Galileo等 ...

  5. Docker安装Kong API Gateway并使用

    我最新最全的文章都在南瓜慢说 www.pkslow.com,文章更新也只在官网,欢迎大家来喝茶~~ 1 简介 Kong不是一个简单的产品,本文讲的Kong主要指的是Kong API Gateway,即 ...

  6. kong API gateway

    参考:https://www.cnblogs.com/chenjinxi/p/8724564.html 一.简介 Kong,是由Mashape公司开源的,基于Nginx的API gateway. 二. ...

  7. 关于kong | API Gateway

    目录 为什么需要 API 网关(more) kong的概念 为什么使用Kong Kong 的管理方式 高可扩展性的背后-插件机制 [前言]: Kong是一个云原生,高效,可扩展的分布式 API 网关. ...

  8. 微服务实战(二):使用API Gateway

    微服务实战(一):微服务架构的优势与不足 微服务实战(二):使用API Gateway 微服务实战(三):深入微服务架构的进程间通信 微服务实战(四):服务发现的可行方案以及实践案例 微服务实践(五) ...

  9. API Gateway : Kong

    what problems 多个服务要写自己的log,auth,对于比较耗时的,有时还要高流量限制. solution intro 单点部署的情况: why not just haproxy log ...

随机推荐

  1. MapReduce与Yarn 的详细工作流程分析

    MapReduce详细工作流程之Map阶段 如上图所示 首先有一个200M的待处理文件 切片:在客户端提交之前,根据参数配置,进行任务规划,将文件按128M每块进行切片 提交:提交可以提交到本地工作环 ...

  2. JSON说明

    1. JSON 数据的书写格式 对象:是一个无序的“‘名称/值’对”集合.一个对象以“{”(左括号)开始,“}”(右括号)结束.每个“名称”后跟一个“:”(冒号):“‘名称/值’ 对”之间使用“,”( ...

  3. vs2019下载和更新速度非常慢的解决方案

    纵观全网,就两种解决方案 1.取消网络适配器里面的IPV6的给勾选[我试过,无效,但是有些网友说是有效果,也不知道是咋回事] 2.修改host.[本人亲测有效果,速度从5kb到5M左右,但是无法跑满宽 ...

  4. redis主从配置 从而实现数据备份和读写分离

    首先打开cmd,用cd找到你的redis文件夹,我的操作是 在你的第一个redis客户端文件夹配置文件中,搜索port,找到如下位置 端口号设置为6379(默认的.后面一个,两个或者多个客户端分别修改 ...

  5. Linux 命令个人笔记

    [表示命令]man -f [] 显示一个命令的功能whatis [] 显示一个命令的功能ls -lR | grep '^-' | wc -l 统计一个目录下总共有多少个文件head [-n numbe ...

  6. Linux下格式化恢复USB启动优盘

    问题描述:优盘制作成启动盘安装操作系统,但是后边使用时发现无法格式化,提示 This partition cannot be modified because it contains a partit ...

  7. @DateTimeFormat注解

    @DateTimeFormat在spring-context依赖下,所在包如下 当form表单中出现时间字段需要跟pojo对象中的成员变量进行数据绑定时,springmvc框架中的时间数据无法自动绑定 ...

  8. C--二分搜索

    //二分搜索 //时间复杂度小 log2 n int search(int key, int a[], int len) { ; ; ; int mid; while(left<right) { ...

  9. 二、docker 镜像容器常用操作(让我们用docker 溜得飞起)

    前言 上篇讲了我们如何安装docker,现在该我们一展拳脚的时候了.接下来让我们一起学习一下docker常见的操作,让我们能够会使用 docker. 基本概念 在讲使用之前,还是先将一下docker ...

  10. [NOIp2010] luogu P1541 乌龟棋

    英语老师讲 mind map,真想说一句"声微饭否".为什么wyy的歌词总是快一点点.在报csp. 题目描述 你在一个序列上向正方向行走,起点是 a[0]a[0]a[0].每一步可 ...