hive实例化schema报错: Failed to get schema version.

具体报错:

Metastore connection URL:     jdbc:mysql://hm02:3306/hive?createDatabaseIfNotExist=true
Metastore Connection Driver :     com.mysql.cj.jdbc.Driver
Metastore connection User:     hive
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
Underlying cause: com.mysql.cj.jdbc.exceptions.CommunicationsException : Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
SQL Error code: 0
Use --verbose for detailed stacktrace.
*** schemaTool failed ***

hive实例化schema报错: Failed to get schema version._第1张图片

原因及解决方案: 

说来惭愧,自己都想打自己(这个问题困扰了我一整天),出错是因为我跟着别人的教程配置,在配置hive/conf/hive-site.xml的时候,javax.jdo.option.ConnectionURL没有改成自己的,用的别人的所以报错:

解决方案:

注意:下面标红的位置要特别注意用自己的

修改hive配置文件: hive/conf/hive-site.xml:


     
        javax.jdo.option.ConnectionURL
        jdbc:mysql://192.168..129.105:3306/hive?createDatabaseIfNotExist=true  
    

    
        javax.jdo.option.ConnectionDriverName
        com.mysql.cj.jdbc.Driver
    

    
        javax.jdo.option.ConnectionUserName
        hive   
    

    
        javax.jdo.option.ConnectionPassword
        123456 
    

   
        hive.metastore.schema.verification
        false
    

 

如果还是不行,应该是对应用户没有授权:

注释掉  /etc/mysql/mysql.conf.d/mysqld.cnf   里面的这一句    bind-address    = 127.0.0.1 

hive实例化schema报错: Failed to get schema version._第2张图片

登录mysql:   mysql -u root -p

use mysql;

GRANT ALL ON *.* to 'hive'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 

flush privileges;

quit;

重启mysql: sudo service mysql restart

hive实例化schema报错: Failed to get schema version._第3张图片

重新实例化成功: ./schematool -dbType mysql -initSchema

hive实例化schema报错: Failed to get schema version._第4张图片

 

 

 

 

你可能感兴趣的:(安装搭建)