First, Introduction
In many scenarios, the configuration of the Ribbon may be customized as needed, such as modifying the Ribbon's load balancing rules. Spring Cloud Camden allows you to customize the configuration of the Ribbon using Java code or attributes.
Ii. using Java code to customize the Ribbon configuration
In spring cloud, the default configuration for the Ribbon is as follows, in the following format: Beantype beanname:classname
1, Iclientconfig Ribbonclientconfig:defaultclientconfigimpl
2, IRule Ribbonping:zoneavoidancerule
3, IPing ribbonping:noopping
4, ServerList Ribbonserverlist:configurationbasedserverlist
5, Serverlistfilter Ribbonserverlistfilter:zonepreferenceserverlistfilter
6, Iloadbalancer Ribbonloadbalancer:zoneawareloadbalancer
Analyze the following code: (org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration)
@Bean @conditionalonmissingbeanpublic IRule ribbonrule (iclientconfig config) {zoneavoidancerule rule = new Zoneavoidanc Erule (); Rule.initwithniwsconfig (config); return rule;}
Beantype is Irule,beanname is Ribbonrule,classname is Zoneavoidancerule, which is a combination of performance and service provider availability based on the zone where the service provider is located, Select the load Balancing rule for the provider node.
Not finished: To be continued ...
III. Customizing the Ribbon configuration using the properties file
This article is from "I Love Big gold" blog, please be sure to keep this source http://1754966750.blog.51cto.com/7455444/1947281
Springcloud (8): Ribbon for client side load Balancing-Customizing Ribbon configuration