快速入手danny的工作:
ambari之elasticsearch进展
-
✔ 初步完成ambari自动化部署elasticsearch的开发;
- ? 还未完善情况
- 目前使用的采集脚本
elasticsearch-monitor.py
适用的情况是:在ambari server那台主机上必须安装es_master,但是这种方式是不正确的,实际生产环境ambari server是不能安装任何其他服务的。参考的方案是:ambari server启动跟着启动 python脚本 - ambari+spark+alluxio目前还没有调试性能
- ambari之redis集群版还没有开发
安装tips
-
- ?如果安装过程中失败,请删除相应的工作目录,再重启ambari server,然后再重新安装
-
删除目录:
## 在执行安装操作的机器上都执行 ##安装es失败的操作: rm -rf /var/lib/ambari-agent/cache/stacks/HDP/2.5/services/ELASTICSEARCH rm -rf /opt/es ## 安装redis集群版失败的操作: rm -rf /var/lib/ambari-agent/cache/stacks/HDP/2.5/services/REDIS rm -rf /opt/redis/ rm -rf /data/redis ## 安装opentsdb失败后的操作: rm -rf /var/lib/ambari-agent/cache/stacks/HDP/2.5/services/OPENTSDB rm -rf /data/opentsdb-2.3.1/
-
重启ambari server:
ambari-server restart
-
- ?如果查看我的代码发现理解不了我的代码逻辑(重点是master.py / server.py),请查看安防提供的es集群版和redis集群版安装文档,我的代码主要是将安防提供的安装文档使用脚本自动化部署了
-
- 关于使用ambari后台调用
elasticsearch-monitor.py
无法正常运行的问题
while True: try: ## 获取es每个结点的id get_node_id_url = 'http://%s:9200/_cat/fielddata' % (ambari_server_ip) get_node_id_result = requests.get(get_node_id_url) id_node = get_node_id_result.text.replace("\n", "") break except: pass
由于一开始并没有使用
try - except
,但是后来定位到这个地方的错误发现get_node_id_result = requests.get(get_node_id_url)
的输出时前几次的请求失败,接下来的请求成功。目前归结的原因应该是python 后台调用request请求时前几次不稳定导致的
,与之鲜明对比的是pycharm执行该脚本却能够运行正常。 所以请在这个地方加上
try - except
- 关于使用ambari后台调用
-
- 关于开发ambari自定义组件时,可能会需要知道安装的组件的结点,下面是clusterinfo里面的数据,描述了安装的组件的每个IP
{ usnamenode_host: [uhdp12.pci.com], unm_hosts: [uhdp12.pci.com, uhdp11.pci.com, uhdp13.pci.com], umetrics_collector_hosts: [uhdp11.pci.com], uhive_metastore_host: [uhdp11.pci.com], uall_ping_ports: [u8670, u8670, u8670], uredis_master_hosts: [uhdp11.pci.com], uall_hosts: [uhdp12.pci.com, uhdp11.pci.com, uhdp13.pci.com], urm_host: [uhdp12.pci.com], ukafka_broker_hosts: [uhdp12.pci.com, uhdp11.pci.com, uhdp13.pci.com], uslave_hosts: [uhdp12.pci.com, uhdp11.pci.com, uhdp13.pci.com], uredis_slave_hosts: [uhdp12.pci.com, uhdp11.pci.com], umetrics_monitor_hosts: [uhdp12.pci.com, uhdp11.pci.com, uhdp13.pci.com], uall_racks: [u/default-rack, u/default-rack, u/default-rack], uall_ipv4_ips: [u10.36.100.12, u10.36.100.11, u10.36.100.13], uapp_timeline_server_hosts: [uhdp12.pci.com], uhs_host: [uhdp12.pci.com], uhive_server_host: [uhdp12.pci.com], uspark_worker_hosts: [uhdp12.pci.com, uhdp11.pci.com, uhdp13.pci.com], umetrics_grafana_hosts: [uhdp11.pci.com], uambari_server_port: [u8080], ukafka_manager_hosts: [uhdp11.pci.com], uambari_server_use_ssl: [ufalse], uwebhcat_server_host: [uhdp12.pci.com], unamenode_host: [uhdp11.pci.com], uspark_master_hosts: [uhdp12.pci.com, uhdp11.pci.com], uambari_server_host: [uhdp11.pci.com], uzookeeper_hosts: [uhdp12.pci.com, uhdp11.pci.com, uhdp13.pci.com], uspark_thrift_server_hosts: [uhdp12.pci.com, uhdp13.pci.com] }
想要在master.py/slave.py使用这些参数时,只需执行一下命令获取结点信息
config = Script.get_config() ## 获取ambari-server的结点 ambari_server_hostname = config['clusterHostInfo']['ambari_server_host'][0]