1

The Upstream server is wowza. There are two upstreams

upstream wowza {
  hash $arg_streamKey consistent;
   server x.x.x.x:8087;
   server x.x.x.y:8087;
}

upstream wowza_thumbnail {
  hash $arg_streamKey consistent;
   server x.x.x.x:8086;
   server x.x.x.y:8086;
}

The first upstreams points to API and second points to Thumbnail URI.

I changed the hashKey to the query param thinking the hash will be based on the query param and it will resolve to the same server for both the upstreams but that not the case.

On some occasions, the second upstream resolve to a different server and I think that is due to the change in port.

Is there a way to make consistent hashing consistent for both the upstreams?

Any help would be appreciated.

maddygoround
  • 2,145
  • 2
  • 20
  • 32

1 Answers1

1

Okay. I understood that what I am asking here is not feasible. So instead of creating two upstream I created one and on the upstream server setup an Nginx proxy which proxy_pass both ports on the path pointing to a single port.

upstream wowza {
  hash $arg_streamKey consistent;
   server x.x.x.x:8081;
   server x.x.x.y:8081;
}

Wowza 1 and Wowza 2

server {
    listen 8081;
    server_name _;

    location /thumbnail {
        proxy_pass http://localhost:8086;
    }

   location / {
        proxy_pass http://localhost:8087;
   }

}

This help me deal with only one upstream block pointing to port 8081.

maddygoround
  • 2,145
  • 2
  • 20
  • 32
  • Thanks that you are answering your own question and describe a solution so that others can find them. Much appreciated! But: Does that really work? You don’t make use of the upstream in the server block’s proxy_pass directive. When is that called? – J J Jan 19 '20 at 07:38
  • 1
    @JJ They both are different servers. The upstream block is on server1 and the other proxies are on respective Wowza servers. Let me know if that answers your question. – maddygoround Jan 19 '20 at 12:06