💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 七、Lars启动工具脚本 我们提供一个启动lars系统子系统和测试工具的一个脚本工具,`run_lars` > Lars/run_lars ```bash #!/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** ```bash $ ./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** ```bash $ ./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** ```c $ ./run_lars lbagent ▄▄ ██ ██ ▄█████▄ ██▄████ ▄▄█████▄ ██ ▀ ▄▄▄██ ██▀ ██▄▄▄▄ ▀ ██ ▄██▀▀▀██ ██ ▀▀▀▀██▄ ██▄▄▄▄▄▄ ██▄▄▄███ ██ █▄▄▄▄▄██ ▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀ Load balance And Remote service schedule System _ _ _ | | | | /\ | | | | | |__ / \ __ _ ___ _ __ | |_ | | | '_ \ / /\ \ / _` |/ _ \ '_ \| __| | |____| |_) | / ____ \ (_| | __/ | | | |_ |______|_.__/ /_/ \_\__, |\___|_| |_|\__| __/ | |___/ ITCAST(https://www.itcast.cn) ------------------------------------ ``` **其他测试工具启动方式** ```bash $ ./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 ``` --- ### 关于作者: 作者:`Aceld(刘丹冰)` mail: [danbing.at@gmail.com](mailto:danbing.at@gmail.com) github: [https://github.com/aceld](https://github.com/aceld) 原创书籍: [https://www.kancloud.cn/@aceld](https://www.kancloud.cn/@aceld) ![](https://img.kancloud.cn/b0/d1/b0d11a21ba62e96aef1c11d5bfff2cf8_227x227.jpg) >**原创声明:未经作者允许请勿转载, 如果转载请注明出处**