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
Last revisionBoth sides next revision
informatica:linux:haproxy [2012/10/11 11:13] javiinformatica:linux:haproxy [2012/12/20 07:15] 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
Line 11: Line 14:
  
  
 +==== Fuentes ====
 +
 +Importante para obtener soporte SSL
 +
 +1. (Opcional) Instalar dependencias:
 +
 +  sudo aptitude update; sudo aptitude install build-essential libpcre3-dev libssl-dev
 +
 +2. Descargar:
 +
 +  cd /usr/local; sudo wget -c --tries=0 http://haproxy.1wt.eu/download/1.5/src/devel/haproxy-1.5-dev15.tar.gz
 +
 +3. Descomprimir
 +
 +  sudo tar xvfz haproxy-1.5-dev15.tar.gz; sudo ln -s haproxy-1.5-dev15 haproxy
 +
 +4. Compilar:
  
 +  cd /usr/local/haproxy; make TARGET=linux2628 USE_STATIC_PCRE=1 USE_OPENSSL=1 
 +  sudo make install
  
 ===== Config ===== ===== Config =====
Line 154: Line 176:
 } }
 </code> </code>
 +
  
  
Line 187: Line 210:
  
 </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