raini@biyuzhe:~$ schematool -dbType mysql -initSchema
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/raini/app/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [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 www.slf4j.org/codes.html#… 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
Metastore 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 schema version.
Underlying cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException : Table 'hive.VERSION' doesn't exist
SQL Error code: 1146
Use --verbose for detailed stacktrace.
*** schemaTool failed ***\
\
问题如上,安装hive-2.1.1 后格式化不成功,没有找到 metastore(用的是mysql,升级之前还是好好的)
\
原因:
之前用的hive-1.2.1,mysql连接metastore使用的user用户为hive,可能元数据删除不干净或者有某些配置文件无法删除掉吧,
\
解决:
使用另一个user。
mysql> create user 'hive1'@'%' identified by 'hive1';
mysql> grant all on *.* to 'hive1'@localhost identified by 'hive1';
mysql> flush privileges;
并修改:hive-site.xml
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive1</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive1</value>
</property>
\
这个是hive2.0才需要的步骤吧(执行它)
mysql> SOURCE /home/raini/app/hive/scripts/metastore/upgrade/mysql/hive-schema-2.1.0.mysql.sql;
\
启动hive搞定~
\
\
\
问题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; )\
\
设置:
mysql> ALTER DATABASE hive character set latin1;
Query OK, 1 row affected (0.00 sec)
\
报错:
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)\
\
\