我们提供一个启动lars系统子系统和测试工具的一个脚本工具,run_lars

    Lars/run_lars

    1. #!/bin/bash
    2. LARS_REPORTER_PATH="./lars_reporter"
    3. LARS_DNS_PATH="./lars_dns"
    4. LARS_LBAGENT_PATH="./lars_loadbalance_agent"
    5. LARS_WEB_PATH="./larsWeb"
    6. LARS_API_EXAMPLE_PATH="./api/cpp/example"
    7. usage()
    8. {
    9. echo ""
    10. echo "=======启动子系统=========="
    11. echo "Usage ./run_lars [reporter|dns|lbagent|web|test]"
    12. echo
    13. echo "=======测试工具============"
    14. echo "Usage ./run_lars test gethost ModID CmdID"
    15. echo "Usage ./run_lars test getroute ModID CmdID"
    16. echo "Usage ./run_lars test report ModID CmdID IP Port 0|1 --- 0:SUCC, 1:OVERLOAD"
    17. echo "Usage ./run_lars test simulator ModID CmdID [errRate(0-10)] [queryCnt(0-999999)]"
    18. echo "Usage ./run_lars test qps ThreadNum"
    19. echo "Usage ./run_lars test example ModID CmdID"
    20. echo
    21. }
    22. if [ "$1" = "test" ]; then
    23. if [ "$2" = "gethost" ]; then
    24. $PWD/$LARS_API_EXAMPLE_PATH/get_host $3 $4
    25. elif [ "$2" = "getroute" ]; then
    26. $PWD/$LARS_API_EXAMPLE_PATH/get_route $3 $4
    27. elif [ "$2" = "report" ]; then
    28. $PWD/$LARS_API_EXAMPLE_PATH/report $3 $4 $5 $6 $7
    29. elif [ "$2" = "example" ]; then
    30. $PWD/$LARS_API_EXAMPLE_PATH/example $3 $4
    31. elif [ "$2" = "simulator" ]; then
    32. if [ $# -eq 4 ]; then
    33. $PWD/$LARS_API_EXAMPLE_PATH/simulator $3 $4
    34. elif [ $# -eq 5 ]; then
    35. $PWD/$LARS_API_EXAMPLE_PATH/simulator $3 $4 $5
    36. elif [ $# -eq 6 ]; then
    37. $PWD/$LARS_API_EXAMPLE_PATH/simulator $3 $4 $5 $6
    38. else
    39. usage
    40. fi
    41. elif [ "$2" = "qps" ]; then
    42. $PWD/$LARS_API_EXAMPLE_PATH/qps $3
    43. fi
    44. elif [ "$1" = "reporter" ]; then
    45. cd $LARS_REPORTER_PATH
    46. ./bin/lars_reporter
    47. elif [ "$1" = "dns" ]; then
    48. cd $LARS_DNS_PATH
    49. ./bin/lars_dns
    50. elif [ "$1" = "lbagent" ]; then
    51. cd $LARS_LBAGENT_PATH
    52. ./bin/lars_lb_agent
    53. elif [ "$1" = "web" ]; then
    54. cd $LARS_WEB_PATH
    55. ./lars-web
    56. elif [ "$1" = "help" ]; then
    57. usage
    58. else
    59. usage
    60. fi

    启动 Lars Reporter

    1. $ ./run_lars reporter
    2. ▄▄
    3. ██
    4. ██ ▄█████▄ ██▄████ ▄▄█████▄
    5. ██ ▄▄▄██ ██▀ ██▄▄▄▄
    6. ██ ▄██▀▀▀██ ██ ▀▀▀▀██▄
    7. ██▄▄▄▄▄▄ ██▄▄▄███ ██ █▄▄▄▄▄██
    8. ▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀
    9. Load balance And Remote service schedule System
    10. _____ _
    11. | __ \ | |
    12. | |__) |___ _ __ ___ _ __| |_ ___ _ __
    13. | _ // _ \ '_ \ / _ \| '__| __/ _ \ '__|
    14. | | \ \ __/ |_) | (_) | | | || __/ |
    15. |_| \_\___| .__/ \___/|_| \__\___|_|
    16. | |
    17. |_|
    18. ITCAST(https://www.itcast.cn)
    19. ------------------------------------
    20. create 0 thread
    21. create 1 thread
    22. create 2 thread
    23. create 3 thread
    24. create 4 thread
    25. add msg cb msgid = 3

    启动 Lars dns

    1. $ ./run_lars dns
    2. ▄▄
    3. ██
    4. ██ ▄█████▄ ██▄████ ▄▄█████▄
    5. ██ ▄▄▄██ ██▀ ██▄▄▄▄
    6. ██ ▄██▀▀▀██ ██ ▀▀▀▀██▄
    7. ██▄▄▄▄▄▄ ██▄▄▄███ ██ █▄▄▄▄▄██
    8. ▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀
    9. Load balance And Remote service schedule System
    10. _____
    11. | __ \
    12. | | | |_ __ ___
    13. | | | | '_ \/ __|
    14. | |__| | | | \__ \
    15. |_____/|_| |_|___/
    16. ITCAST(https://www.itcast.cn)
    17. ------------------------------------
    18. create 0 thread
    19. create 1 thread
    20. create 2 thread
    21. create 3 thread
    22. create 4 thread
    23. add msg cb msgid = 1
    24. lars dns service ....
    25. now route version is 1574674421

    启动 Lars Lb Agent

    1. $ ./run_lars lbagent
    2. ▄▄
    3. ██
    4. ██ ▄█████▄ ██▄████ ▄▄█████▄
    5. ██ ▄▄▄██ ██▀ ██▄▄▄▄
    6. ██ ▄██▀▀▀██ ██ ▀▀▀▀██▄
    7. ██▄▄▄▄▄▄ ██▄▄▄███ ██ █▄▄▄▄▄██
    8. ▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀
    9. Load balance And Remote service schedule System
    10. _ _ _
    11. | | | | /\ | |
    12. | | | |__ / \ __ _ ___ _ __ | |_
    13. | | | '_ \ / /\ \ / _` |/ _ \ '_ \| __|
    14. | |____| |_) | / ____ \ (_| | __/ | | | |_
    15. |______|_.__/ /_/ \_\__, |\___|_| |_|\__|
    16. __/ |
    17. |___/
    18. ITCAST(https://www.itcast.cn)
    19. ------------------------------------

    其他测试工具启动方式

    1. $ ./run_lars help
    2. =======启动子系统==========
    3. Usage ./run_lars [reporter|dns|lbagent|web|test]
    4. =======测试工具============
    5. Usage ./run_lars test gethost ModID CmdID
    6. Usage ./run_lars test getroute ModID CmdID
    7. Usage ./run_lars test report ModID CmdID IP Port 0|1 --- 0:SUCC, 1:OVERLOAD
    8. Usage ./run_lars test simulator ModID CmdID [errRate(0-10)] [queryCnt(0-999999)]
    9. Usage ./run_lars test qps ThreadNum
    10. Usage ./run_lars test example ModID CmdID