<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>upstream — Little Step</title>
    <link>https://rex.writeas.com/tag:upstream</link>
    <description></description>
    <pubDate>Sat, 14 Nov 2026 00:47:05 +0000</pubDate>
    <item>
      <title>Nginx with health check modules</title>
      <link>https://rex.writeas.com/nginx-with-health-check-modules?pk_campaign=rss-feed</link>
      <description>We use nginx with a very popular module nginx-rtmp for live stream purpose. When one server is not enough we add a SLB before all these n...</description>
      <content:encoded><![CDATA[<p>We use nginx with a very popular module nginx-rtmp for live stream purpose. When one server is not enough we add a SLB before all these nginx server.</p>

<p>Typically we use Aliyun&#39;s SLB instance, and use level 4(TCP) load balancing. But there is one limitation for Aliyun SLB is that the maximum session time is 3600s(1 hour). If you publish one stream via the SLB for over one hour, and the connection disconnects, you retry, you will probably get a new backend server.</p>

<p>For simple RTMP stream it is no problem, but if you want to record all the files, it is impossible to merge all the files together.</p>

<p>So after some search one github, I found two modules which are very usefull to resolve this problems. We replace SLB with nginx servers, using TCP stream with health check, and use consistent algorithm.</p>

<p>Another is also health check module but for HTTP.</p>

<p>Below is simple step for build the module with nginx source.</p>

<pre><code class="language-shell">./configure --prefix=/opt/nginx \
            --with-select_module \
            --with-poll_module \
            --with-http_ssl_module \
            --with-http_realip_module \
            --with-http_xslt_module \
            --with-http_sub_module \
            --with-http_dav_module \
            --with-http_flv_module \
            --with-http_gzip_static_module \
            --with-http_stub_status_module \
            --with-stream \
            --with-debug \
            --add-module=../nginx-rtmp-module-1.2.1 \
            --add-module=../nginx_upstream_check_module \
            --add-module=../ngx_stream_upstream_check_module
</code></pre>

<p><a href="https://github.com/arut/nginx-rtmp-module" rel="nofollow ugc">Nginx RTMP Module</a></p>

<p><a href="https://github.com/lusis/ngx_stream_upstream_check_module" rel="nofollow ugc">Stream Upstream Check Module</a></p>

<p><a href="https://github.com/yaoweibin/nginx_upstream_check_module" rel="nofollow ugc">HTTP Upstream Check</a></p>

<p><a href="https://rex.writeas.com/tag:nginx" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">nginx</span></a> <a href="https://rex.writeas.com/tag:slb" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">slb</span></a> <a href="https://rex.writeas.com/tag:upstream" class="hashtag" rel="nofollow ugc"><span>#</span><span class="p-category">upstream</span></a></p>
]]></content:encoded>
      <guid>https://rex.writeas.com/nginx-with-health-check-modules</guid>
      <pubDate>Mon, 27 Jan 2020 15:22:10 +0000</pubDate>
    </item>
  </channel>
</rss>