????????????????????????????·
???????????? ???????[ 2013/1/4 10:34:53 ] ????????
?????????????Searcher????????????????????????????????????????????????????
1.se_conf_file=${searchRoot}/scripts/conf/se.conf
2.simon_conf_path=${searchRoot}/scripts/conf/simon_searcher.xml
3.sort_config=${searchRoot}/scripts/conf/searcher_sort.xml
4.cache_size=0
5.cache_min_doc=0
6.conn_queue_limit=500
7.[services]
8.tcp ${port} # ?????????滻?????????????????????????????????????????????????????????????????????ú??????????????????????????
9.
10.[clustermap]
11.local_config_path=${searchRoot}/scripts/conf/clustermap.xml
?????????????searcher??merger???ж??е????????????????????????????Python???
1.# ??????ssh??????client????????????????????????
2.def getClient(host?? port?? username?? password):
3. client = paramiko.SSHClient()
4. client.load_system_host_keys()
5. client.set_missing_host_key_policy(paramiko.WarningPolicy()
6. client.connect(hostname?? port?? username?? password)
7. return client
8.
9.# ??????sftp??????????scp????????????????????????sftp????????put???????????scp
10.def getSftp(host?? port?? username?? password):
11. transport = paramiko.Transport((hostname?? port))
12. transport.connect(username=username?? password=password)
13. sftp = paramiko.SFTPClient.from_transport(transport)
14. return sftp
15.
16.# ???o????Searchers
17.def cleanSearchers(config?? searchers):
18. for searcher in searchers:
19. # ??????????????????????
20. templateLine = Template(file(config["searcher"]["templateConfigFile"]).read()).render(
21. port=searcher["port"]??
22. searchRoot=config["searchRoot"]
23. )
24. # ???????????????д???????????
25. tmpConfigFile = tempfile.NamedTemporaryFile(delete=False)
26. tmpConfigFile.file.write(templateLine)
27. tmpConfigFile.file.close()
28. # ???????????scp??????????????
29. targetConfigFile = Template(searcher["configFile"]).render(searchRoot=config["searchRoot"])
30. sftp = getSftp(searcher["host"]?? 22?? searcher["username"]?? searcher["password"])
31. sftp.put(tmpConfigFile.name?? targetConfigFile)
32. sftp.close()
33. # ???????????????
34. os.remove(tmpConfigFile.name)
35. # ???????searcher??????
36. client = getClient(searcher["host"]?? 22?? searcher["username"]?? searcher["password"])
37. for command in config["searcher"]["commands"]:
38. command = Template(command).render(
39. searchRoot=config["searchRoot"]??
40. configFile=targetConfigFile??
41. logConfigFile=targetLogConfigFile
42. )
43. client.exec_command(cmd)
44. client.close()
??????
???·???
??????????????????
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