Seesaw負載均衡系統(tǒng)
Seesaw 是 Google 開源的一個基于 Linux 的負載均衡系統(tǒng)。Seesaw 包含基本的負載均衡特性,同時支持一些高級的功能,諸如:anycast, Direct Server Return (DSR), 支持多個 VLANs 和集中式配置。同時其設計的宗旨是易于維護。
安裝:
make install 成功運行后,應該會在 ${GOPATH}/bin 路徑下生成一些 seesaw_ 前綴的二進制文件。把它們安裝到合適的位置。
SEESAW_BIN="/usr/local/seesaw"
SEESAW_ETC="/etc/seesaw"
SEESAW_LOG="/var/log/seesaw"
INIT=`ps -p 1 -o comm=`
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
if [ $INIT = "init" ]; then
install "etc/init/seesaw_watchdog.conf" "/etc/init"
elif [ $INIT = "systemd" ]; then
install "etc/systemd/system/seesaw_watchdog.service" "/etc/systemd/system"
systemctl --system daemon-reload
fi
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"
setcap 二進制文件可以在 Debian/Ubuntu 上的 libcap2-bin 包找到。
配置:
點這里可查看一份配置示例文件,一份最小的 seesaw.cfg 文件提供一下內(nèi)容:
-
anycast_enabled - True if anycast should be enabled for this cluster.
-
name - The short name of this cluster.
-
node_ipv4 - The IPv4 address of this Seesaw node.
-
peer_ipv4 - The IPv4 address of our peer Seesaw node.
-
vip_ipv4 - The IPv4 address for this cluster VIP.
故障排除:
一個 Seesaw 應該有五個在看門狗下運行的組件——進程表顯示的進程:
-
seesaw_ecu
-
seesaw_engine
-
seesaw_ha
-
seesaw_healthcheck
-
seesaw_ncc
-
seesaw_watchdog
所有 Seesaw v2 的組件除了由看門狗提供的日志,都擁有自己的日志。如果任何一個進程沒有運行,請在 /var/log/seesaw (e.g. seesaw_engine.{log,INFO}) 檢查相應的日志。
需要注意的是,盡管該項目掛靠在 Google 名下,但并非 Google 官方產(chǎn)品,因此不會有官方支持,但源代碼還是十分值得一部分開發(fā)者參考。
