报错环境:
CDH中集成的hive服务,启动报错,所以初始化一下元数据。
配置文件:/etc/hive/conf hive-site.xml
命令目录:/opt/cloudera/parcels/CDH-5.15.1-1.cdh5.15.1.p0.4/lib/hive/bin
报错现象:
执行以下命令的时候报错:
./schematool -dbType mysql -initSchema
[root@master bin]# ./schematool -dbType mysql -initSchema
Java HotSpot(TM) -Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/java/jdk1..0_191/bin:/root/bin)
Java HotSpot(TM) -Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Metastore connection URL: jdbc:mysql://192.168.52.26:3306/hive
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: APP
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
*** schemaTool failed ***
解决方法:
在hive-site.xml文件中添加以下内容
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.52.26:3306/hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>root</value>
</property>
保存之后重新执行命令。