开发者社区> 问答> 正文

E-MapReduce 集群运维指南是什么?



E-MapReduce集群运维指南


本篇主要旨在说明EMR集群的一些运维的手段,方便大家在使用的时候可以自主的进行服务的运维。

一些通用的环境变量


在集群上,输入env命令可以看到类似如下的环境变量配置(以集群上最新的配置为准,此处只做参考):

  1. [backcolor=transparent]JAVA_HOME[backcolor=transparent]=[backcolor=transparent]/usr/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]jvm[backcolor=transparent]/[backcolor=transparent]java
  2. [backcolor=transparent]HADOOP_HOME[backcolor=transparent]=[backcolor=transparent]/usr/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current
  3. [backcolor=transparent]HADOOP_CLASSPATH[backcolor=transparent]=[backcolor=transparent]/usr/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/*:/usr/lib/tez-current/*:/usr/lib/tez-current/lib/*:/etc/emr/tez-conf:/usr/lib/hbase-current/lib/*:/usr/lib/tez-current/*:/usr/lib/tez-current/lib/*:/etc/emr/tez-conf:/opt/apps/extra-jars/*:/opt/apps/extra-jars/*
  4. [backcolor=transparent]HADOOP_CONF_DIR=/etc/emr/hadoop-conf
  5. [backcolor=transparent]SPARK_HOME=/usr/lib/spark-current
  6. [backcolor=transparent]SPARK_CONF_DIR=/etc/emr/spark-conf
  7. [backcolor=transparent]HBASE_HOME=/usr/lib/hbase-current
  8. [backcolor=transparent]HBASE_CONF_DIR=/etc/emr/hbase-conf
  9. [backcolor=transparent]HIVE_HOME=/usr/lib/hive-current
  10. [backcolor=transparent]HIVE_CONF_DIR=/etc/emr/hive-conf
  11. [backcolor=transparent]PIG_HOME=/usr/lib/pig-current
  12. [backcolor=transparent]PIG_CONF_DIR=/etc/emr/pig-conf
  13. [backcolor=transparent]TEZ_HOME=/usr/lib/tez-current
  14. [backcolor=transparent]TEZ_CONF_DIR=/etc/emr/tez-conf
  15. [backcolor=transparent]ZEPPELIN_HOME=/usr/lib/zeppelin-current
  16. [backcolor=transparent]ZEPPELIN_CONF_DIR=/etc/emr/zeppelin-conf
  17. [backcolor=transparent]HUE_HOME=/usr/lib/hue-current
  18. [backcolor=transparent]HUE_CONF_DIR=/etc/emr/hue-conf
  19. [backcolor=transparent]PRESTO_HOME=/usr/lib/presto-current
  20. [backcolor=transparent]PRESTO_CONF_DIR=/etc/emr/presot-conf


服务进程的启停



YARN


[backcolor=transparent]操作用账号:hadoop
  • ResourceManager (Master节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]yarn[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh start resourcemanager
    3. [backcolor=transparent]// 停止
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]yarn[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop resourcemanager
  • NodeManager (Core节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]yarn[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh start nodemanager
    3. [backcolor=transparent]// 停止
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]yarn[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop nodemanager
  • JobHistoryServer (Master节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]mr[backcolor=transparent]-[backcolor=transparent]jobhistory[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh start historyserver
    3. [backcolor=transparent]// 停止
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]mr[backcolor=transparent]-[backcolor=transparent]jobhistory[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop historyserver
  • WebProxyServer (Master节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]yarn[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh start proxyserver
    3. [backcolor=transparent]// 停止
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]yarn[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop proxyserver


HDFS


[backcolor=transparent]操作用账号:hdfs
  • NameNode (Master节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh start namenode
    3. [backcolor=transparent]// 停止
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop namenode

  • DataNode (Core节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh start datanode
    3. [backcolor=transparent]// 停止
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop datanode


    Hive


    [backcolor=transparent]操作用账号:hadoop

  • MetaStore (Master节点)
    1. [backcolor=transparent] // 启动,这里的内存可以根据需要扩大
    2. [backcolor=transparent]HADOOP_HEAPSIZE[backcolor=transparent]=[backcolor=transparent]512[backcolor=transparent] [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hive[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hive [backcolor=transparent]--[backcolor=transparent]service metastore [backcolor=transparent]>[backcolor=transparent]/var/[backcolor=transparent]log[backcolor=transparent]/[backcolor=transparent]hive[backcolor=transparent]/[backcolor=transparent]metastore[backcolor=transparent].[backcolor=transparent]log [backcolor=transparent]2[backcolor=transparent]>&[backcolor=transparent]1[backcolor=transparent] [backcolor=transparent]&
  • HiveServer2 (Master节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]HADOOP_HEAPSIZE[backcolor=transparent]=[backcolor=transparent]512[backcolor=transparent] [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hive[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hive [backcolor=transparent]--[backcolor=transparent]service hiveserver2 [backcolor=transparent]>[backcolor=transparent]/var/[backcolor=transparent]log[backcolor=transparent]/[backcolor=transparent]hive[backcolor=transparent]/[backcolor=transparent]hiveserver2[backcolor=transparent].[backcolor=transparent]log [backcolor=transparent]2[backcolor=transparent]>&[backcolor=transparent]1[backcolor=transparent] [backcolor=transparent]&


HBase


[backcolor=transparent]操作用账号:hdfs
需要注意的,需要在组件中选择了HBase以后才能使用如下的方式来启动,否则对应的配置未完成,启动的时候会有错误。
  • HMaster (Master节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh start master
    3. [backcolor=transparent]// 重启
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh restart master
    5. [backcolor=transparent]// 停止
    6. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop master
  • HRegionServer (Core节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]curren[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh start regionserver
    3. [backcolor=transparent]// 重启
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]curren[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh restart regionserver
    5. [backcolor=transparent]// 停止
    6. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]curren[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop regionserver
  • ThriftServer (Master节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh start thrift [backcolor=transparent]-[backcolor=transparent]p [backcolor=transparent]9099[backcolor=transparent] [backcolor=transparent]>[backcolor=transparent]/var/[backcolor=transparent]log[backcolor=transparent]/[backcolor=transparent]hive[backcolor=transparent]/[backcolor=transparent]thriftserver[backcolor=transparent].[backcolor=transparent]log [backcolor=transparent]2[backcolor=transparent]>&[backcolor=transparent]1[backcolor=transparent] [backcolor=transparent]&
    3. [backcolor=transparent]// 停止
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]hbase[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop thrift


Hue


[backcolor=transparent]操作用账号:hadoop
  1. [backcolor=transparent]// 启动
  2. [backcolor=transparent]su [backcolor=transparent]-[backcolor=transparent]l root [backcolor=transparent]-[backcolor=transparent]c [backcolor=transparent]"${HUE_HOME}/build/env/bin/supervisor >/dev/null 2>&1 &"
  3. [backcolor=transparent]// 停止
  4. [backcolor=transparent]ps axu [backcolor=transparent]|[backcolor=transparent] grep hue     [backcolor=transparent]// 查找到所有的hue进程
  5. [backcolor=transparent]kill [backcolor=transparent]-[backcolor=transparent]9[backcolor=transparent] huepid        [backcolor=transparent]// 杀掉查找到的对应hue进程


Zeppelin


[backcolor=transparent]操作用账号:hadoop
  1. [backcolor=transparent]// 启动, 这里的内存可以根据需要扩大
  2. [backcolor=transparent]su [backcolor=transparent]-[backcolor=transparent]l root [backcolor=transparent]-[backcolor=transparent]c [backcolor=transparent]"ZEPPELIN_MEM=\"-Xmx512m -Xms512m\" ${ZEPPELIN_HOME}/bin/zeppelin-daemon.sh start"
  3. [backcolor=transparent]// 停止
  4. [backcolor=transparent]su [backcolor=transparent]-[backcolor=transparent]l root [backcolor=transparent]-[backcolor=transparent]c [backcolor=transparent]"${ZEPPELIN_HOME}/bin/zeppelin-daemon.sh stop"


Presto


[backcolor=transparent]操作用账号:hdfs
  • PrestoServer (Master节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]presto[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]//bin/launcher --config=/usr/lib/presto-current/etc/worker-config.properties start
    3. [backcolor=transparent]// 停止
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]presto[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]//bin/launcher --config=/usr/lib/presto-current/etc/worker-config.properties stop
  • (Core节点)
    1. [backcolor=transparent] // 启动
    2. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]presto[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]//bin/launcher --config=/usr/lib/presto-current/etc/coordinator-config.properties start
    3. [backcolor=transparent]// 停止
    4. [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]presto[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]//bin/launcher --config=/usr/lib/presto-current/etc/coordinator-config.properties stop


批量操作


当需要对worker(Core)节点做统一操作时,可以写脚本命令,一键轻松解决。在EMR集群中,master到所有worker节点在hadoop和hdfs账号下是ssh打通的。
例如,需要对所有worker节点的nodemanager做停止操作,假设有10个worker节点,则可以这样做:
  1. [backcolor=transparent]  [backcolor=transparent]for[backcolor=transparent] i [backcolor=transparent]in[backcolor=transparent] [backcolor=transparent]`seq 1 10`[backcolor=transparent];[backcolor=transparent]do[backcolor=transparent] ssh emr[backcolor=transparent]-[backcolor=transparent]worker[backcolor=transparent]-[backcolor=transparent]$i [backcolor=transparent]/[backcolor=transparent]usr[backcolor=transparent]/[backcolor=transparent]lib[backcolor=transparent]/[backcolor=transparent]hadoop[backcolor=transparent]-[backcolor=transparent]current[backcolor=transparent]/[backcolor=transparent]sbin[backcolor=transparent]/[backcolor=transparent]yarn[backcolor=transparent]-[backcolor=transparent]daemon[backcolor=transparent].[backcolor=transparent]sh stop nodemanager[backcolor=transparent];[backcolor=transparent]done

展开
收起
nicenelly 2017-10-27 16:21:00 1768 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
企业运维之云原生和Kubernetes 实战 立即下载
可视化架构运维实践 立即下载
2021云上架构与运维峰会演讲合集 立即下载