Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Getting started with Kong and docker installation

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Introduction by Kong

Kong (https://github.com/Kong/kong) is a cloud native, efficient, scalable distributed API gateway. Since it was opened up in github in 2015, it has received wide attention and has gained 1.9w + star, whose core value lies in high performance and scalability.

two。 Be prepared to install docker stable version before installation will understand the basic use of docker. (document address: https://getkong.org/docs/) the conceptual term upstream: is an abstraction of an upstream server; target: represents a physical service and is an abstraction of ip + port Service: an abstract service, which can be mapped directly to a physical service (host points to ip + port) or to a upstream to achieve load balancing; route: an abstraction of routing, which is responsible for mapping the actual request to service. By default, the port on which KONG listens is: 8000: this port is used by KONG to listen for incoming HTTP requests from the client and forward this request to the server on the server; 8443: this port is used by KONG to listen for incoming HTTP requests from the client. It is similar to the function of port 8000, but it is only used to listen for HTTP requests and has no forwarding function. It can be disabled by modifying the configuration file; 8001: Admin API, through which managers can configure KONG's listening service

8444: through this port, managers can monitor HTTP requests.

III. Kong installation

Here we take versions above 0.13.x as an example, abandoning the use of API entity objects.

1. Create a docker network

Docker network create kong-net

two。 Install database, kong supports postgres (above postgres9.5) and Apache Cassandra

Create a startup database. Here, postgres9.5 is used as the database to store data, as follows:

$docker run-d-name kong-database\

-- network=kong-net\

-p 5432 Flux 5432\

-e "POSTGRES_USER=kong"\

-e "POSTGRES_DB=kong"\

Postgres:9.6

3. Database preparation, initializing Kong data

Docker run-- rm\

-- network=kong-net\

-e "KONG_DATABASE=postgres"\

-e "KONG_PG_HOST=kong-database"\

Kong:0.14.1 kong migrations up

4. Start kong

Docker run-d-name kong\

-- network=kong-net\

-e "KONG_DATABASE=postgres"\

-e "KONG_PG_HOST=kong-database"\

-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database"\

-e "KONG_PROXY_ACCESS_LOG=/dev/stdout"\

-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout"\

-e "KONG_PROXY_ERROR_LOG=/dev/stderr"\

-e "KONG_ADMIN_ERROR_LOG=/dev/stderr"\

-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0 8444 ssl"\

-p 8000 purl 8000\

-p 8443Suzhou 8443\

-p 8001Disc 8001\

-p 8444virtual 8444\

Kong:0.14.1

5. Check to see if kong is running.

$curl-I http://localhost:8001

You can then manage kong through Restful Admin API, reference address: https://docs.konghq.com/0.14.x/admin-api/

four。 Start Kong Dashboard

The official launch of dashboard to manage Kong, the interface is clean, easy to use, let's move on.

1. Create and run a Kong dashboard container

Docker run-d\

-- network=kong-net\

-- link kong:kong-p 8008 8080 pgbi/kong-dashboard start\

-- kong-url http://kong:8001\

-- basic-auth kong=kong

two。 Then visit http://192.168.33.10:8008,

Here 192.168.33.10 is my virtual machine IP login account kong and password kong, as shown below:

five。 Start postgre admin 4

1. Create and run a postgre admin 4 container

Docker run-d-p 8009VR 80\

-- network=kong-net\

-- link kong-database:kong-database\

-e "PGADMIN_DEFAULT_EMAIL=admin@admin.com"\

-e "PGADMIN_DEFAULT_PASSWORD=admin@admin.com"\

-d dpage/pgadmin4

two。 Then visit http://192.168.33.10:8009

The login account is admin@admin.com, and the password is admin@admin.com to create server, as shown below:

six。 Reference documentation

1.kong official document: https://getkong.org/docs/

2.docker installs kong: https://blog.csdn.net/freewebsys/article/details/80428830

3. Choose Kong as your API gateway: https://www.itcodemonkey.com/article/5980.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report