欢迎分享:http://toutiao.io/contribute Seesaw v2Note: This is not an official Google product. AboutSeesaw v2 is a Linux Virtual Server (LVS) based load balancing platform. It is capable of providing basic load balancing for servers that are on the same network, through to advanced load balancing functionality such as anycast, Direct Server Return (DSR), support for multiple VLANs and centralised configuration. Above all, it is designed to be reliable and easy to maintain. RequirementsA Seesaw v2 load balancing cluster requires two Seesaw nodes - these can be physical machines or virtual instances. Each node must have two network inte**ces - one for the host itself and the other for the cluster VIP. All four inte**ces should be connected to the same layer 2 network. BuildingSeesaw v2 is developed in Go and depends on several Go packages: Additionally, there is a compile and runtime dependency on libnl (https://www.infradead.org/~tgr/libnl/) and a compile time dependency on the Go protobuf compiler. On a Debian/Ubuntu style system, you should be able to prepare for building by running: apt-get install golang apt-get install protobuf-compiler apt-get install libnl-3-dev libnl-genl-3-dev After settingGOPATHto an appropriate location (for example~/go): go get -u golang.org/x/crypto/ssh
go get -u github.com/dlintw/goconf
go get -u github.com/golang/glog
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
go get -u github.com/miekg/dns
Ensure that${GOPATH}/binis in your${PATH}and in the seesaw directory: make test make install InstallingAftermake installhas run successfully, there should be a number of binaries in${GOPATH}/binwith aseesaw_prefix. Install these to the appropriate locations: SEESAW_BIN="/usr/local/seesaw"
SEESAW_ETC="/etc/seesaw"
SEESAW_LOG="/var/log/seesaw"
install -d "${SEESAW_BIN}" "${SEESAW_ETC}" "${SEESAW_LOG}"
install "${GOPATH}/bin/seesaw_cli" /usr/bin/seesaw
for component in {ecu,engine,ha,healthcheck,ncc,watchdog}; do
install "${GOPATH}/bin/seesaw_${component}" "${SEESAW_BIN}"
done
install "etc/init/seesaw_watchdog.conf" "/etc/init"
install "etc/seesaw/watchdog.cfg" "${SEESAW_ETC}"
# Enable CAP_NET_RAW for seesaw binaries that require raw sockets.
/sbin/setcap cap_net_raw ep "${SEESAW_BIN}/seesaw_ha"
/sbin/setcap cap_net_raw ep "${SEESAW_BIN}/seesaw_healthcheck"
Thesetcapbinary can be found in the libcap2-bin package on Debian/Ubuntu. ConfiguringEach node needs a/etc/seesaw/seesaw.cfgconfiguration file, which provides information about the node and who its peer is. Additionally, each load balancing cluster needs a cluster configuration, which is in the form of a text-based protobuf - this is stored in/etc/seesaw/cluster.pb. An example seesaw.cfg file can be found inetc/seesaw/seesaw.cfg.example- a minimal seesaw.cfg provides the following:
The VIP floats between the Seesaw nodes and is only active on the current master. This address needs to be allocated within the same netblock as both the node IP address and peer IP address. An example cluster.pb file can be found inetc/seesaw/cluster.pb.example- a minimalcluster.pbcontains aseesaw_vipentry and twonodeentries. For each service that you want to load balance, a separatevserverentry is needed, with one or morevserver_entrysections (one per port/proto pair), one or morebackendsand one or morehealthchecks. Further information is available in the protobuf definition - seepb/config/config.proto. On an upstart based system, runningrestart seesaw_watchdogwill start (or restart) the watchdog process, which will in turn start the other components. AnycastSeesaw v2 provides full support for anycast VIPs - that is, it will advertise an anycast VIP when it becomes available and will withdraw the anycast VIP if it becomes unavailable. For this to work the Quagga BGP daemon needs to be installed and configured, with the BGP peers accepting host-specific routes that are advertised from the Seesaw nodes within the anycast range (currently hardcoded as 192.168.255.0/24). Command LineOnce initial configuration has been performed and the Seesaw components are running, the state of the Seesaw can be viewed and controlled via the Seesaw command line inte**ce. Runningseesaw(assuming/usr/binis in your path) will give you an interactive prompt - type?for a list of top level commands. A quick summary:
|
|
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系
[邮箱地址] 删除
|