SemanticException in Hive Shell Mode

2020-05-06 09:54发布

hive exception

I have installed Hadoop 3.0.0 and Hive 2.3.1 in my PC. Parallely i installed mysql and working with sql commands in sql shell mode and working fine. But While executing queries in Hive shell mode, i am receiving the following error,

hive> create table saurzcode(id int, name string);

FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

Please let me know the reason for failure.

Also please clarify the following queries,

1) Difference between hive shell mode vs mysql shell mode.

2) Why to configure MySql Metastore for Hive?

Please find the hive-site.xml configuration,

<configuration>
<property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://localhost/metastore?createDatabaseIfNotExist=true</value>
</property>

<property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.jdbc.Driver</value>
</property>

<property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>hivelogin</value>
</property>

<property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>apache</value>

</property>
</configuration>

标签: hadoop hive
1条回答
Melony?
2楼-- · 2020-05-06 10:20

Your Original exception is Unable to load authentication plugin 'caching_sha2_password' as you can see in below error log.

org.apache.hadoop.hive.metastore.HiveMetaStore - Retrying creating default database after error: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://localhost/metastore?createDatabaseIfNotExist=true
        , username = hivelogin. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.

Solution: This error happens due to all new MySQL version come up with added password plugin called "caching_sha2_password", and it has to be configured properly at MySQL server or else you can simply use "mysql_native_password" parameter with "CREATE USER" in MySQL as below to get it resolved.

While creating the hive Meta Store user just follow the below command.

CREATE USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL PRIVILEGES ON metastore_db.* TO 'hive'@'%';
查看更多
登录 后发表回答