iqiyi / dpvs

DPVS is a high performance Layer-4 load balancer based on DPDK.
Other
3k stars 723 forks source link

keepalived config file is not properly loaded. #113

Closed icymoon closed 6 years ago

icymoon commented 6 years ago

Config two vs group like this: virtual_server_group 192.168.10.x_http { 192.168.10.4 80 192.168.10.5 80 }

virtual_server_group x_dns { 192.168.10.4 53 192.168.10.5 53 } and config each with several real servers. but it will work like this: # ./ipvsadm -ln IP Virtual Server version 0.0.0 (size=0) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn UDP 192.168.10.4:80 rr synproxy -> 172.16.10.3:53 FullNat 100 0 0 -> 172.16.10.3:8080 FullNat 0 0 0 -> 172.16.10.3:8081 FullNat 0 0 0 -> 172.16.10.3:8082 FullNat 0 0 0 -> 172.16.10.4:8080 FullNat 0 0 0 -> 172.16.10.4:8081 FullNat 0 0 0 -> 172.16.10.4:8082 FullNat 0 0 0 UDP 192.168.10.5:80 rr synproxy -> 172.16.10.3:53 FullNat 100 0 0 -> 172.16.10.3:8080 FullNat 0 0 0 -> 172.16.10.3:8081 FullNat 0 0 0 -> 172.16.10.3:8082 FullNat 0 0 0 -> 172.16.10.4:8080 FullNat 0 0 0 -> 172.16.10.4:8081 FullNat 0 0 0 -> 172.16.10.4:8082 FullNat 0 0 0

mscbg commented 6 years ago

Probablely you have set a wrong config file,(missing '}'). I make a configure file just like yours. It worked well. If you set healthy check, rs which can not connected will be deleted.

1 ! Configuration File for keepalived 2 3 global_defs { 4 ! notification_email { 5 ! foo@example.com 6 ! } 7 ! notification_email_from bar@example.com 8 ! smtp_server 1.2.3.4 9 10 ! smtp_connect_timeout 60 11 router_id DPVS_TESTING 12 } 13 14 local_address_group laddr_g1 { 15 172.16.10.2 dpdk0 # use DPDK interface 16 172.16.10.10 dpdk0 # use DPDK interface 17 172.16.10.11 dpdk0 # use DPDK interface 18 172.16.10.12 dpdk0 # use DPDK interface 19 172.16.10.13 dpdk0 # use DPDK interface 20 } 21 22 # 23 # Virtual Server Section 24 # 25 virtual_server_group 192.168.10.x_http { 26 192.168.10.4 80 27 192.168.10.5 80 28 } 29 30 virtual_server_group x_dns { 31 192.168.10.4 53 32 192.168.10.5 53 33 } 34 35 virtual_server group 192.168.10.x_http { 36 delay_loop 3 37 lb_algo rr # scheduling algorithm Round-Robin 38 lb_kind FNAT # Forwarding Mode Full-NAT 39 protocol TCP # Protocol TCP 40 syn_proxy ON 41 42 laddr_group_name laddr_g1 # Local IP group-ID 43 44 real_server 172.16.10.3 8080 { # real-server 45 weight 100 46 inhibit_on_failure 47 TCP_CHECK { # health check 48 nb_sock_retry 2 49 connect_timeout 3 50 connect_port 8080 51 } 52 } 53 real_server 172.16.10.3 8081 { # real-server 54 weight 100 55 inhibit_on_failure 56 TCP_CHECK { # health check 57 nb_sock_retry 2 58 connect_timeout 3 59 connect_port 8081 60 } 61 } 62 real_server 172.16.10.3 8082 { # real-server 63 weight 100 64 inhibit_on_failure 65 TCP_CHECK { # health check 66 nb_sock_retry 2 67 connect_timeout 3 68 connect_port 8082 69 } 70 } 71 real_server 172.16.10.4 8080 { # real-server 72 weight 100 73 inhibit_on_failure 74 TCP_CHECK { # health check 75 nb_sock_retry 2 76 connect_timeout 3 77 connect_port 8080 78 } 79 } 80 real_server 172.16.10.4 8081 { # real-server 81 weight 100 82 inhibit_on_failure 83 TCP_CHECK { # health check 84 nb_sock_retry 2 85 connect_timeout 3 86 connect_port 8081 87 } 88 } 89 real_server 172.16.10.4 8082 { # real-server 90 weight 100 91 inhibit_on_failure 92 TCP_CHECK { # health check 93 nb_sock_retry 2 94 connect_timeout 3 95 connect_port 8082 96 } 97 } 98 } 99 100 virtual_server group x_dns { 101 delay_loop 3 102 lb_algo rr # scheduling algorithm Round-Robin 103 lb_kind FNAT # Forwarding Mode Full-NAT 104 protocol UDP # Protocol P 105 106 laddr_group_name laddr_g1 # Local IP group-ID 107 108 real_server 172.16.10.3 53 { # real-server 109 weight 100 110 #inhibit_on_failure 111 #UDP_CHECK { # health check 112 # nb_sock_retry 2 113 # connect_timeout 3 114 # connect_port 53 115 #} 116 } 117 real_server 172.16.10.4 53 { # real-server 118 weight 100 119 #inhibit_on_failure 120 #UDP_CHECK { # health check 121 # nb_sock_retry 2 122 # connect_timeout 3 123 # connect_port 53 124 #} 125 } 126 } 127

icymoon commented 6 years ago

Thank you very much :)