Note: When a connection is established with the gateway, after the connection is established, the traffic continues to stay in the upstream that has been selected by the load balancing module
shenyu-plugin-tcp shenyu-protocol-tcpshenyu-admin --> BasicConfig --> Plugin, search for the tcp plugin and click “Resource” to activate the TCP plugin module.shenyu-admin --> BasicConfig--> Plugin --> tcp, set status enabled.The default configuration is as follows:
{ "loadBalanceAlgorithm": "random", "bossGroupThreadCount": "1", "workerGroupThreadCount": "12", "clientMaxConnections": "20", "clientMaxIdleTimeMs": "30000", "clientMaxLifeTimeMs": "60000", "clientPendingAcquireTimeout": "5", "clientPendingAcquireMaxCount": "5" }
loadBalanceAlgorithm : shenyu load balancing algorithm, random by defaultbossGroupThreadCount , workerGroupThreadCount: ReactorNetty TcpServer For configuration details, see shenyu-protocol-tcp#TcpBootstrapServer#start for detailsclientMaxConnections , clientMaxIdleTimeMs , clientMaxLifeTimeMs , clientPendingAcquireTimeout , clientPendingAcquireMaxCount ReactorNetty ConnectionProvider , see shenyu-protocol-tcp#ConnectionContext for detailsYou can search for the tcp plugin in shenyu-admin --> BasicConfig --> PluginHandle, and modify the default configuration:
discovery see discovery-mode
The TCP plugin supports two levels of discovery configuration: plugin-level and selector-level:
① You can click the “Discovery Configuration” button on the page to configure plugin-level discovery in the pop-up form. After the configuration is complete, you can open the form again to modify or delete the previous configuration. After the plug-in level discovery is configured, the discovery settings of the selectors are consistent with the plugin-level config by default:
② If you have not configured plugin-level discovery, you can configure the selector-level discovery every time you create a proxy-selector:
Discovery Zookeeper and Local modes are currently supported.
When the type of service Discovery is Zookeeper, you need to fill out the Discovery-ZooKeeper configuration training for details discovery-mode
In zookeeper mode, the discovery module will automatically monitor the user's zookeeper registration center and automatically maintain discovery upstreams:
Note: The name of the selector uniquely identifies the selector and cannot be repeated
shenyu-gateway port start log
shenyu-gateway proxy upstreamList‘s success log
Take proxying redis as an example, use redis-cli -p {forwardPort} to access.