Centos6.5 install kong gateway

Recently, I asked to know about the Kong gateway, and then I searched for it on the Internet. To be honest, the power of Du Niang is still not enough. The ones I found followed the configuration, either this is wrong, or there is a problem. Then there is no way, use Google over the wall. Google found two articles, using cassandra 2.2.x+ and PostgreSQL 9.4+, but using Cassandra 2.2.x version needs to configure Python and Java, so I don't use this database, but I will give you the URL, For use http://blog.54im.com/2016/12/15/centos-install-kong-cassandra/

The introduction is very detailed.

Let me share with you a method of using a postGreSQL database.

If it is a new virtual machine; it is recommended that you

Yum install wget

Yum install gcc

Yum install gcc-c++ install all required software first with yum

Then proceed to our installation below


It should be noted that the kong and postgreSQL databases must be installed in the /usr/local directory, otherwise the kong folder cannot be found in the etc directory and cannot be modified

install #

wget  https://github.com/Mashape/kong/releases/download/0.9.3/kong-0.9.3.el6.noarch.rpm

yum install epel-release

yum install kong-0.9.3.el6.noarch.rpm

So far kong has been installed.

Kong needs to cooperate with the database to implement a series of functions. Currently, kong supports PostgreSQL 9.4+ and Cassandra 2.2.x.

Install database service (PostgreSQL 9.4+) #

yum install http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-2.noarch.rpm

yum install postgresql95-server postgresql95-contrib

service postgresql-9.5 initdb

chkconfig postgresql-9.5 on 

service postgresql-9.5 start

//安装客户端,使用psql登入(类mysql)
yum install  postgresql

Log in to Postgre, and create the database and user required by kong #

file

After installation, you need to provide a password for the kong user

su again - postgres

$psql

.change Password

 alter user username with password 'password';

 After the modification, you can enter the root user in su -, here, you can configure kong

Then configure it in the configuration file

configure kong

The configuration of kong is relatively simple, I just simply configured the database here.

south you /etc/kong/kong.yml

Modify database configuration

######## Specify which database to use. Only "cassandra" and "postgres" are currently available.

database: postgres

######## PostgreSQL configuration

postgres:

  host: "127.0.0.1"

  port: 5434

 

  ######

  ## Name of the database used by Kong. Will be created if it does not exist.

  database: kong_db

 

  #####

  ## User authentication settings

  user: "kong_user"

  password: "kong_pass"

 


When starting kong , it will appear

 [postgres error]  Fatal error : User "kong" Ident authentication failed " === such an error, the solution is in the following blog

http://blog.csdn.net/sanbingyutuoniao123/article/details/52209653

  It should be noted that you must find the pg_hba.conf file in your own path , not necessarily the path written in this blog. Then after the modification, you can restart the virtual machine and open kong     

kong start


Because nginx is used, Nginx needs to be configured again.

Centos6.5 install Nginx

After opening, you can refer to the official website's official website configuration API to debug 


Reprinted from: https://blog.csdn.net/qq_35357001/article/details/75015484

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324908794&siteId=291194637