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
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