其他分享
首页 > 其他分享> > Schema initialization FAILED! Metastore state would be inconsistent

Schema initialization FAILED! Metastore state would be inconsistent

作者:互联网

一、出现的问题

执行hive初始化源数据库出现问题

schematool -initSchema -dbType mysql -verbose

然后报错
Schema initialization FAILED! Metastore state would be inconsistent

二、解决方法

1、先删除多出来的2个文件/文件夹

有个d***.log(刚才忘了记录一下,忘了叫啥名),
rm -rf metastore_db

2、看一下数据库里面的metastore数据库

应该是没有表的,如果有,就删了metastore重建

3、确认一下hive-site.xml

看看这个文件有没有出错,可能只是多个符号,或者配置的名字打错了,
细心确认

附上我的hive-site.xml,
(1)连接地址写上你自己的节点和数据库,
(2)修改用户名和密码
(3)修改目录,端口等。。。

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://Master:3306/metastore?useSSL=false</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>******</value>
    </property>

    <property>
        <name>hive.metastore.warehouse.dir</name>
        <value>/user/hive/warehouse</value>
    </property>

    <property>
        <name>hive.metastore.schema.verification</name>
        <value>false</value>
    </property>

    <property>
        <name>hive.metastore.uris</name>
        <value>thrift://Master:9083</value>
    </property>

    <property>
    <name>hive.server2.thrift.port</name>
    <value>10000</value>
    </property>

    <property>
        <name>hive.server2.thrift.bind.host</name>
        <value>Master</value>
    </property>

    <property>
        <name>hive.metastore.event.db.notification.api.auth</name>
        <value>false</value>
    </property>
    
    <property>
        <name>hive.cli.print.header</name>
        <value>true</value>
    </property>

    <property>
        <name>hive.cli.print.current.db</name>
        <value>true</value>
    </property>

    <!--Spark依赖位置-->
  <property>
    <name>spark.yarn.jars</name>
    <value>hdfs://Master:8020/spark-jars/*</value>
  </property>
  
  <!--Hive执行引擎-->
  <property>
    <name>hive.execution.engine</name>
    <value>spark</value>
  </property>
</configuration>

标签:jdo,option,would,initialization,hive,FAILED,metastore,Master,javax
来源: https://blog.csdn.net/qq_42672132/article/details/119909197