O haproxy pode ser usado para balancear soquetes unix?

4

No nginx é bastante simples configurá-lo para o proxy unix .sock files

Por exemplo:

upstream bla {
      server unix:///home/sam/Source/bla/tmp/sockets/thin1.sock;
      server unix:///home/sam/Source/bla/tmp/sockets/thin2.sock;
 }

Existe uma sintaxe semelhante no haProxy para habilitar o equilíbrio local .sock filew

    
por Sam Saffron 15.08.2012 / 02:12

3 respostas

13

Resposta curta: Sim, desde a versão 1.5 .

Vamos dar uma olhada na documentação de argumentos de palavra-chave servidor :

<address> is the IPv4 or IPv6 address of the server. Alternatively, a
          resolvable hostname is supported, but this name will be resolved
          during start-up. Address "0.0.0.0" or "*" has a special meaning.
          It indicates that the connection will be forwarded to the same IP
          address as the one from the client connection. This is useful in
          transparent proxy architectures where the client's connection is
          intercepted and haproxy must forward to the original destination
          address. This is more or less what the "transparent" keyword does
          except that with a server it's possible to limit concurrency and
          to report statistics. Optionally, an address family prefix may be
          used before the address to force the family regardless of the
          address format, which can be useful to specify a path to a unix
          socket with no slash ('/'). Currently supported prefixes are :
                - 'ipv4@'  -> address is always IPv4
                - 'ipv6@'  -> address is always IPv6
                - 'unix@'  -> address is a path to a local unix socket
                - 'abns@'  -> address is in abstract namespace (Linux only)
          Any part of the address string may reference any number of
          environment variables by preceding their name with a dollar
          sign ('$') and optionally enclosing them with braces ('{}'),
          similarly to what is done in Bourne shell.

Assim, você pode especificar o caminho para o unix socket com a barra inicial ou o prefixo da família de endereços explicitamente anterior:

server nginx1 /run/nginx/default.sock
server nginx2 [email protected]
    
por 22.09.2014 / 08:51
3

Como o quanta disse que precisa de endereço IPv4, mas usando socat para reencaminhar unix scoket para TCP, talvez você possa usar HAProxy para isso.

socat TCP-LISTEN:1234,reuseaddr,fork UNIX-CLIENT:/tmp/foo
    
por 15.08.2012 / 07:01
0

AFAIK, o HAProxy não suporta isso. De acordo com o documento , você deve especificar um IPv4 ou IPv6 (ou hostname) do servidor.

    
por 15.08.2012 / 06:55