[root@yfs01 keepalived]# vim keepalived.conf real_server 192.168.200.5 1358 { weight 1 HTTP_GET { url { path /testurl/test.jsp digest 640205b7b0fc66c1ea91c463fac6334d } url { path /testurl2/test.jsp digest 640205b7b0fc66c1ea91c463fac6334d } url { path /testurl3/test.jsp digest 640205b7b0fc66c1ea91c463fac6334d } connect_timeout 3 retry 3 delay_before_retry 3 } } }这段代码有错么
时间: 2024-02-10 13:11:07 浏览: 121
yfs.tar.gz_Linux/Unix编程_C++_
这段代码存在语法错误,因为缺少一个`vrrp_instance`块。下面是修正后的代码:
```
vrrp_instance VI_1 {
virtual_router_id 51
advert_int 1
priority 100
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.200.10
}
track_script {
chk_http_port
}
real_server 192.168.200.5 1358 {
weight 1
HTTP_GET {
url {
path /testurl/test.jsp
digest 640205b7b0fc66c1ea91c463fac6334d
}
url {
path /testurl2/test.jsp
digest 640205b7b0fc66c1ea91c463fac6334d
}
url {
path /testurl3/test.jsp
digest 640205b7b0fc66c1ea91c463fac6334d
}
connect_timeout 3
retry 3
delay_before_retry 3
}
}
}
```
修正后的代码中,添加了一个 `vrrp_instance` 块,用于定义 VRRP 实例的配置。在该块中,定义了 virtual_router_id、authentication、virtual_ipaddress、track_script 等选项。其中,`real_server` 用于定义后端真实服务器的配置,包括 IP 地址、端口、权重以及 HTTP_GET 检测的路径和超时重试等选项。
阅读全文