我们提供一个启动lars系统子系统和测试工具的一个脚本工具,run_lars
Lars/run_lars
#!/bin/bashLARS_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]"echoecho "=======测试工具============"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" ]; thenif [ "$2" = "gethost" ]; then$PWD/$LARS_API_EXAMPLE_PATH/get_host $3 $4elif [ "$2" = "getroute" ]; then$PWD/$LARS_API_EXAMPLE_PATH/get_route $3 $4elif [ "$2" = "report" ]; then$PWD/$LARS_API_EXAMPLE_PATH/report $3 $4 $5 $6 $7elif [ "$2" = "example" ]; then$PWD/$LARS_API_EXAMPLE_PATH/example $3 $4elif [ "$2" = "simulator" ]; thenif [ $# -eq 4 ]; then$PWD/$LARS_API_EXAMPLE_PATH/simulator $3 $4elif [ $# -eq 5 ]; then$PWD/$LARS_API_EXAMPLE_PATH/simulator $3 $4 $5elif [ $# -eq 6 ]; then$PWD/$LARS_API_EXAMPLE_PATH/simulator $3 $4 $5 $6elseusagefielif [ "$2" = "qps" ]; then$PWD/$LARS_API_EXAMPLE_PATH/qps $3fielif [ "$1" = "reporter" ]; thencd $LARS_REPORTER_PATH./bin/lars_reporterelif [ "$1" = "dns" ]; thencd $LARS_DNS_PATH./bin/lars_dnselif [ "$1" = "lbagent" ]; thencd $LARS_LBAGENT_PATH./bin/lars_lb_agentelif [ "$1" = "web" ]; thencd $LARS_WEB_PATH./lars-webelif [ "$1" = "help" ]; thenusageelseusagefi
启动 Lars Reporter
$ ./run_lars reporter▄▄████ ▄█████▄ ██▄████ ▄▄█████▄██ ▀ ▄▄▄██ ██▀ ██▄▄▄▄ ▀██ ▄██▀▀▀██ ██ ▀▀▀▀██▄██▄▄▄▄▄▄ ██▄▄▄███ ██ █▄▄▄▄▄██▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀Load balance And Remote service schedule System_____ _| __ \ | || |__) |___ _ __ ___ _ __| |_ ___ _ __| _ // _ \ '_ \ / _ \| '__| __/ _ \ '__|| | \ \ __/ |_) | (_) | | | || __/ ||_| \_\___| .__/ \___/|_| \__\___|_|| ||_|ITCAST(https://www.itcast.cn)------------------------------------create 0 threadcreate 1 threadcreate 2 threadcreate 3 threadcreate 4 threadadd msg cb msgid = 3
启动 Lars dns
$ ./run_lars dns▄▄████ ▄█████▄ ██▄████ ▄▄█████▄██ ▀ ▄▄▄██ ██▀ ██▄▄▄▄ ▀██ ▄██▀▀▀██ ██ ▀▀▀▀██▄██▄▄▄▄▄▄ ██▄▄▄███ ██ █▄▄▄▄▄██▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀Load balance And Remote service schedule System_____| __ \| | | |_ __ ___| | | | '_ \/ __|| |__| | | | \__ \|_____/|_| |_|___/ITCAST(https://www.itcast.cn)------------------------------------create 0 threadcreate 1 threadcreate 2 threadcreate 3 threadcreate 4 threadadd msg cb msgid = 1lars 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 CmdIDUsage ./run_lars test getroute ModID CmdIDUsage ./run_lars test report ModID CmdID IP Port 0|1 --- 0:SUCC, 1:OVERLOADUsage ./run_lars test simulator ModID CmdID [errRate(0-10)] [queryCnt(0-999999)]Usage ./run_lars test qps ThreadNumUsage ./run_lars test example ModID CmdID
