there are two routing configurations in zuul:
1. Map
by accessing IP and port Numbers
2. Map
by service name
p>
based on the code in the previous section:
first I cluster both service providers and service consumers:
p>
first configure the first:
change gateway application.yml
server:
port: 8090
eureka:
client:
service-url:
default-zone: http://localhost:8761/eureka
spring:
application:
name: zuul-service
zuul:
routes:
feign:
path: /feign/**
url: http://localhost:8085/
accesses the path path through path and url mapping and accesses the url directly to the address corresponding to the url, which is obviously not good, because the address of the service must be known, and the number of clusters may be dynamically extended, which only realizes proxy forwarding and cannot realize load balancing. Where /feign/* represents only one path, /feign/* represents the following multiple paths
accessed through the gateway:
p>
let’s look at the second one:
The
profile is as follows:
server:
port: 8090
eureka:
client:
service-url:
default-zone: http://localhost:8761/eureka
spring:
application:
name: zuul-service
zuul:
routes:
api-a:
path: /feign/**
service-id: eureka-feign
#zuul:
# routes:
# feign:
# path: /feign/**
# url: http://localhost:8085/
now that you are registered on eureka, you should get the registered service information, access the micro service through the service id, write the service name here with the service-id, and also implement the routing and melting functions.
p>
is then accessed through the gateway:
p>
and the third: zuul.routes. Service name: access path
zuul:
routes:
eureka-feign: /feign/**
p>
if you ignore a micro service and do not use the gateway, set this:
p>
zuul:
#忽略某个微服务
ignored-services: eureka-feign
forward jumps to local url:
zuul.routes.api-a.path=/user/**
zuul.routes.api-a.url=forward:/user
routing prefix:
zuul.prefix
does not take effect by default. To take effect, zuul.stripprefix =false
sets the omitted prefix to false
zuul.routes.api-a.path=/user/**
zuul.routes.api-a.stripPrefix=false
if you want to configure routing rules in order, you must use the yml file, not the properties file
zuul:
routes:
users:
path: /user/**
others:
path: /**
p>
my github address
p>
Read More:
- Solution to Starting Fault of routing and remote access service (16389 (0x4005))
- SpringCloud GateWay Failed to instantiate [org.springframework.cloud.gateway.discovery.DiscoveryL…
- Error: RPC failed; HTTP 504 curl 22 the requested URL returned error: 504 gateway time out
- There is a solution to the problem: severity = corrected, type = physical layer, id = 00e5 or id = 00e8 (receiver ID) under Ubuntu
- Resolve zuul the HTTP status 500 – internal server error error error displayed after startup
- Modify samba configuration, restart service failed
- com.netflix.zuul.exception.ZuulException: Forwarding error at org.springfram
- How to Configure Inter VLAN Routing on Layer 3 Switches?
- com.netflix.zuul.exception.ZuulException: Forwarding error
- nt service 1072 No need to restart, repeat the method of installing the service program or service driver
- Resolve the problem of “event ID 4107” or “event ID 11” errors recorded in the application logs of windows and windows server
- gateway Internal Server Error 500 Invalid host: lb://xxxxxx
- Altium designer 18: activeroute failed to complete any routing
- NxL job cluster nginx routing forwarding and reverse proxy
- Routing Error uninitialized constant TransController
- Centos7 executes the command service mysqld start and prompts Failed to start mysqld.service: Unit mysqld.service not loaded
- Install / Remove of the Service denied! Error occurred when installing MySQL service
- Gateway forwards weboskct with an error ClassCastException
- Hzero – if the local swagger fails to register, the connection timeout or gateway error will be displayed
- MongoDB Error: Failed to start mongod.service: Unit mongodb.service is masked