次に、サービスインスタンスの取得方法、取得後にどのように処理が行われたか、および処理後にサービスインスタンスを選択する方法を見てみましょう。
3つの部分に分割します。
構成
前の記事「Spring Cloud Ribbonの原則」の構成セクションでは、デフォルトのロードバランサーがZoneawareloadbalancerであることがわかります。
Configurationクラスをご覧ください。
位置:
spring-cloud-netflix-core-1.3.5.Release.jarorg.springframework.cloud.netflix.ribbonribbonclientconfiguration.class
@suppresswarnings( "deprecation")@configuration@enableconfigurationProperties //注文はここで重要です。 https://github.com/spring-cloud/spring-cloud-netflix/issues/2086#issuecomment-316281653@import( {okhttpribbonconfiguration.class、rectclientribbonconfiguration.class、httpclientribbonconfiguration.publinfguration @bean @conditionalonmissingbean public iloadbalancer ribbonloadbalancer(iclientconfig config、serverList <server> serverList、serverListfilter <server> serverListfilter、iruleルール、iping ping、serverlistupdater serverListupdater){(この.PROPERTIESFECTITIESTIRESTITITIESTORIESTORIST() {return this.propertiesfactory.get(iloadbalancer.class、config、name); } new Zoneawareloadbalancer <>(config、rule、ping、serverList、serverListfilter、serverListUpDater)を返します。 }// 省略}config、ルール、ping、serverList、serverListfilter、serverListUpDaterのインスタンスで挿入されました。
構成:インスタンスを構成します。
ルール:ロードバランシングポリシーインスタンス。
ping:pingインスタンス。
サーバーリスト:サービスのインスタンスを取得および更新します。
ServerListFilter:サービスフィルタリングインスタンス。
ServerListUpDater:サービスリスト情報更新インスタンス。
@suppresswarnings( "deprecation")@configuration@enableconfigurationProperties //注文はここで重要です。 https://github.com/spring-cloud/spring-cloud-netflix/issues/2086#issuecomment-316281653@import( {okhttpribbonconfiguration.class、rectclientribbonconfiguration.class、httpclientribbonconfiguration.publinfguration OMIT @BEAN @ConditionAlonMissingBean public IclientConfig ribbonclientconfig(){defaultClientConfigimpl config = new DefaultClientConfigimpl(); config.loadproperties(this.name); configを返します。 } @bean @conditionalonmissingbean public irule ribbonrule(iclientconfig config){if(this.propertiesfactory.isset(irule.class、name)){return this.propertiesfactory.get(irule.class、config、name); } zoneavoidancerule rule = new Zoneavoidancerule(); Rule.initwithniwsconfig(config);ルールを返す; } @bean @conditionalonmissingbean public iping iping ribbonping(iclientconfig config){if(this.propertiesfactory.isset(iping.class、name)){return this.propertiesfactory.get(iping.class、config、name); } new dummyping()を返します。 } @bean @conditionalonmissingbean @suppresswarnings( "unchecked")public serverlist <server> ribbonserverlist(iclientconfig config){if(this.propertiesfactory.isset(serverlist.class、name)){return this.propertiesfactory.get(serverlist.class、 } configurationbasedServerlist serverList = new ConfigurationBasedServerList(); serverlist.initwithniwsconfig(config); return serverList; } @bean @conditionalonmissingbean public serverlistupdater ribbonserverlistupdater(iclientconfig config){return new Pollingserverlistupdater(config); } @bean @conditionalonmissingbean public iloadbalancer ribbonloadbalancer(iclientconfig config、serverList <server> serverListfilter> serverListfilter、iruleルール、iping ping、serverListupdater serverListupdater){if this.propertiesfactory.get(iloadbalancer.class、config、name); } new Zoneawareloadbalancer <>(config、rule、ping、serverList、serverListfilter、serverListUpDater)を返します。 } @bean @conditionalonmissingbean @suppresswarnings( "unchecked")public serverlistfilter <server> ribbonserverlistfilter(iclientconfig config){if(this.propertiesfactory.isset(serverlistfilter.class){cufter.get(server.get) 名前); } ZONEPREFERENCESERVERLISTFILTER FILTER = new ZONEPREFERENCESERVERLISTFILTER(); filter.initwithniwsconfig(config);返品フィルター。 } @bean @conditionalonmissingbean public ribbonloadbalancercontext ribbonloadbalanceRcontext(iloadbalancer loadbalancer、iclientconfig config、retryhandler retryhandler){return new ribbonloadbalancercontext(loadbalancers、config、retryhandler); } // 省略}ここで関連する例を構成します
構成:DefaultClientConfigimpl。
ルール:Zoneavoidancerule。
ping:dummyping。
サーバーリスト:ConfigurationBasedServerList、構成ベースのサービスリストインスタンス。
serverListFilter:ZONEPREFERENCESERVERLISTFILTER。
ServerListUpDater:PollingServerListUpDater。
ここのサーバーリストのインスタンスは、eurekaが使用されていない場合にサービス情報を取得し、構成ファイルから取得する場合に、構成ベースベースのServerListであることに注意してください。
したがって、eurekaを使用する場合、eurekaサーバーからサービス情報を取得する必要があります。これを行うために使用する必要がありますか?
Eureka Service Discoveryを有効にすると、EurekaribbonClientConfiguration Configurationクラスが最初に採用されます。
位置:
spring-cloud-netflix-eureka-client-1.3.5.release.jarorg.springframework.cloud.netflix.ribbon.eurekaeurekaribbonclientconfiguration.class
@configuration @commonslogpublic class eurekaribbonclientconfiguration {// omit @bean @conditionalonmissingbean public iping iping ribbonping(iclientconfig config){if(this.propertiesfactory.isset(iping.class、serviceid)){return this.properties factory.get.(iping.class.(iping); } niwsdiscoveryping ping = new niwsdiscoveryping(); ping.initwithniwsconfig(config); pingを返します。 } @bean @conditionalonmissingbean public serverlist <?> ribbonserverlist(iclientconfig config、provider <eurekaclientprovider){if(this.propertiesfactory.isset(serverlist.class、serviceId)) } discoveryEnabledNiwsServerlist discoveryServerlist = new DiscoveryEnabledNiWsServerlist(config、eurekaclientProvider); domainextractingserverlist serverList = new domainextractingserverlist(discoveryServerlist、config、this.approximatezonefromhostname); return serverList; } // 省略}eurekaribbonclientConfigurationの構成を最初に使用した後、インスタンスは実際に
構成:DefaultClientConfigimpl。
ルール:Zoneavoidancerule。
ping:niwsdiscovering。
サーバーリスト:domainextractingserverlist、内部的に発見されていることは、サービスの発見を通じて実際にサービス情報のリストを取得しています。
serverListFilter:ZONEPREFERENCESERVERLISTFILTER。
ServerListUpDater:PollingServerListUpDater。
サービスを取得します
サービス情報を取得するためのアクセスを見つける前に、最初にロードバランサーのクラス継承関係を編集します。
親クラスのdynamicserverlistloadbalancerコンストラクトは、ゾーンアワレロドバランサーのコンストラクトで呼び出されます。
位置:
リボン-Loadbalancer-2.2.2.jar
com.netflix.loadbalancer
Zoneawareloadbalancer.class
dynamicserverlistloadbalancerの構築では、repofinit関数が呼び出されます。
リボン-Loadbalancer-2.2.2.jar
com.netflix.loadbalancer
dynamicserverlistloadbalancer.class
void restofinit(iclientConfig clientConfig){boolean primeconnection = this.isenablePrimingConnections(); //これをオフにして、BaseloAdbalancer.setServerlist()this.SetEnablePrimingConnections(false)で行われた重複した非同期プライミングを避けます。 enable andInitLearnnewServersfeature(); updateListofServers(); if(primeconnection && this.getprimeconnections()!= null){this.getPrimeConnections().primeconnections(getReachableservers()); } this.SetEnablePrimingConnections(primeconnection); logger.info( "dynamicserverlistloadbalancer for client {}初期化:{}"、clientConfig.getClientName()、this.toString()); }まず、サービスリストは、enable andInitlearnnewserversfeatureメソッドを呼び出すことにより定期的に更新され、すぐにUpdateListofServers関数を呼び出して、サービスリスト情報をすぐに取得および更新します。
まず、enableant relearnnewserversfeatureメソッドを見てみましょう。実際、サービスリスト情報更新インスタンスの開始方法が呼び出され、時限更新関数が開始されます。
/ ** *この *機能を有効にしたい場合、LBがこのメソッドを使用する場合、既存のサーバーのリストに(AMISから)新しいインスタンスを追加できる機能 */ public void enable eNABLENITLEARNNEWSERVERSVETURE(){logger.info( "serverListupdater {}"を使用してserverListupdater.getDater( "); serverListupDater.start(updateaction); }サービスリスト情報更新の例は、構成段階で構成されたPollingserverlistupdaterインスタンスです。このクラスの構造と開始方法をご覧ください。
Public Class PollingserverListupdaterは、ServerListUpDater {// private static listofservers_cache_update_delay = 1000; // msecs; private static int listofservers_cache_repeat_interval = 30 * 1000; // msecs; // private final Atomicboolean isactive = new Atomicboolean(false);プライベート揮発性long lastUpdated = system.currenttimemillis();プライベートファイナルロングイニシャルデライム。プライベートファイナルの長いrefreedIntervalms; //わずかにPollingServerListUpDater(iClientConfig clientConfig){this(listofservers_cache_update_delay、getRefreshinterValms(clientConfig)); } public Pollingserverlistupdater(最終的な長いinitialdelayms、final long refrechintervalms){this.initialdelayms = initialdelayms; this.refreshintervalms = refreedintervalms; } @Override public synchronized void start(final updateAction updateAction){if(isactive.compareandset(false、true)){final runnable wrapperrunnable = new runnable(){@Override public void run(){){){)if(!isactive.get()){if(schoodure!= future! } 戻る; } try {updateaction.doupdate(); lastupdated = system.currenttimemillis(); } catch(Exception e){logger.warn( "1つの更新サイクルに失敗した"、e); }}}}; scheduledFuture = getRefreshExecutor()。scheduleWithfixeddelay(wrapperrunnable、initialdelayms、leffeshintervalms、timeunit.milliseconds); } else {logger.info( "すでにアクティブ、no-op"); }} // omit}構造と一定の定義から、実行は1秒遅れ、更新はデフォルトで30秒ごとに実行されます。構成間の更新時間を変更できます。
開始方法から、定期的に実行するスケジュールを開き、updateaction.doupdate()を定期的に実行することです。
Start Method Caller dynamicserverlistloadbalancerクラスに戻り、updateactionインスタンスの定義をご覧ください。
protected final serverListupDater.upDateAction updateAction = new ServerListupDater.upDateAction(){@Override public void doupdate(){updateListofServers(); }};実際、DynamicServerListLoadBalancerクラスのupdateListofServersメソッドが呼び出されます。これは、起動時刻の更新直後にサービス情報リストを更新するパスと一致しています。
UpdateListofServersメソッドを引き続き確認してください。
public void updateListofServers(){list <t> servers = new ArrayList <T>(); if(serverlistimpl!= null){servers = serverListimpl.getUpDatedListofServers(); logger.debug( "ディスカバリークライアントから取得した{}のサーバーのリスト:{}"、getIdentifier()、サーバー); if(filter!= null){servers = filter.getFilteredListofServers(サーバー); logger.debug( "ディスカバリークライアントから取得した{}のサーバーのフィルタリングリスト:{}"、getIdentifier()、サーバー); }} updateallserverlist(サーバー); }1.サーバーリストインスタンスを介してサービス情報リストを取得します。
2。serverlistfilterインスタンスを介して、取得したサービス情報リストをフィルタリングします。
3.フィルタリングされたサービス情報リストを保存して、状態保持としてロードバラランスターに保存します。
次に別々に見てみましょう。
1.サーバーリストインスタンスを介してサービス情報リストを取得します。
ServerListインスタンスは、構成段階で生成されたDomainExtractingServerListです。サービス情報は、DiscoveryEnabledNiwsServerlistに委任されます。
Public Class DiscoveryEnabledNiwsServerlistは、AbstractServerlist <DiscoveryEnabledServer> {// Omit @Override Public List <DiscoveryAldabledServer> getInitiAllistofServers(){retunedserversviadiscovery(); } @Override public List <DiscoveryEnabledServer> getUpDatedListofServers(){return gotadedServersviadiscovery(); } private list <DiscoveryEnabledServer> gotadedServersviadiscovery(){list <DiscoveryEnabledServer> serverList = new ArrayList <DiscoveryAnabledServer>(); if(eurekaclientProvider == null || eurekaclientProvider.get()== null){logger.warn( "eurekaclientはまだ初期化されていませんが、空のリストを返す"); new ArrayList <DiscoveryEnabledServer>()を返します。 } eurekaclient eurekaclient = eurekaclientprovider.get(); if(vipaddresses!= null){for(string vipaddress:vipaddresses.split( "、")){//ターゲットリージョンがnullの場合、それはクライアントリストの同じ領域として解釈されます。 for(instanceInfo II:listofinstanceinfo){if(ii.getStatus()。equals(instanceStatus.up)){if(sefdeduseOverrideport){if(logger.isdebugenabled()){logger.debug( "onriding port on" } // InstanceInfo Builderは元の参照を使用するだけなのでコピーが必要です。 if(isecure){ii = new instanceinfo.builder(copy).setsecureport(overrideport).build(); } else {ii = new InstanceInfo.Builder(copy).setport(overrideport).build(); }} discoveryEnabledServer des = new DiscoveryEnabledServer(II、Issecure、ShouldUseIpaddr); des.setzone(discoveryclient.getzone(ii)); serverlist.add(des); }} if(serverlist.size()> 0 && priorititizevipaddressbasedServers){break; //現在のVipAddressにサーバーがある場合、後続のVipAddressベースのサーバーを使用しません}}} return serverList; } // 省略}eurekaクライアントを介してeurekaサーバーからすべてのサービスインスタンス情報を取得し、オンラインのサービスをゾーン情報をdiscoveryEnabledServerインスタンスにパッケージ化し、サービスリストに掲載することが実際にあることがわかります。
2。serverlistfilterインスタンスを介して、取得したサービス情報リストをフィルタリングします。
ServerListFilteインスタンスは、構成段階で生成されたZonePreferenceServerListFilterであり、インスタンスのgetFilteredListofServersメソッドを呼び出すことによりフィルタリングされます。
@data@equalsandhashcode(calluper = false)public class zonepreferenceserverlistfilter拡張zoneaffinityserverlistfilter <server> {private string Zone; @Override public void initwithniwsconfig(iClientConfig niwsclientconfig){super.initwithniwsconfig(niwsclientconfig); if(configurationmanager.getDeploymentContext()!= null){this.zone = configurationmanager.getDeploymentContext()。 }} @Override public List <server> getFilterEdListofServers(List <server>サーバー){list <server> output = super.getFilteredListofServers(サーバー); if(this.zone!= null && output.size()== servers.size()){list <server> local = new arraylist <server>(); for(server server:output){if(this.zone.equalsignorecase(server.getZone())){local.add(server); }} if(!local.isempty()){return local; }} return output; }}getFilteredListofServersメソッドでは、最初に望むことは、親クラスの同じ名前を呼び出して最初にフィルタリングすることです。実際、親クラスは、消費者側と同じ領域でサービスを除外します。それだけでなく、障害/負荷が高いとき、または利用可能なインスタンスがほとんどないときに同じ領域でのフィルタリングが実行されないようにするために、いくつかのインテリジェントな判断を追加します。
ただし、ZonePreferenceServerlistfilter.getFilteredListofServersでは、親クラスがフィルタリングされていなくても、同じゾーンのサービスをフィルタリングして使用する必要があります。ここのクラスはゾーンプレーファレンスだと誰が言ったのですか?
これはかなり奇妙なことであり、親クラスのインテリジェントな判断には効果がないと感じています。
zoneaffityserverlistfilter.getFilteredListofServersによるハードワークを見てみましょう。
パブリッククラスzoneaffityserverlistfilter <t extends server> extends abstractserverlistfilter <t>はiclientconfigaware {// private boolean severenablezoneaffity(list <t> filtered){if(!zoneaffity &&!sonexclusive){return fals; } if(ZoneExclusive){return true; } loadbalancerstats stats = getloadbalancerstats(); if(stats == null){return zoneaffity; } else {logger.debug( "指定されたサーバーリストでゾーンアフィニティを有効にするかどうかを決定する:{}"、filtered); zonesnapshot snapshot = stats.getzonesnapshot(フィルタリング); double loadPerServer = snapshot.getLoadPerServer(); int instancecount = snapshot.getinstancecount(); int cirdingbreakertriptcount = snapshot.getCircuitTrippedCount(); if(((((double))circutebreakertriptedcount) / instancecount> = blackoutserverpercentagethreshold.get()|| loadpertherver> = actieRequeustSperServerthReshold.get()||(instanceCount -circuit BreakertriptedCount)<bavidayableserversthreshold.get()) Blackoutserverpercentage:{}、activeereqeustsperserver:{}、availableservers:{} "、new object [] {(double)circuitebreakertriptcount / instancount、loadperserver、instancecount -circuit breakertriptedcount}); getFilteredListofServers(list <t>サーバー){if(Zone!= null &&(Zoneaffity || ZoneExclusive)&& Servers!= null && servers.size()> 0){list <> filteredServers = lists.newArrayList(iterables.filter(servers(servers)) this. Zoneaffity.getServerlypredicate());まず、消費者側と同じゾーンのサービスが除外され、同じゾーンのサービスがSefdenableZoneaffity(FilteredServers)によって決定され、同じゾーンのサービスを採用できるか、すべてのサービスを採用できるかどうかを判断します。
SefdenableZoneAffityメソッドでは、同じゾーンのサービスに対してスナップショットが行われ、これらのサービスのインスタンス、平均負荷、およびインスタンスの数が計算と判断のために取得されます。
initwithniwsconfigメソッドの重要なインジケーターの値を確認できます。
決定条件:
サーキットブレーカーの割合> = 0.8(サーキットブレーカーの数/サービスのインスタンス数)
平均負荷> = 0.6
利用可能なインスタンスの数<2(インスタンス数 - 壊れているインスタンスの数)
判断条件が満たされている場合、すべてのサービスを使用して可用性を確保します。
ただし、上記のように、ZonePreferenceServerlistFilter自体は常に消費者ゾーンと一致するサービスを選択しているため、zoneaffitientivitientserverlistfilter.getFilteredListofSorversで行われるインテリジェントな操作は役に立ちません。
ただし、もちろん、カスタム構成を介してzoneaffityserverlistfilterインスタンスを使用できます。
3.フィルタリングされたサービス情報リストを保存して、状態保持としてロードバラランスターに保存します。
updateAllServerList(servers);そして、より深く進むと、実際にLoadBalancerStatsに保存されていることがわかり、この時点でのサービスはゾーングループに従ってHashMap<String, List<Server>>構造に保存され、キーはゾーンです。
サービスを選択します
iloadbalancerインターフェイスを実装するロードバランサーは、選択者メソッドを実装してサービスを選択するために使用され、選択したサービスはターゲットリクエストサービスとして使用されます。
Zoneawareloadbalancer.chooseserverメソッドをご覧ください。
@OverrideパブリックサーバーChooseServer(オブジェクトキー){if(!enabled.get()|| getloadbalanceStats()。getAvailableZones()。size()<= 1){ogger.debug( "ゾーンアウェアロジック無効または1つのゾーンのみがあります"); super.chooseserverを返します(key); } server server = null; try {loadbalancerstats lbstats = getloadbalancerstats(); Map <String、ZonesNapshot> ZonesNapshot = Zoneavoidancerule.createsnapshot(lbstats); logger.debug( "ゾーンスナップショット:{}"、zonesnapshot); if(triggeringload == null){triggeringload = dynamicPropertyFactory.getInstance()。getDoubleProperty( "zoneawareniwsdiscoveryloadbalancer。" + this.getName() + ".triggeringloadperserverthhold"、0.2d); } if(triggeringblackoutpercentage == null){triggeringblackoutpercentage = dynamicPropertyFactory.getInstance()。 } set <string> avainalZones = zoneavoidancerule.getAvailableZones(zonesnapshot、triggeringload.get()、triggeringblackoutpercentage.get()); logger.debug( "利用可能なゾーン:{}"、availablezones); if(availableZones!= null && baweryzones.size()<zonesnapshot.keyset()。size()){string zone = zoneavoidancerule.randomchoosezone(zonesnapshot、avainalzones); logger.debug( "ゾーン選択:{}"、ゾーン); if(Zone!= null){Baseloadbalancer Zoneloadbalancer = getLoadBalancer(Zone); server = zoneloadbalancer.chooseserver(key); }}} catch(Exception e){logger.error( "load balancer = {}"、name、e)のゾーン認識ロジックを使用してサーバーを選択するエラー} if(server!= null){return server; } else {logger.debug( "ゾーン回避ロジックは呼び出されません。"); super.chooseserverを返します(key); }}ここには2つの使用法があることに注意してください。
1. Zoneawareniwsdiscoveryloadbalancer.enabled = false、またはゾーンの数を構成することにより、ゾーンアウェアの負荷分散をオフにします<= 1。
2。ゾーンの知覚を使用するか、ゾーンの数は1> 1です。
一つずつ見てみましょう
1. Zoneawareniwsdiscoveryloadbalancer.enabled = false、またはゾーンの数を構成することにより、ゾーンアウェアの負荷分散をオフにします<= 1。
この場合、親クラスBaseloadbalancer.ChooseServerメソッドが呼び出されます。
public server chooseServer(object key){if(counter == null){counter = createcounter(); } counter.increment(); if(rule == null){return null; } else {try {return rule.choose(key); } catch(Exception e){logger.warn( "loadbalancer [{{}]:key {}"、name、key、e)の[サーバーの選択をエラー]; nullを返します。 }}}ここで使用される負荷分散ポリシールールは、実際には、構成フェーズ中に生成されたゾーンアボディルールポリシーインスタンスであり、ゾーンアワレロアドバランサーを構築するときに送信されました。
public void setrule(irule rule){if(rule!= null){this.rule = rule; } else { / *デフォルトルール * / this.rule = new roundrobinrule(); } if(this.rule.getloadbalancer()!= this){this.rule.setloadbalancer(this); }}構成がない場合、デフォルトのRoundRobinRuleポリシーインスタンスが使用されていると仮定します。
2。ゾーンの知覚を使用するか、ゾーンの数は1> 1です。
public server chooseServer(object key){if(!enabled.get()|| getLoadBalanCONSERSTATS()。getAvailableZones()。size()<= 1){logger.debug( "ゾーンアウェアロジックが無効または1つのゾーンのみがあります"); super.chooseserverを返します(key); } server server = null; try {loadbalancerstats lbstats = getloadbalancerstats(); Map <String、ZonesNapshot> ZonesNapshot = Zoneavoidancerule.createsnapshot(lbstats); logger.debug( "ゾーンスナップショット:{}"、zonesnapshot); if(triggeringload == null){triggeringload = dynamicPropertyFactory.getInstance()。getDoubleProperty( "zoneawareniwsdiscoveryloadbalancer。" + this.getName() + ".triggeringloadperserverthhold"、0.2d); } if(triggeringblackoutpercentage == null){triggeringblackoutpercentage = dynamicPropertyFactory.getInstance()。 } set <string> avainalZones = zoneavoidancerule.getAvailableZones(zonesnapshot、triggeringload.get()、triggeringblackoutpercentage.get()); logger.debug( "利用可能なゾーン:{}"、availablezones); if(availableZones!= null && baweryzones.size()<zonesnapshot.keyset()。size()){string zone = zoneavoidancerule.randomchoosezone(zonesnapshot、avainalzones); logger.debug( "ゾーン選択:{}"、ゾーン); if(Zone!= null){Baseloadbalancer Zoneloadbalancer = getLoadBalancer(Zone); server = zoneloadbalancer.chooseserver(key); }}} catch(Exception e){logger.error( "load balancer = {}"、name、e)のゾーン認識ロジックを使用してサーバーを選択するエラー} if(server!= null){return server; } else {logger.debug( "ゾーン回避ロジックは呼び出されません。"); super.chooseserverを返します(key); }}この場合、ゾーンアボイドレーレの負荷分散ポリシーはデフォルトで使用されます。
ゾーンのスナップショット情報を取得します。
zoneavoidancerule.getavaiblezonesの定義を観察して、利用可能なゾーンを取得します。利用可能なゾーンではない条件は次のとおりです。
利用可能なすべてのゾーンが取得されたら、ランダムに1つを選択します。
そして、このゾーンから、Zoneawareloadbalancer.chooseserverの親クラスのベースロードバランサーを通じてサービスを選択します。上記のように、Baseloadbalancerでルールが渡されない場合、RoundrobinRuleポリシーはデフォルトでサービスを見つけるために使用されます。
実際、それは依然として上記のZonePreferenceServerlistFilterフィルターを取得する問題です。実際、消費者側と同じゾーンを持つ1つのサービスのみが除外されています。したがって、パート2で利用可能なゾーンからサービスを選択する機能を達成することはできません。それに到達するには、フィルターを交換する必要があります。
要約:
設定されたロードバランサーは、サービス情報を取得するためにスケジュールを開始します。 Eurekaクライアントを使用する場合、すべてのサービスインスタンス情報がEurekaサービスから取得され、使用できるサービスはフィルターを介して除外されます。デフォルトでは、フィルターは消費者側と同じサービスのみを除外します。高可用性を確保する場合は、ZoneaffityServerlistFilterフィルターを構成でき、フィルタリングされたサービスリストは、IRULEインターフェイスのロードバランシングポリシーを実装することにより、対応するサービスを選択します。ゾーンアウェアポリシーを使用する場合は、ゾーンから適切なサービスを選択することができます。