项目场景:
CDH集群CM切换hive元数据库报错:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)at java.lang.reflect.Constructor.newInstance(Constructor.java:423)at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)at com.mysql.jdbc.Util.getInstance(Util.java:386)at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
Caused by: java.lang.NullPointerExceptionat com.mysql.jdbc.ConnectionImpl.getServerCharacterEncoding(ConnectionImpl.java:3281)at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1940)at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1866)at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1252)at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2488)at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2521)
问题描述
hive元数据库进行mysql元数据库切换报错,原因很简单,是切换后的数据库版本和原数据版本不一致,主要记录一下分析过程
原因分析:
寻找启动hive metastore脚本位置:
cd /opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554
vim ./lib/hive/bin/ext/metastore.sh
根据脚本,metastore服务是采用hadoop jar
命令启动,通过设置HADOOP_CLIENT_OPTS
,修改提交应用程序的jvm参数:
export HADOOP_CLIENT_OPTS="-agentlib:jdwp=transport=dt_socket,address=18787,server=y,suspend=n"
在idea上配置remote debug即可远程调试程序