????????????????????????????·
???????????? ???????[ 2013/1/4 10:34:53 ] ????????
????????????????????????????д?????Python??????????????????Щ?????????????????????????
1.import subprocess
2.from mako.template import Template
3.import yaml
4.
5.# ???????????????
6.def runTask(config?? task):
7. runAbench(config?? task)
8.
9.def runAbench(config?? task):
10. # ???????abench????????
11. command = Template(config["abenchCommand"]).render(
12. abenchPath=config["abenchPath"]??
13. parallelNum=task["parallelNum"]??
14. seconds=task["seconds"]??
15. targetHost=task["targetHost"]??
16. targetPort=task["targetPort"]??
17. queryFilePath=task["queryFilePath"]??
18. )
19. pipe = subprocess.Popen(command??
20. stdin=subprocess.PIPE??
21. stdout=subprocess.PIPE??
22. stderr=subprocess.PIPE??
23. shell=True
24. )
25. # ???abench?????н?????????????????????
26. result = pipe.stdout.read()
27. # ??????????????????
28.
29.if __name__ == "__main__":
30. config = yaml.load(file(configFile))
31. for task in config["tasks"]:
32. runTask(config?? task)
??????????2??????
??????????????????У????????μ????????????????????????10??????????????????????/?????????????????????????????·?????Щ???????????????????
?????????????????????????????????task?????????????????????????????Щ????????漰????????????ISearch???????????????????е?Searcher??????2??Searcher???????Merger????????????clustermap??????
1.abenchPath: /opt/usr/bin/abench # abench???????
2.abenchCommand: "${abenchPath} -p ${parallelNum} -s ${seconds} -k --http -o /dev/null ${targetHost} ${targetPort} ${queryFilePath}"
3.# ????Searcher???Щ???????
4.searcher:
5. templateConfigFile: /home/admin/access-log/searcher_server.cfg # ??????????????????????????????????????ж????????????????????????
6. templateLogConfigFile: /home/admin/access-log/searcher_log.cfg
7. # ??Search???????????????
8. commands:
9. - "${searchRoot}/bin/is_searcher_server -c ${configFile} -l ${logConfigFile} -k stop > /dev/null 2>&1"
10. - "${searchRoot}/bin/is_searcher_server -c ${configFile} -l ${logConfigFile} -k start -d > /dev/null 2>&1"
11.# ????Merger???Щ??????????Searcher??????д??
12.
13.tasks:
14. # ???????????????????????????????????
15. -
16. id: 1 # ID???????????????п?????id????????????
17. parallelNum: 1 # ??????
18. seconds: 1800 # ????С?
19. targetHost: 10.20.137.22 # ???????
20. targetPort: 9999
21. queryFilePath: /home/admin/access-log/add-600w.query # ??????????
22.
23. # ???Search?????????????List
24. searchers:
25. -
26. host: 10.20.150.61
27. port: 6322 # ????????
28. username: test # ?????????sshЭ?????????????????????????????????????????ssh????????????????
29. password: 12345
30. configFile: "${searchRoot}/scripts/conf/searcher_server.cfg" # ???????е????????
31. logConfigFile: "${searchRoot}/scripts/conf/searcher_log.cfg" # ???????е???????
32. -
33. host: 10.20.150.60
34. port: 6322
35. username: test
36. password: 12345
37. configFile: "${searchRoot}/scripts/conf/searcher_server.cfg"
38. logConfigFile: "${searchRoot}/scripts/conf/searcher_log.cfg"
39.
40. # ??????????merger?????merger????ж???????????????????????List
41. merger:
42. host: 10.20.137.22
43. port: 6088
44. username: test
45. password: 12345
46. configFile: "${searchRoot}/scripts/conf/merger_server.cfg"
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11