概述
The Agent is started by init.d at start-up. It, in turn, contacts the Cloudera Manager Server and determines which processes should be running. The Agent is monitored as part of Cloudera Manager's host monitoring. If the Agent stops heartbeating, the host is marked as having bad health.
One of the Agent's main responsibilities is to start and stop processes. When the Agent detects a new process from the Server heartbeat, the Agent creates a directory for it in /var/run/cloudera-scm-agent and unpacks the configuration. It then contacts supervisord, which starts the process.
1 生成配置文件目录
[25/May/2019 16:16:36 +0000] 27716 MainThread agent INFO Created /opt/cloudera-manager/cm-5.16.1/run/cloudera -scm-agent/process/333-kudu-KUDU_TSERVER [25/May/2019 16:16:36 +0000] 27716 MainThread agent INFO Chowning /opt/cloudera-manager/cm-5.16.1/run/clouder a-scm-agent/process/333-kudu-KUDU_TSERVER to kudu (982) kudu (978) [25/May/2019 16:16:36 +0000] 27716 MainThread agent INFO Chmod'ing /opt/cloudera-manager/cm-5.16.1/run/cloude ra-scm-agent/process/333-kudu-KUDU_TSERVER to 0751 [25/May/2019 16:16:36 +0000] 27716 MainThread agent INFO Created /opt/cloudera-manager/cm-5.16.1/run/cloudera -scm-agent/process/333-kudu-KUDU_TSERVER/logs [25/May/2019 16:16:36 +0000] 27716 MainThread agent INFO Chowning /opt/cloudera-manager/cm-5.16.1/run/clouder a-scm-agent/process/333-kudu-KUDU_TSERVER/logs to kudu (982) kudu (978) [25/May/2019 16:16:36 +0000] 27716 MainThread agent INFO Chmod'ing /opt/cloudera-manager/cm-5.16.1/run/cloude ra-scm-agent/process/333-kudu-KUDU_TSERVER/logs to 0751 [25/May/2019 16:16:36 +0000] 27716 MainThread process INFO [333-kudu-KUDU_TSERVER] Refreshing process files: No ne [25/May/2019 16:16:36 +0000] 27716 MainThread __init__ INFO Extracted 9 files and 0 dirs to /opt/cloudera-manage r/cm-5.16.1/run/cloudera-scm-agent/process/333-kudu-KUDU_TSERVER. [25/May/2019 16:16:36 +0000] 27716 MainThread process INFO reading limits: {u'limit_memlock': None, u'limit_fds ': None} [25/May/2019 16:16:36 +0000] 27716 MainThread process INFO [333-kudu-KUDU_TSERVER] Launching process. one-off F alse, command csd/csd.sh, args [u'tserver']
目录:
/opt/cloudera-manager/cm-5.16.1/run/cloudera-scm-agent/process/$index_component_config
配置目录中有proc.json文件包含进程的详细信息,包括启动命令和参数等;
python代码目录
/opt/cloudera-manager/cm-5.16.1/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.16.1-py2.7.egg/cmf/
agent.py
process.pywrite_configuration
2 设置环境变量
CONF_DIR=/opt/cloudera-manager/cm-5.16.1/run/cloudera-scm-agent/process/341-hdfs-DATANODE
CMF_CONF_DIR=/opt/cloudera-manager/cm-5.16.1/etc/cloudera-scm-agent/opt/cloudera/parcels/CDH-5.16.1-1.cdh5.16.1.p0.3/meta/cdh_env.sh
3 启动
/opt/cloudera/parcels/CDH-5.16.1-1.cdh5.16.1.p0.3/lib/hadoop-hdfs/bin/hdfs --config /opt/cloudera-manager/cm-5.16.1/run/cloudera-scm-agent/process/341-hdfs-DATANODE datanode
4 其他
agent uuid目录
/opt/cloudera-manager/cm-5.16.1/lib/cloudera-scm-agent/
参考:
https://www.cloudera.com/documentation/enterprise/5-6-x/topics/admin_cloudera_manager_agents.html