lvs+keepalived (openstack)


LVS

vi /etc/keepalived/keepalived.conf
global_defs {
  router_id LVS_DEVEL
}
vrrp_instance VI_1 {
   state MASTER
   interface em1
   virtual_router_id 51
   priority 100
   advert_int 1
   authentication {
       auth_type PASS
       auth_pass 1111
   }
   virtual_ipaddress {
       192.168.200.200
   }
}
#############riak-KV:sock################
virtual_server 192.168.200.200 8087 {
    delay_loop 3
    lb_algo wlc
    lb_kind DR
    #persistence_timeout 50
    protocol TCP
    real_server 192.168.200.18 8087 {
        weight 1
    #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8087
        }
    }
    real_server 192.168.200.19 8087 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8087
        }
    }
    real_server 192.168.200.16 8087 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8087
        }
    }
    real_server 192.168.200.12 8087 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8087
        }
    }
    real_server 192.168.200.21 8087 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8087
        }
    }
}
################riak-KV:http###################
virtual_server 192.168.200.200 8098 {
    delay_loop 3
    lb_algo wrr
    lb_kind DR
    #persistence_timeout 50
    protocol TCP
    real_server 192.168.200.18 8098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8098
        }
    }
    real_server 192.168.200.19 8098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8098
        }
    }
    real_server 192.168.200.16 8098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8098
        }
    }
    real_server 192.168.200.12 8098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8098
        }
    }
    real_server 192.168.200.21 8098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8098
        }
    }
}
################riak-CS###################
virtual_server 192.168.200.200 8080 {
    delay_loop 3
    lb_algo wrr
    lb_kind DR
    #persistence_timeout 50
    protocol TCP
    real_server 192.168.200.33 8080 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8080
        }
    }
    real_server 192.168.200.30 8080 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8080
        }
    }
    real_server 192.168.200.25 8080 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8080
        }
    }
    real_server 192.168.200.37 8080 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8080
        }
    }
    real_server 192.168.200.39 8080 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 8080
        }
    }
}
#############riak-TS:sock################
virtual_server 192.168.200.200 18087 {
    delay_loop 3
    lb_algo wrr
    lb_kind DR
    #persistence_timeout 50
    protocol TCP
    real_server 192.168.200.23 18087 {
        weight 1
    #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18087
        }
    }
    real_server 192.168.200.22 18087 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18087
        }
    }
    real_server 192.168.200.31 18087 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18087
        }
    }
    real_server 192.168.200.15 18087 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18087
        }
    }
    real_server 192.168.200.35 18087 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18087
        }
    }
}
################riak-TS:http###################
virtual_server 192.168.200.200 18098 {
    delay_loop 3
    lb_algo wrr
    lb_kind DR
    #persistence_timeout 50
    protocol TCP
    real_server 192.168.200.23 18098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18098
        }
    }
    real_server 192.168.200.22 18098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18098
        }
    }
    real_server 192.168.200.31 18098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18098
        }
    }
    real_server 192.168.200.15 18098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18098
        }
    }
    real_server 192.168.200.35 18098 {
        weight 1
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 18098
        }
    }
}
################RabbitMQ:5672###################
virtual_server 192.168.200.200 5672 {
    delay_loop 3
    lb_algo wrr
    lb_kind DR
    #persistence_timeout 50
    protocol TCP
    real_server 192.168.200.43 5672 {
        weight 10
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 5672
        }
    }
    real_server 192.168.200.29 5672 {
        weight 10
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 5672
        }
    }
    real_server 192.168.200.36 5672 {
        weight 10
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 5672
        }
    }
    real_server 192.168.200.28 5672 {
        weight 0
        #inhibit_on_failure
        TCP_CHECK {
            connect_timeout 2
            retry 2
            delay_before_retry 1
            connect_port 5672
        }
    }
}
vi /etc/rc.local
/sbin/ethtool -K eno1 gso off gro off tso off
ipvsadm --set 72000 5 60
exit 0
openstack node
echo "0" > /proc/sys/net/bridge/bridge-nf-call-ip6tables
echo "0" > /proc/sys/net/bridge/bridge-nf-call-iptables
echo "0" > /proc/sys/net/bridge/bridge-nf-call-arptables
vi /etc/libvirt/qemu.conf
security_driver = "none"

service libvirtd restart



md5-2fd975a005be791cd836691851a76d15



vi /etc/rc.local
echo 1 > /proc/sys/net/ipv4/ip_forward
/usr/sbin/ifconfig lo:0 192.168.200.200 netmask 255.255.255.255 broadcast 192.168.200.200 up
/usr/sbin/route add -host 192.168.200.200 dev lo:0