PDA

View Full Version : keepalived ??


texerasmo
02-11-2006, 17:16
Cioa a tutti.
Allora io ho questo scenario

nodo1 Apache + keeplived 192.168.0.143
nodi2 Apache 192.168.0.149



file di configurazione
keeplived.conf

! Configuration File for keepalived

global_defs {
notification_email {
acassen@firewall.loc
failover@firewall.loc
sysadmin@firewall.loc
}
notification_email_from texerasmo@interno.com
smtp_server 192.168.0.101
smtp_connect_timeout 30
router_id LVS_DEVEL
}

vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.0.143
}
}

virtual_server 192.168.0.143 80 {
delay_loop 6
lb_algo rr
lb_kind NAT
persistence_timeout 50
protocol TCP

sorry_server 192.168.0.101 80

real_server 192.168.0.143 80 {
weight 1
HTTP_GET {
url {
path /index.html
digest 640205b7b0fc66c1ea91c463fac6334d
}
url {
path /index2.html
digest 640205b7b0fc66c1ea91c463fac6334d
}
url {
path /index3.html
digest 640205b7b0fc66c1ea91c463fac6334d
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}

real_server 192.168.0.149 80 {
weight 1
HTTP_GET {
url {
path /index.html
digest 640205b7b0fc66c1ea91c463fac6334c
}
url {
path /index2.html
digest 640205b7b0fc66c1ea91c463fac6334c
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}


i file virual host
httpd.conf del nodo1
<VirtualHost 192.168.0.143:80>

ServerAdmin www.balance.dev
DocumentRoot /home/mino/
ServerName www.balance.dev
ErrorLog /var/log/sneto/error_log
CustomLog /var/log/sneto/access_log common
</VirtualHost>

httpd.conf del nodo2
<VirtualHost 192.168.0.149:80>

ServerAdmin www.balance.dev
DocumentRoot /home/mino/
ServerName www.balance.dev
ErrorLog /var/log/sneto/error_log
CustomLog /var/log/sneto/access_log common
</VirtualHost>


ora mi dovrei aspettare un cosa del genere
le chiamate al sito www.balance.dev dovrebbere essere dirottate sia sul nodo1 che nodo2,oppure in caso un apache va giù le chiamate vengono dirottate sul nodo attivo.

nodo1 keeplived on
nodo1 apache on
nodo2 apache on

ovviamente non funziona

texerasmo
03-11-2006, 10:49
Questi sono i valori dopo il ./configure
secondo voi quel no determina il funzionamento?

Keepalived configuration
------------------------
Keepalived version : 1.1.13
Compiler : gcc
Compiler flags : -g -O2
Extra Lib : -lpopt -lssl -lcrypto
Use IPVS Framework : No
IPVS sync daemon support : No
Use VRRP Framework : Yes
Use LinkWatch : No
Use Debug flags : No

texerasmo
03-11-2006, 15:51
cmq ora ho abilitato LVS infatti nella compilazione ho questo messaggio ora

Keepalived configuration
------------------------
Keepalived version : 1.1.13
Compiler : gcc
Compiler flags : -g -O2
Extra Lib : -lpopt -lssl -lcrypto
Use IPVS Framework : Yes
IPVS sync daemon support : yes
Use VRRP Framework : Yes
Use LinkWatch : yes
Use Debug flags : No



questo è il messaggio che trovo nei log

Nov 4 02:29:00 localhost cfservd[2291]: /var/cfengine/inputs/cfservd.conf: No such file or directory
Nov 4 02:29:12 localhost Keepalived: Starting Keepalived v1.1.13 (11/03,2006)
Nov 4 02:29:12 localhost Keepalived_healthcheckers: Using LinkWatch kernel netlink reflector...
Nov 4 02:29:12 localhost Keepalived_healthcheckers: Netlink reflector reports IP 192.168.0.143 added
Nov 4 02:29:12 localhost Keepalived_healthcheckers: Registering Kernel netlink reflector
Nov 4 02:29:12 localhost Keepalived_healthcheckers: Registering Kernel netlink command channel
Nov 4 02:29:12 localhost Keepalived_healthcheckers: Configuration is using : 13758 Bytes
Nov 4 02:29:12 localhost Keepalived: Starting Healthcheck child process, pid=13582
Nov 4 02:29:12 localhost Keepalived_vrrp: Using LinkWatch kernel netlink reflector...
Nov 4 02:29:12 localhost Keepalived_vrrp: Netlink reflector reports IP 192.168.0.143 added
Nov 4 02:29:12 localhost Keepalived_vrrp: Registering Kernel netlink reflector
Nov 4 02:29:12 localhost Keepalived_vrrp: Registering Kernel netlink command channel
Nov 4 02:29:12 localhost Keepalived_vrrp: Registering gratutious ARP shared channel
Nov 4 02:29:12 localhost Keepalived: Starting VRRP child process, pid=13583
Nov 4 02:29:12 localhost Keepalived_healthcheckers: Activating healtchecker for service [192.168.0.143:80]
Nov 4 02:29:12 localhost Keepalived_healthcheckers: Activating healtchecker for service [192.168.0.149:80]
Nov 4 02:29:12 localhost Keepalived_vrrp: Configuration is using : 32320 Bytes
Nov 4 02:29:13 localhost Keepalived_healthcheckers: Error connecting server [192.168.0.143:444].
Nov 4 02:29:13 localhost Keepalived_healthcheckers: Removing service [192.168.0.143:80] from VS [192.168.0.149:80]
Nov 4 02:29:13 localhost Keepalived_healthcheckers: SMTP connection ERROR to [192.168.0.101:25].
Nov 4 02:29:13 localhost Keepalived_healthcheckers: Error connecting server [192.168.0.149:444].
Nov 4 02:29:13 localhost Keepalived_healthcheckers: Removing service [192.168.0.149:80] from VS [192.168.0.149:80]





il mio file di configurazione è fatto in uesto modo

! Configuration File for keepalived

global_defs {
notification_email {
acassen
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.0.101
smtp_connect_timeout 30
router_id LVS_DEVEL
}

vrrp_instance VI_1 {
interface eth0
virtual_router_id 50
nopreempt
priority 100
advert_int 1
virtual_ipaddress {
192.168.0.143
}
}

virtual_server 192.168.0.143 80 {
delay_loop 6
lb_algo rr
lb_kind NAT
persistence_timeout 50
protocol TCP

sorry_server 192.168.0.101 80

real_server 192.168.0.149 80 {
weight 1
HTTP_GET {
url {
path /test/index.html
digest 640205b7b0fc66c1ea91c463fac6334d
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}

il test che sto facendo è il seguente

nel dns configuro il sito www.balance.dev sull'ip 192.168.0.143

texerasmo
06-11-2006, 13:23
up!!!! :mc: :mc: