Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to have a unix socket across a network? Is it possible to have multiple application servers running unicorn use that same shared socket?

The setup I'd like to achieve would look like:

        nginx
          ↓
 Unicorn     Unicorn

nginx config:

upstream github {
    server unix:/shared/unicorn.sock;
}

Unicorn config (x2)

listen '/shared/unicorn.sock'

I know it's possible to do something like:

upstream unicorns {
  server 192.168.1.100:5000;
  server 192.168.1.101:5000;
}

However I think this is not ideal, because you don't get the benefit of Unicorn doing its own load balancing and you have to specify the ip addresses ahead of time.

A few years ago GitHub blogged about their Unicorn setup, where I think they are describing a similar setup, but it's not clear how to achieve this.

share|improve this question
    
Isn't this what load balancers are for? –  Tom O'Connor Feb 22 '13 at 23:27
add comment

1 Answer

Unix sockets only work within that system. A socket across the network is called a TCP connection. The way to do this is have Unicorn listen on a TCP socket and configure nginx to use them as upstreams (as you mentioned). Unicorn doesn't have distributed load balancing; you need nginx to do the load balancing.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.