您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“Kong網(wǎng)關(guān)的安裝與配置方法”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“Kong網(wǎng)關(guān)的安裝與配置方法”吧!
Kong,是由Mashape公司開(kāi)源的,基于Nginx的API gateway
特點(diǎn)
可擴(kuò)展,支持分布式
模塊化 功能:授權(quán)、日志、ip限制、限流、api 統(tǒng)計(jì)分析(存在商業(yè)插件Galileo等、也可自己研發(fā))、請(qǐng)求轉(zhuǎn)化、跨域(CORS)、其他功能通過(guò)lua編寫插件實(shí)現(xiàn)
安裝
全程使用的全部都是默認(rèn)配置
安裝包下載和官網(wǎng)示列:https://getkong.org/install/centos/
安裝前先安裝PostgreSQL
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm yum install postgresql96-server postgresql96-contrib
初始化數(shù)據(jù)庫(kù)
/usr/pgsql-9.6/bin/postgresql96-setup initdb
修改配置
vi /var/lib/pgsql/9.6/data/pg_hba.conf
啟動(dòng)并創(chuàng)建kong數(shù)據(jù)庫(kù)和用戶權(quán)限
systemctl start postgresql-9.6 sudo -i -u postgres psql CREATE USER kong; CREATE DATABASE kong OWNER kong;
安裝啟動(dòng)Kong
$ sudo yum install epel-release $ sudo yum install https://kong.bintray.com/kong-community-edition-rpm/centos/7/kong-community-edition-1.0.0.el7.noarch.rpm --nogpgcheck $ cp /etc/kong/kong.conf.default /etc/kong/kong.conf $ kong migrations bootstrap [-c /etc/kong/kong.conf] $ kong start [-c /etc/kong/kong.conf] $ curl http://127.0.0.1:8001
安裝kong dashboard 提供界面化操作支持
git clone https://github.com/PGBI/kong-dashboard.git
cd kong-dashboard sudo npm install --unsafe-perm --registry=https://registry.npm.taobao.org npm install -g kong-dashboard kong-dashboard start --kong-url http://127.0.0.1:8001
訪問(wèn)kong dashboard UI:http://192.168.20.54:8080
配置需要代理的API
把代理用路由轉(zhuǎn)出去
訪問(wèn)得到:http://192.168.20.54:8000/apis/user/user/zhangsan
到此,相信大家對(duì)“Kong網(wǎng)關(guān)的安裝與配置方法”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。