blob: df101f528620316a3727cb7f8c1396d50a8edb0b [file] [log] [blame]
<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-beta.4">
<link rel="alternate" type="application/rss+xml" href="/blog/rss.xml" title="Apache ShenYu Blog RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/blog/atom.xml" title="Apache ShenYu Blog Atom Feed">
<link rel="search" type="application/opensearchdescription+xml" title="Apache ShenYu" href="/opensearch.xml">
<link rel="alternate" type="application/rss+xml" href="/news/rss.xml" title="Apache ShenYu Blog RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/news/atom.xml" title="Apache ShenYu Blog Atom Feed"><title data-react-helmet="true">Divide Plugin | Apache ShenYu</title><meta data-react-helmet="true" property="og:url" content="https://shenyu.apache.org//docs/2.4.1/plugin-center/proxy/divide-plugin"><meta data-react-helmet="true" name="docsearch:language" content="en"><meta data-react-helmet="true" name="docsearch:version" content="2.4.1"><meta data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-2.4.1"><meta data-react-helmet="true" property="og:title" content="Divide Plugin | Apache ShenYu"><meta data-react-helmet="true" name="description" content="divide plugin"><meta data-react-helmet="true" property="og:description" content="divide plugin"><meta data-react-helmet="true" name="keywords" content="divide"><link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.svg"><link data-react-helmet="true" rel="canonical" href="https://shenyu.apache.org//docs/2.4.1/plugin-center/proxy/divide-plugin"><link data-react-helmet="true" rel="alternate" href="https://shenyu.apache.org//docs/2.4.1/plugin-center/proxy/divide-plugin" hreflang="en"><link data-react-helmet="true" rel="alternate" href="https://shenyu.apache.org//zh/docs/2.4.1/plugin-center/proxy/divide-plugin" hreflang="zh"><link data-react-helmet="true" rel="alternate" href="https://shenyu.apache.org//docs/2.4.1/plugin-center/proxy/divide-plugin" hreflang="x-default"><link data-react-helmet="true" rel="preconnect" href="https://BH4D9OD16A-dsn.algolia.net" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.b6f9a199.css">
<link rel="preload" href="/assets/js/runtime~main.490de106.js" as="script">
<link rel="preload" href="/assets/js/main.cb386500.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div><a href="#" class="skipToContent_OuoZ">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><img src="/img/logo.svg" alt="Apache ShenYu Logo" class="themedImage_TMUO themedImage--light_4Vu1 navbar__logo"><img src="/img/logo-light.svg" alt="Apache ShenYu Logo" class="themedImage_TMUO themedImage--dark_uzRr navbar__logo"></a></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/download">Download</a><a class="navbar__item navbar__link" href="/document">Docs</a><a class="navbar__item navbar__link" href="/community/contributor-guide">Community</a><a class="navbar__item navbar__link" href="/team">Team</a><a class="navbar__item navbar__link" href="/event">Event</a><a class="navbar__item navbar__link" href="/news">News</a><a class="navbar__item navbar__link" href="/blog">Blog</a><a class="navbar__item navbar__link" href="/users">Users</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a class="navbar__item navbar__link">ASF</a><ul class="dropdown__menu"><li><a href="https://www.apache.org/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Foundation</a></li><li><a href="https://www.apache.org/licenses/" target="_blank" rel="noopener noreferrer" class="dropdown__link">License</a></li><li><a href="https://www.apache.org/events/current-event" target="_blank" rel="noopener noreferrer" class="dropdown__link">Events</a></li><li><a href="https://www.apache.org/security/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Security</a></li><li><a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Sponsorship</a></li><li><a href="https://www.apache.org/foundation/policies/privacy.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Privacy</a></li><li><a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Thanks</a></li></ul></div><a href="https://github.com/apache/shenyu" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link"><span>GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_wgqa"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" class="navbar__item navbar__link"><span><svg t="1631348384596" class="icon" viewBox="0 0 1024 1024" version="1.1" style="vertical-align:text-bottom;margin-right:5px" p-id="557" width="20" height="20"><path d="M547.797333 638.208l-104.405333-103.168 1.237333-1.28a720.170667 720.170667 0 0 0 152.490667-268.373333h120.448V183.082667h-287.744V100.906667H347.605333v82.218666H59.818667V265.386667h459.178666a648.234667 648.234667 0 0 1-130.304 219.946666 643.242667 643.242667 0 0 1-94.976-137.728H211.541333a722.048 722.048 0 0 0 122.453334 187.434667l-209.194667 206.378667 58.368 58.368 205.525333-205.525334 127.872 127.829334 31.232-83.84m231.424-208.426667h-82.218666l-184.96 493.312h82.218666l46.037334-123.306667h195.242666l46.464 123.306667h82.218667l-185.002667-493.312m-107.690666 287.744l66.56-178.005333 66.602666 178.005333z" fill="currentColor" p-id="558"></path></svg><span>English</span></span></a><ul class="dropdown__menu"><li><a href="/docs/2.4.1/plugin-center/proxy/divide-plugin" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" style="text-transform:capitalize">English</a></li><li><a href="/zh/docs/2.4.1/plugin-center/proxy/divide-plugin" target="_self" rel="noopener noreferrer" class="dropdown__link" style="text-transform:capitalize">简体中文</a></li></ul></div><div class="react-toggle toggle_2i4l react-toggle--disabled"><div class="react-toggle-track" role="button" tabindex="-1"><div class="react-toggle-track-check"><span class="toggle_iYfV">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_iYfV">🌞</span></div><div class="react-toggle-thumb"></div></div><input type="checkbox" class="react-toggle-screenreader-only" aria-label="Switch between dark and light mode"></div><div class="searchBox_Bc3W"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div class="main-wrapper docs-wrapper doc-page"><div class="docPage_lDyR"><button class="clean-btn backToTopButton_i9tI" type="button" title="Scroll to top"><svg viewBox="0 0 24 24" width="28"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z" fill="currentColor"></path></svg></button><aside class="docSidebarContainer_0YBq"><div class="sidebar_a3j0"><nav class="menu thin-scrollbar menu_cyFh menuWithAnnouncementBar_+O1J"><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/2.4.1/index">Overview</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">Design</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">Deployment</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">Quick Start</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">User Guide</a></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#">Plugin Center</a><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#" tabindex="0">Http Handle</a></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#" tabindex="0">Proxy</a><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" tabindex="0" href="/docs/2.4.1/plugin-center/proxy/divide-plugin">Divide Plugin</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/2.4.1/plugin-center/proxy/dubbo-plugin">Dubbo Plugin</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/2.4.1/plugin-center/proxy/grpc-plugin">gRPC Plugin</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/2.4.1/plugin-center/proxy/motan-plugin">Motan Plugin</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/2.4.1/plugin-center/proxy/sofa-plugin">Sofa Plugin</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/2.4.1/plugin-center/proxy/spring-cloud-plugin">Spring Cloud Plugin</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/2.4.1/plugin-center/proxy/tars-plugin">Tars Plugin</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#" tabindex="0">Fault Tolerance</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#" tabindex="0">Authority And Certification</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#" tabindex="0">Observability</a></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#" tabindex="0">Common</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">Developer Documentation</a></li></ul></nav></div></aside><main class="docMainContainer_r8cw"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_zHA2"><div class="alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for Apache ShenYu <b>2.4.1</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/docs/plugin-center/proxy/divide-plugin">latest version</a></b> (2.6.1).</div></div><div class="docItemContainer_oiyr"><article><span class="badge badge--secondary">Version: 2.4.1</span><div class="tocCollapsible_aw-L tocMobile_Tx6Y"><button type="button" class="clean-btn tocCollapsibleButton_zr6a">On this page</button></div><div class="markdown"><header><h1 class="h1Heading_dC7a">1. Overview</h1></header><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="11-plugin-name"></a>1.1 Plugin Name<a class="hash-link" href="#11-plugin-name" title="Direct link to heading">#</a></h2><ul><li><code>divide</code> Plugin</li></ul><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="12-appropriate-scenario"></a>1.2 Appropriate Scenario<a class="hash-link" href="#12-appropriate-scenario" title="Direct link to heading">#</a></h2><ul><li>Handling <code>http protocol</code> requests.</li><li>Support traffic management, such as a/b test, grayscale test.</li><li>Service Load Balancing.</li><li>Set request timeout.</li></ul><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="13-plugin-functionality"></a>1.3 Plugin functionality<a class="hash-link" href="#13-plugin-functionality" title="Direct link to heading">#</a></h2><ul><li>Supports traffic management based on request information such as uri, header, and query.</li><li>Supports setting the load balancing strategy for requests, and supports service warm-up. Currently, three strategies are supported: ip hash (consistent hash with virtual nodes), round-robbin (weighted polling), random (weighted random).</li><li>Supports setting the maximum value of the request header, the maximum value of the request body, and the request level timeout.</li><li>Supports setting the timeout retry policy and the number of retries. Currently, the retry policy supports: current (retrying the server that failed before) and failover (retrying other servers).</li></ul><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="14-plugin-code"></a>1.4 Plugin Code<a class="hash-link" href="#14-plugin-code" title="Direct link to heading">#</a></h2><ul><li>Core module is <code>shenyu-plugin-divide</code>.</li><li>Core class is <code>org.apache.shenyu.plugin.divide.DividePlugin</code>.</li></ul><header><h1 class="h1Heading_dC7a">2. How to use plugin</h1></header><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="21-plugin-use-procedure-chart"></a>2.1 Plugin-use procedure chart<a class="hash-link" href="#21-plugin-use-procedure-chart" title="Direct link to heading">#</a></h2><p><img src="/assets/images/procedure-en-5b17e369f9d6c12d70118a29f5b7bd30.png"></p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="22-import-pom"></a>2.2 Import pom<a class="hash-link" href="#22-import-pom" title="Direct link to heading">#</a></h2><ul><li>Import maven in shenyu-bootstrap project&#x27;s <code>pom.xml</code> file.</li></ul><div class="codeBlockContainer_J+bg"><div class="codeBlockContent_csEI xml"><pre tabindex="0" class="prism-code language-xml codeBlock_rtdJ thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_1zSZ"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">dependency</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">org.apache.shenyu</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">shenyu-spring-boot-starter-gateway</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">version</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">${project.version}</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">version</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">dependency</span><span class="token tag punctuation" style="color:#393A34">&gt;</span></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_M3SB clean-btn">Copy</button></div></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="23-enable-plugin"></a>2.3 Enable plugin<a class="hash-link" href="#23-enable-plugin" title="Direct link to heading">#</a></h2><ul><li>In <code>shenyu-admin</code> --&gt; BasicConfig --&gt; Plugin --&gt; <code>divide</code> set Status enable.</li></ul><p><img src="/assets/images/enable-en-d6ddedc0d79f6f071df86d262a7cda03.png"></p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="24-config-plugin"></a>2.4 Config plugin<a class="hash-link" href="#24-config-plugin" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="241-configure-access-parameters-in-the-client-project-configuration-file"></a>2.4.1 Configure access parameters in the client project configuration file<a class="hash-link" href="#241-configure-access-parameters-in-the-client-project-configuration-file" title="Direct link to heading">#</a></h3><ul><li>Client access method and server address. The following example uses the http access method. Currently, the client supports the following access methods: http, zookeeper, etcd, nacos, consul. For detailed access configuration parameters, please refer to <a href="/docs/2.4.1/user-guide/register-center-access">Client Access Configuration</a>.</li><li>Client configuration, including the protocol name and the routing address of the service, please use the http protocol here, and the value of contextPath must be configured as the routing address of each service.</li></ul><div class="codeBlockContainer_J+bg"><div class="codeBlockContent_csEI yaml"><pre tabindex="0" class="prism-code language-yaml codeBlock_rtdJ thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_1zSZ"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">shenyu</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">register</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">registerType</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> http</span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">serverLists</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> http</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain">//localhost</span><span class="token punctuation" style="color:#393A34">:</span><span class="token number" style="color:#36acaa">9095</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">props</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">username</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> admin</span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">password</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123456</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">client</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">http</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic"># http protocol</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">props</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">contextPath</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> /http </span><span class="token comment" style="color:#999988;font-style:italic"># routing address for each service</span></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_M3SB clean-btn">Copy</button></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="242-configure-upstream-validity-detection-parameters-in-the-shenyu-admin-configuration-file"></a>2.4.2 Configure upstream validity detection parameters in the shenyu-admin configuration file<a class="hash-link" href="#242-configure-upstream-validity-detection-parameters-in-the-shenyu-admin-configuration-file" title="Direct link to heading">#</a></h3><p>The following example uses the http access method. Currently, the client supports the following access methods: http, zookeeper, etcd, nacos, consul. For detailed access configuration parameters, please refer to <a href="/docs/2.4.1/user-guide/register-center-access">Client Access Configuration</a>.</p><blockquote><p>Only http-type registries support upstream detection.</p></blockquote><div class="codeBlockContainer_J+bg"><div class="codeBlockContent_csEI yaml"><pre tabindex="0" class="prism-code language-yaml codeBlock_rtdJ thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_1zSZ"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">shenyu</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">register</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">registerType</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> http </span><span class="token comment" style="color:#999988;font-style:italic"># Only http-type register center support upstream detection.</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">serverLists</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">props</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">checked</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean important" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic"># The default is true, set to false, do not detect.</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">zombieCheckTimes</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic"># The maximum number of zombie upstream detections. If it exceeds 5 times, its validity will no longer be detected. The default value is 5.</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">scheduledTime</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic"># Timing detection interval, the default is 10 seconds.</span><span class="token plain"></span></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">zombieRemovalTimes</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">60</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic"># How many seconds the upstream is offline to be considered as a zombie upstream, the default is 60 seconds.</span></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_M3SB clean-btn">Copy</button></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="243-configure-the-selector-and-rule-information-of-the-divide-plugin-in-shenyu-admin"></a>2.4.3 Configure the selector and rule information of the divide plugin in shenyu-admin<a class="hash-link" href="#243-configure-the-selector-and-rule-information-of-the-divide-plugin-in-shenyu-admin" title="Direct link to heading">#</a></h3><p>After the client is started, the <a href="/docs/2.4.1/user-guide/admin-usage/selector-and-rule">selector and rule</a> information will be automatically registered in shenyu-admin -&gt; Plugin List -&gt; Proxy -&gt; Divide.</p><p><img src="/assets/images/select-and-rule-en-3a62f8cb06cf350e1f7e48daaa601978.png"></p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="2431-selector-configuration"></a>2.4.3.1 Selector configuration<a class="hash-link" href="#2431-selector-configuration" title="Direct link to heading">#</a></h4><p>Example of divide selector. For general selector configuration, please refer to <a href="/docs/2.4.1/user-guide/admin-usage/selector-and-rule">Selectors and Rules</a>.</p><p><img src="/assets/images/selector-en-0b99d7a7e1ce0334e5dadc04ba8611c8.png"></p><h5><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="24311-selector-handling-information-configuration"></a>2.4.3.1.1 Selector handling information configuration<a class="hash-link" href="#24311-selector-handling-information-configuration" title="Direct link to heading">#</a></h5><ul><li><code>host</code>: fill in <code>localhost</code>, this field is not used currently.</li><li><code>ip:port</code>: <code>ip</code> and port, fill in the <code>ip</code> + port of your real service here.</li><li><code>protocol</code>: <code>http</code> protocol, fill in <code>http:</code> or <code>https:</code>, if not fill in, the default is: <code>http:</code>.</li><li><code>startupTime</code>: Startup time in milliseconds.</li><li><code>weight</code>: load balancing weight, the default value of service startup automatic registration is 50.</li><li><code>warmupTime</code>: Warmup time, in milliseconds. The server during warmup will calculate the instantaneous weight, and the calculated value will be smaller than the actual configured weight to protect the server just started. The default value of service startup registration is 10. For example, the warm-up time is 100 milliseconds, the current startup is 50 milliseconds, the configured weight is 50, and the actual weight is 25.</li><li><code>status</code>: On or off, this selector is valid only in the on state.</li></ul><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="2432-processing-information-configuration-of-rules"></a>2.4.3.2 Processing information configuration of rules<a class="hash-link" href="#2432-processing-information-configuration-of-rules" title="Direct link to heading">#</a></h4><p>Example of divide rule. For general rule configuration, please refer to <a href="/docs/2.4.1/user-guide/admin-usage/selector-and-rule">selectors and rules</a>.</p><p><img src="/assets/images/rule-en-0b219597a708404400981a3a9d6a89c0.png"></p><h5><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="24321-rule-processing-information-configuration"></a>2.4.3.2.1 Rule processing information configuration<a class="hash-link" href="#24321-rule-processing-information-configuration" title="Direct link to heading">#</a></h5><ul><li><code>loadStrategy</code>: If the <code>http</code> client is a cluster, which load balancing strategy is used when the <code>Apache ShenYu</code> gateway is called, currently supports <code>roundRobin</code>, <code>random</code> and <code>hash</code>.</li><li><code>timeout</code>: The timeout for calling the <code>http</code> client.</li><li><code>retry Count</code>: The number of retries that failed to call the <code>http</code> client timeout.</li><li><code>headerMaxSize</code>: The maximum value of the requested <code>header</code>.</li><li><code>requestMaxSize</code>: The maximum value of the request body.</li><li><code>retryStrategy</code>: Supported since <code>2.4.3</code>, retry strategy after failure, default <code>current</code> to maintain compatibility with lower versions. For example, there are 3 downstream services <code>http:localhost:1111</code>, <code>http:localhost:1112</code> and <code>http:localhost:1113</code>, assuming the first load balancing to <code>http:localhost:1111</code> and <code>call failed</code>. Using the <code>current</code> strategy will continue to retry calling <code>http:localhost:1111</code>; using the <code>failover</code> strategy will retry calling other services such as <code>http:localhost:1112</code> through the <code>load balancing</code>, if it fails again at this time , call to <code>http:localhost:1113</code> until no service is available.</li></ul><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="25-examples"></a>2.5 Examples<a class="hash-link" href="#25-examples" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="251-example-ab-test"></a>2.5.1 Example A/B Test<a class="hash-link" href="#251-example-ab-test" title="Direct link to heading">#</a></h3><p>To be added, welcome contribute.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="252-example-grayscale-test"></a>2.5.2 Example Grayscale Test<a class="hash-link" href="#252-example-grayscale-test" title="Direct link to heading">#</a></h3><p>To be added, welcome contribute.</p><header><h1 class="h1Heading_dC7a">3. How to disable plugin</h1></header><ul><li>In <code>shenyu-admin</code> --&gt; BasicConfig --&gt; Plugin --&gt; <code>divide</code> set Status disable.</li></ul><p><img src="/assets/images/disable-en-8ae0fcbf271bbccd293931cc20f3dfa1.png"></p></div><footer class="row docusaurus-mt-lg"><div class="col"><a href="https://github.com/apache/shenyu-website/edit/main/versioned_docs/version-2.4.1/plugin-center/proxy/divide-plugin.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_mS5F" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_wj+Z"></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/2.4.1/plugin-center/http-handle/rewrite-plugin"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« Rewrite Plugin</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/2.4.1/plugin-center/proxy/dubbo-plugin"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dubbo Plugin »</div></a></div></nav></div></div><div class="col col--3"><div class="tableOfContents_vrFS thin-scrollbar"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#11-plugin-name" class="table-of-contents__link">1.1 Plugin Name</a></li><li><a href="#12-appropriate-scenario" class="table-of-contents__link">1.2 Appropriate Scenario</a></li><li><a href="#13-plugin-functionality" class="table-of-contents__link">1.3 Plugin functionality</a></li><li><a href="#14-plugin-code" class="table-of-contents__link">1.4 Plugin Code</a></li><li><a href="#21-plugin-use-procedure-chart" class="table-of-contents__link">2.1 Plugin-use procedure chart</a></li><li><a href="#22-import-pom" class="table-of-contents__link">2.2 Import pom</a></li><li><a href="#23-enable-plugin" class="table-of-contents__link">2.3 Enable plugin</a></li><li><a href="#24-config-plugin" class="table-of-contents__link">2.4 Config plugin</a><ul><li><a href="#241-configure-access-parameters-in-the-client-project-configuration-file" class="table-of-contents__link">2.4.1 Configure access parameters in the client project configuration file</a></li><li><a href="#242-configure-upstream-validity-detection-parameters-in-the-shenyu-admin-configuration-file" class="table-of-contents__link">2.4.2 Configure upstream validity detection parameters in the shenyu-admin configuration file</a></li><li><a href="#243-configure-the-selector-and-rule-information-of-the-divide-plugin-in-shenyu-admin" class="table-of-contents__link">2.4.3 Configure the selector and rule information of the divide plugin in shenyu-admin</a></li></ul></li><li><a href="#25-examples" class="table-of-contents__link">2.5 Examples</a><ul><li><a href="#251-example-ab-test" class="table-of-contents__link">2.5.1 Example A/B Test</a></li><li><a href="#252-example-grayscale-test" class="table-of-contents__link">2.5.2 Example Grayscale Test</a></li></ul></li></ul></div></div></div></div></main></div></div></div>
<script src="/assets/js/runtime~main.490de106.js"></script>
<script src="/assets/js/main.cb386500.js"></script>
</body>
</html>