我们提供一个启动lars系统子系统和测试工具的一个脚本工具,run_lars
Lars/run_lars
#!/bin/bash
LARS_REPORTER_PATH="./lars_reporter"
LARS_DNS_PATH="./lars_dns"
LARS_LBAGENT_PATH="./lars_loadbalance_agent"
LARS_WEB_PATH="./larsWeb"
LARS_API_EXAMPLE_PATH="./api/cpp/example"
usage()
{
echo ""
echo "=======启动子系统=========="
echo "Usage ./run_lars [reporter|dns|lbagent|web|test]"
echo
echo "=======测试工具============"
echo "Usage ./run_lars test gethost ModID CmdID"
echo "Usage ./run_lars test getroute ModID CmdID"
echo "Usage ./run_lars test report ModID CmdID IP Port 0|1 --- 0:SUCC, 1:OVERLOAD"
echo "Usage ./run_lars test simulator ModID CmdID [errRate(0-10)] [queryCnt(0-999999)]"
echo "Usage ./run_lars test qps ThreadNum"
echo "Usage ./run_lars test example ModID CmdID"
echo
}
if [ "$1" = "test" ]; then
if [ "$2" = "gethost" ]; then
$PWD/$LARS_API_EXAMPLE_PATH/get_host $3 $4
elif [ "$2" = "getroute" ]; then
$PWD/$LARS_API_EXAMPLE_PATH/get_route $3 $4
elif [ "$2" = "report" ]; then
$PWD/$LARS_API_EXAMPLE_PATH/report $3 $4 $5 $6 $7
elif [ "$2" = "example" ]; then
$PWD/$LARS_API_EXAMPLE_PATH/example $3 $4
elif [ "$2" = "simulator" ]; then
if [ $# -eq 4 ]; then
$PWD/$LARS_API_EXAMPLE_PATH/simulator $3 $4
elif [ $# -eq 5 ]; then
$PWD/$LARS_API_EXAMPLE_PATH/simulator $3 $4 $5
elif [ $# -eq 6 ]; then
$PWD/$LARS_API_EXAMPLE_PATH/simulator $3 $4 $5 $6
else
usage
fi
elif [ "$2" = "qps" ]; then
$PWD/$LARS_API_EXAMPLE_PATH/qps $3
fi
elif [ "$1" = "reporter" ]; then
cd $LARS_REPORTER_PATH
./bin/lars_reporter
elif [ "$1" = "dns" ]; then
cd $LARS_DNS_PATH
./bin/lars_dns
elif [ "$1" = "lbagent" ]; then
cd $LARS_LBAGENT_PATH
./bin/lars_lb_agent
elif [ "$1" = "web" ]; then
cd $LARS_WEB_PATH
./lars-web
elif [ "$1" = "help" ]; then
usage
else
usage
fi
启动 Lars Reporter
$ ./run_lars reporter
▄▄
██
██ ▄█████▄ ██▄████ ▄▄█████▄
██ ▀ ▄▄▄██ ██▀ ██▄▄▄▄ ▀
██ ▄██▀▀▀██ ██ ▀▀▀▀██▄
██▄▄▄▄▄▄ ██▄▄▄███ ██ █▄▄▄▄▄██
▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀
Load balance And Remote service schedule System
_____ _
| __ \ | |
| |__) |___ _ __ ___ _ __| |_ ___ _ __
| _ // _ \ '_ \ / _ \| '__| __/ _ \ '__|
| | \ \ __/ |_) | (_) | | | || __/ |
|_| \_\___| .__/ \___/|_| \__\___|_|
| |
|_|
ITCAST(https://www.itcast.cn)
------------------------------------
create 0 thread
create 1 thread
create 2 thread
create 3 thread
create 4 thread
add msg cb msgid = 3
启动 Lars dns
$ ./run_lars dns
▄▄
██
██ ▄█████▄ ██▄████ ▄▄█████▄
██ ▀ ▄▄▄██ ██▀ ██▄▄▄▄ ▀
██ ▄██▀▀▀██ ██ ▀▀▀▀██▄
██▄▄▄▄▄▄ ██▄▄▄███ ██ █▄▄▄▄▄██
▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀
Load balance And Remote service schedule System
_____
| __ \
| | | |_ __ ___
| | | | '_ \/ __|
| |__| | | | \__ \
|_____/|_| |_|___/
ITCAST(https://www.itcast.cn)
------------------------------------
create 0 thread
create 1 thread
create 2 thread
create 3 thread
create 4 thread
add msg cb msgid = 1
lars dns service ....
now route version is 1574674421
启动 Lars Lb Agent
$ ./run_lars lbagent
▄▄
██
██ ▄█████▄ ██▄████ ▄▄█████▄
██ ▀ ▄▄▄██ ██▀ ██▄▄▄▄ ▀
██ ▄██▀▀▀██ ██ ▀▀▀▀██▄
██▄▄▄▄▄▄ ██▄▄▄███ ██ █▄▄▄▄▄██
▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀
Load balance And Remote service schedule System
_ _ _
| | | | /\ | |
| | | |__ / \ __ _ ___ _ __ | |_
| | | '_ \ / /\ \ / _` |/ _ \ '_ \| __|
| |____| |_) | / ____ \ (_| | __/ | | | |_
|______|_.__/ /_/ \_\__, |\___|_| |_|\__|
__/ |
|___/
ITCAST(https://www.itcast.cn)
------------------------------------
其他测试工具启动方式
$ ./run_lars help
=======启动子系统==========
Usage ./run_lars [reporter|dns|lbagent|web|test]
=======测试工具============
Usage ./run_lars test gethost ModID CmdID
Usage ./run_lars test getroute ModID CmdID
Usage ./run_lars test report ModID CmdID IP Port 0|1 --- 0:SUCC, 1:OVERLOAD
Usage ./run_lars test simulator ModID CmdID [errRate(0-10)] [queryCnt(0-999999)]
Usage ./run_lars test qps ThreadNum
Usage ./run_lars test example ModID CmdID