First, whysoul-admin
No offline service was dropped
Soul-admin does not remove the IP address of the proxy from the local cache, and does not notify the gateway service to update the HTTP address of the proxy.
1. The HTTP service is actively registeredsoul-admin
1) Start the second HTTP service
Startup steps:
- Modify the service port and registration port in the configuration file
8189
- IDEA project system configuration changed to allow parallel startup
Port 8189 can be found in PluginList -> Divide -> SelectorList for soul-admin. The input box is too small to fully display ~ _ ~.
2) off8189
Port service
After the port 8189 service is manually disabled, the soul-admin generates an error log. ERROR 71493 — [upstream-task-2] o.d.s.a.s.impl.UpstreamCheckService : Check the URL =192.168.31.178:8189 is fail, and then find that the HTTP service 8189 registered in the background management system is dropped, and only 8188 is left.
GET http://localhost:9195/http/order/findById? Id =3 is also forwarded to port 8188.
Soul-admin performs a health check on the registered selector and drops the selector. The UpstreamCheckService class is found based on the log. It is found to be a 10-second scheduled task checking the health of the service and updating the database and notifies the gateway service to update the local cache.
So far, we’ve learned that soul-admin checks for the health of the access service and proactively notifies the gateway service that a problematic proxy service has been dropped.
3) What kind of service cannot be removed
Through the test of 2), it was found that soul-admin could take the initiative to remove the service. Then what caused the problem yesterday? What kind of access service could not be removed?
To continue testing, manually add a non-existent HTTP service to the PluginList -> Divide -> SelectorList of the backend management system
Using the GET http://localhost:9195/http/order/findById? Id = 3 test
- Error results and logs for forwarding to an address that does not exist
- Error results and logs forwarded to non-existent service ports
- Normal service of forwarding
Soul-admin’s SelectorList still contains two nonexistent selectorlists. Soul-admin does not automatically remove manually configured selectorlists.
Why does the HTTP service register itselfsoul-admin
The offline configuration can be explored by notifying the gateway to update the cache while manually insoul-admin
Can not be configured in?
Because the probe timing task checks UpstreamCheckService#UPSTREAM_MAP, and the callers of the UpstreamCheckService#submit method that updates its value are soul clients (the service to register), The soul-admin manual configuration interface does not call the Submit method to update the UPSTREAM_MAP value.
However, the update logic of the UpstreamCheckService#check method is that the number of lives to be checked in UPSTREAM_MAP == is returned without updating. If the value is not equal to the value, the configuration is updated in full. Here’s an interesting situation.
Normal, for example, the client registration service, normal client registration service B, error manually configure service C, because to check the number 2 is equal to the survival of 2, then error service C will not be off, but when the B service down, to check the number is not equal to survive for 1, 2 to full capacity update live configuration (A) only, not only B down at this time, The C configuration is also down.
Why does manual configuration not explore two possibilities:
- It is a gateway, after all, not a service governance framework
- Missed: then here’s a chance to make issue and pr and become soul contributor ^_^!!
Okay, let’s just say I missed it, Soul-admin add selector/ selector/{id} UpstreamCheckService# UPSTREAM_MAP values.
Ps: ONE operation issue raised, PR raised, excited heart, shaking hands, waiting for the reply, here can write down how to mention PR in the future.
Experience Dubbo agent
Finally, today’s topic, Soul’s plug-in design is great, agile architecture is easy to extend,
1. Prepare and start ZK
To start the Dubbo service, you need a registry, use ZooKeeper, and download one. Copy zoo. CFG to the conf directory to add the data directory.
#Zookeeper startup command. The default port is 2181
./zkServer.sh start
Copy the code
2. Agent Dubbo service
Start the Dubbo service (example in soul-example)
The Dubbo service is registered with the Soul gateway, so don’t forget to open the Dubbo plugin in plug-in Management
Use an HTTP request to access the gateway curl -gethttp://localhost:9195/dubbo/findAllForward success