Hadoop记录-metastore jmx配置

参考:http://www.lixiuliang.cn/categories/%E5%A4%A7%E6%95%B0%E6%8D%AE/

1.修改bin/hive文件 添加jvm启动参数:

if [ ${SERVICE} == 'metastore' ]
then
HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9093 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
fi

参数说明:
#开启远程jmx
-Dcom.sun.management.jmxremote
#此Java进程的jmx端口为9093
-Dcom.sun.management.jmxremote.port=9093
#不要求SSL连接
-Dcom.sun.management.jmxremote.ssl=false
#不需要用户认证
-Dcom.sun.management.jmxremote.authenticate=false

2.修改conf/hive-site.xml文件 开启MetaStore JXMReporter:

<!-- 开启metastore服务metrics -->
<property>
<name>hive.metastore.metrics.enabled</name>
<value>true</value>
</property>
<!-- 可使用默认值,无需修改 -->
<property>
<name>hive.service.metrics.class</name>
<value>org.apache.hadoop.hive.common.metrics.metrics2.CodahaleMetrics</value>
</property>
<!-- 可使用默认值,无需修改 -->
<property>
<name>hive.service.metrics.reporter</name>
<value>JSON_FILE, JMX</value>
</property>

3.启动MetaStore 并检查是否成功开启

#启动
nohup bin/hive --service metastore >> logs/metadata.log 2>&1 &
netstat -nltp | grep 9093

原文地址:https://www.cnblogs.com/xinfang520/p/10721615.html