“Hive metadata problem” hive.metastore.HiveMetaException : Failed to get schema version.

raini@biyuzhe:~$ schematool -dbType mysql -initSchema
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found the binding in [the jar: file:/home/raini/app/apache – hive – 2.1.1 – bin/lib/log4j – slf4j – impl – against 2.4.1. Jar!/org/slf4j/impl/StaticLoggerBinder class]
slf4j: Found the binding in [the jar: file:/home/raini/app/hadoop – 2.8.0/share/hadoop/common/lib/slf4j – log4j12-1.7.10. Jar!/org/slf4j/impl/StaticLoggerBinder class]
slf4j: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL: jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true& UseSSL =false
Metastore Connection Driver : com.mysql. JDBC.Driver
Connection User: hive
Starting Metastore schema initialization to 2.1.0
Initialization script hive – schema – 2.1.0. Mysql.
SQL Initialization script completed
org.. Apache hadoop. Hive. Metastore. HiveMetaException: Failed to get the schema version.
physicist cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException : Table ‘hive.VERSION’ doesn’t exist
SQL Error code: 1146
Use –verbose for detailed stacktrace.
*** schemaTool failed ***


problem above, after installing hive 2.1.1, formatting was not successful, and did not find metastore (using mysql, but still fine before upgrade)


reason:

previously used hive 1.2.1, mysql connection metastore use user user is hive, may metadata deletion is not clean or some configuration file cannot be deleted,


solution:

USES another user.

mysql> create user 'hive1'@'%' identified by 'hive1';
mysql> grant all on *.* to 'hive1'@localhost identified by 'hive1';
mysql> flush privileges;

and modify: XML hive – site.

< property>
& lt; name> javax.jdo.option.ConnectionUserName< /name>
& lt; value> hive1< /value>
& lt; /property>

& lt; property>
& lt; name> javax.jdo.option.ConnectionPassword< /name>
& lt; value> hive1< /value>
& lt; /property>



this is the step required for hive2.0.

mysql> The SOURCE/home/raini/app/hive/scripts/metastore/upgrade/mysql/hive – schema – 2.1.0. Mysql. SQL;

start hive to fix ~

question 2:

hive (default)> create database anserchapp;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Got exception: java.io.IOException Failed on local exception: java.io.IOException: Couldn’t set up IO streams; Host Details: Local Host is: “biyuzhe/127.0.1.1”; destination host is: “user”:8020; )


Settings:

mysql> ALTER DATABASE hive character set latin1;

Query OK, 1 row affected (0.00 SEC)

error:

hive (default)> create database anserchapp;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.lang.IllegalArgumentException: java.net.UnknownHostException: user)

Read More: