User Tools

Site Tools


informatica:linux:haproxy

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
informatica:linux:haproxy [2012/10/11 11:13] javiinformatica:linux:haproxy [2012/12/18 10:16] javi
Line 4: Line 4:
  
 http://code.google.com/p/haproxy-docs/wiki/source http://code.google.com/p/haproxy-docs/wiki/source
 +
  
 ===== Instalacion ===== ===== Instalacion =====
 +
 +==== Paquete debian ====
  
   sudo aptitude update; sudo aptitude install haproxy   sudo aptitude update; sudo aptitude install haproxy
  
 +==== Fuentes ====
 +
 +1. (Opcional) Instalar dependencias:
  
 +  sudo aptitude update; sudo aptitude install build-essential libpcre3-dev libssl-dev
  
  
Line 154: Line 161:
 } }
 </code> </code>
 +
  
  
Line 187: Line 195:
  
 </code> </code>
 +
 +
 +===== Estadisticas =====
 +
 +1. Habilitar estadisticas. TODO: revisar config y hacer lo mismo a traves de peticiones HTTP en lugar de socket
 +
 +  sudo vim /etc/haproxy/haproxy.cfg
 +
 +Y anyadir/editar la siguiente linea:
 +
 +<code>
 +global
 +        stats socket /tmp/haproxy_stats level admin
 +</code>
 +
 +2. Reiniciar haproxy
 +
 +  sudo /etc/init.d/haproxy restart
 +
 +3. Instalar socat
 +
 +  sudo aptitude update; sudo aptitude install socat
 +
 +4. Convertirse en root y probar comandos:
 +
 +  clear;echo "show stat" | socat unix-connect:/tmp/haproxy_stats stdio
 +
 +Listado completo de comandos en la seccion '9.2. Unix Socket commands' de http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
 +
 +==== Deshabilitar/habilitar un nodo ====
 +
 +Requiere tener las estadisticas habilitadas y ser root.
 +
 +**Deshabilitar**:
 +
 +  clear;echo "disable server mysql/mysql-3.dev.jj.com" | socat unix-connect:/tmp/haproxy_stats stdio
 +
 +**Habilitar**:
 +
 +  clear;echo "enable server mysql/mysql-3.dev.jj.com" | socat unix-connect:/tmp/haproxy_stats stdio
  
informatica/linux/haproxy.txt · Last modified: 2015/04/13 20:19 by 127.0.0.1