This article is a mirror article of machine translation, please click here to jump to the original article.

View: 13786|Reply: 2

Deploy Kong API Gateway on CentOS 7

[Copy link]
Posted on 11/21/2018 1:33:04 PM | | | |
Kong is an extensible open-source API layer (also known as API gateway or API middleware). Kong runs on top of any RESTful API and extends with plugins, they offer additional features and services beyond the core platform.

Kong was originally built at Mashape to provide over 15,000 APIs and microservices for its API Marketplace and generate billions of requests per month for more than 200,000 developers. Today, Kong is used in mission-critical deployments for both small and large organizations

The latest version is: 0.14.1



Official Website:The hyperlink login is visible.

GitHub:The hyperlink login is visible.

kong plugin introduction address:The hyperlink login is visible.

kong related document address:The hyperlink login is visible.

kong hasCommunity and Enterprise editions, the difference between the two:The hyperlink login is visible.
Kong supports PostgreSQL 9.5+ and Cassandra 3.xx as its data store.

I have PostgreSQL installed, and the tutorial is as follows:

CentOS 7 Docker deploys PostgreSQL 9.6
https://www.itsvse.com/thread-5683-1-1.html
(Source: Architect_Programmer)


This article uses kong community edition as an example to install and deploy

Download Package:

Installation:



Check the version
or

Create a profile:

If your configuration is in All values are commented out, Kong will run with the default settings. At startup, Kong looks for several default locations that may contain the configuration file:

/etc/kong/kong.conf
/etc/kong.conf
The kong template directory is located under /usr/local/share/lua/5.1/kong/templates, and contains the following three files
kong_defaults.lua
nginx.lua
nginx_kong.lua
Modify the /etc/kong/kong.conf configuration file, cancel the comments, and modify it according to your actual situation

Initialize the database



initiate





When initializing the database and starting kong, you can specify the configuration file with the [-c /path/to/kong.conf] parameter.

After Kong starts, one is 8000, the other is 8001, and the 80000 port is the request entry port, and the user sends the request to the 8000 port of the Kong project first, and the kong forwards it to the real background service address according to the configured rules. The 8001 port is the management port, and a series of configurations such as plug-in settings, API additions, deletions, modifications, and load balancing are managed through the 8001 port.

Browser access IP: 8000, returns the following:

{"message":"no route and no API found with those values"}


kong admin management interface (If the external network is inaccessible, you can modify the binding configuration to allow public network access



{"plugins":{"enabled_in_cluster":[],"available_on_server":{"response-transformer":true,"oauth2":true,"acl":true,"correlation-id":true,"pre-function":true,"jwt":true," cors":true,"ip-restriction":true,"basic-auth":true,"key-auth":true,"rate-limiting":true,"request-transformer":true,"http-log":true,"file-log":true,"hmac-auth":true," ldap-auth":true,"datadog":true,"tcp-log":true,"zipkin":true,"post-function":true,"request-size-limiting":true,"bot-detection":true,"syslog":true,"loggly":true," azure-functions":true,"udp-log":true,"response-ratelimiting":true,"aws-lambda":true,"statsd":true,"prometheus":true,"request-termination":true}},"tagline":"Welcome to kong","configuration":{"plugins":["bundled"],"admin_ssl_enabled":true,"lua_ssl_verify_depth":1,"trusted_ips":{},"prefix":"\/usr\/local\/kong","loaded_plugins":{" response-transformer":true,"request-termination":true,"prometheus":true,"ip-restriction":true,"pre-function":true,"jwt":true,"cors":true,"statsd":true,"basic-auth": true,"key-auth":true,"ldap-auth":true,"aws-lambda":true,"http-log":true,"response-ratelimiting":true,"hmac-auth":true,"request-size-limiting":true,"datadog":true," tcp-log":true,"zipkin":true,"post-function":true,"bot-detection":true,"acl":true,"loggly":true,"syslog":true,"azure-functions":true,"udp-log":true,"file-log":true," request-transformer":true,"correlation-id":true,"rate-limiting":true,"oauth2":true},"cassandra_username":"kong","admin_ssl_cert_csr_default":"\/usr\/local\/kong\/ssl\/ admin-kong-default.csr","ssl_cert_key":"\/usr\/local\/kong\/ssl\/kong-default.key","admin_ssl_cert_key":"\/usr\/local\/kong\/ssl\/admin-kong-default.key","dns_ resolver":{},"pg_user":"kong","mem_cache_size":"128m","cassandra_data_centers":["dc1:2","dc2:3"],"nginx_admin_directives":{},"custom_plugins":{},"pg_host":"127.0.0.1" ,"nginx_acc_logs":"\/usr\/local\/kong\/logs\/access.log","proxy_listen":["0.0.0.0:8000","0.0.0.0:8443 ssl"],"client_ssl_cert_default":"\/usr\/local\/kong\/ssl\/ kong-default.crt","ssl_cert_key_default":"\/usr\/local\/kong\/ssl\/kong-default.key","dns_no_sync":false,"db_update_propagation":0,"nginx_err_logs":"\/usr\/local\/ kong\/logs\/error.log","cassandra_port":9042,"dns_order":["LAST","SRV","A","CNAME"],"dns_error_ttl":1,"headers":["server_tokens","latency_tokens"],"dns_stale_ttl":4," nginx_optimizations":true,"database":"postgres","pg_database":"kong","nginx_worker_processes":"auto","lua_package_cpath":"","admin_acc_logs":"\/usr\/local\/kong\/logs\/ admin_access.log","lua_package_path":".\/?. lua;.\/?\/init.lua; ","nginx_pid":"\/usr\/local\/kong\/pids\/nginx.pid","upstream_keepalive":60,"cassandra_contact_points":["127.0.0.1"],"admin_access_log":"logs\/admin_access.log"," client_ssl_cert_csr_default":"\/usr\/local\/kong\/ssl\/kong-default.csr","proxy_listeners":[{"ssl":false,"ip":"0.0.0.0","proxy_protocol":false,"port":8000,"http2": false,"listener":"0.0.0.0:8000"},{"ssl":true,"ip":"0.0.0.0","proxy_protocol":false,"port":8443,"http2":false,"listener":"0.0.0.0:8443 ssl"}],"proxy_ssl_enabled":true," pg_password":"******","cassandra_ssl":false,"enabled_headers":{"latency_tokens":true,"X-Kong-Proxy-Latency":true,"Via":true,"server_tokens":true,"Server":true," X-Kong-Upstream-Latency":true,"X-Kong-Upstream-Status":false},"ssl_cert_csr_default":"\/usr\/local\/kong\/ssl\/kong-default.csr","client_ssl":false,"db_resurrect_ttl" :30,"error_default_type":"text\/plain","cassandra_consistency":"ONE","client_max_body_size":"0","admin_error_log":"logs\/error.log","pg_ssl_verify":false,"dns_not_ found_ttl":30,"pg_ssl":false,"db_update_frequency":5,"ssl_ciphers":"ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305: ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256: ECDHE-RSA-AES128-SHA256","cassandra_repl_strategy":"SimpleStrategy","cassandra_repl_factor":1,"log_level":"notice","admin_ssl_cert":"\/usr\/local\/kong\/ssl\/ admin-kong-default.crt","real_ip_header":"X-Real-IP","kong_env":"\/usr\/local\/kong\/.kong_env","cassandra_schema_consensus_timeout":10000,"dns_hostsfile":"\/etc\/ hosts","admin_listeners":[{"ssl":false,"ip":"127.0.0.1","proxy_protocol":false,"port":8001,"http2":false,"listener":"127.0.0.1:8001"},{"ssl":true,"ip":"127.0.0.1"," proxy_protocol":false,"port":8444,"http2":false,"listener":"127.0.0.1:8444 ssl"}],"cassandra_timeout":5000,"ssl_cert":"\/usr\/local\/kong\/ssl\/kong-default.crt"," proxy_access_log":"logs\/access.log","admin_ssl_cert_key_default":"\/usr\/local\/kong\/ssl\/admin-kong-default.key","cassandra_ssl_verify":false,"ssl_cipher_suite":" modern","cassandra_lb_policy":"RoundRobin","real_ip_recursive":"off","proxy_error_log":"logs\/error.log","client_ssl_cert_key_default":"\/usr\/local\/kong\/ssl\/ kong-default.key","nginx_daemon":"on","anonymous_reports":true,"db_cache_ttl":0,"nginx_proxy_directives":{},"pg_port":5432,"nginx_kong_conf":"\/usr\/local\/kong\/ nginx-kong.conf","client_body_buffer_size":"8k","lua_socket_pool_size":30,"admin_ssl_cert_default":"\/usr\/local\/kong\/ssl\/admin-kong-default.crt","nginx_http_ directives":[{"value":"prometheus_metrics 5m","name":"lua_shared_dict"}],"cassandra_keyspace":"kong","ssl_cert_default":"\/usr\/local\/kong\/ssl\/kong-default.crt"," nginx_conf":"\/usr\/local\/kong\/nginx.conf","admin_listen":["127.0.0.1:8001","127.0.0.1:8444 ssl"]},"version":"0.14.1","node_id":"23886866-845c-450b-9e9d-4b74b5267eb9 ","lua_version":"LuaJIT 2.1.0-beta3","prng_seeds":{"pid: 30380":521312001726},"timers":{"pending":5,"running":0},"hostname":"VM_0_9_centos"}



Global parameters

That is, all commands can be added with the following parameters

--help help command

--v Turn on detail mode

--vv to turn on debug mode


command line


kong check

Check the validity of kong.conf

Usage: kong check [conf]
[conf] (Default check /etc/kong.conf or /etc/kong/kong.conf)

kong prepare


Prepare kong's pre-folders and subfolders and files--- To be honest, I don't know what this command is for, I haven't used it anyway


kong health

Check the health of the kong node


kong migrations

Manage the kong database




Reference articles:

kong configuration document:https://docs.konghq.com/0.14.x/configuration/
kong cli command:https://docs.konghq.com/0.14.x/cli/




Previous:DRMSOFT (Golden Shield, Hurricane) EXE encrypts PDF machine code cracking
Next:CentOS 7 Docker deploys PostgreSQL 9.6
 Landlord| Posted on 11/30/2018 3:36:55 PM |
Tutorial on kong gateway:
Docker deployment kong-dashboard tutorial
https://www.itsvse.com/thread-5684-1-1.html
(Source: Architect_Programmer)

Use the kong rate-limiting plug-in to control the request rate of the interface
https://www.itsvse.com/thread-5685-1-1.html
(Source: Architect_Programmer)
Install Konga admin panel on CentOS
https://www.itsvse.com/thread-5916-1-1.html
(Source: Architect_Programmer)


Posted on 5/16/2023 11:15:21 AM |
CentOS 7 deploys Kong API Gateway
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com