./schematool -dbType mysql -initSchema
jdbc:mysql://hadoop:3306/hive> CREATE TABLE IF NOT EXISTS BUCKETING_COLS ( SD_ID bigint(20) NOT NULL, BUCKET_COL_NAME varchar(256) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL, INTEGER_IDX int(11) NOT NULL, PRIMARY KEY (SD_ID,INTEGER_IDX), KEY BUCKETING_COLS_N49 (SD_ID), CONSTRAINT BUCKETING_COLS_FK1 FOREIGN KEY (SD_ID) REFERENCES SDS (SD_ID) ) ENGINE=InnoDB DEFAULT CHARSET=latin1
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:594)
at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:567)
at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1517)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:323)
at org.apache.hadoop.util.RunJar.main(RunJar.java:236)
Caused by: java.io.IOException: Schema script failed, errorcode 2
at org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:1226)
at org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:1204)
at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:590)
尝试在mysql中修改hive数据库的字符集,alter database hive character set latin1;
修改之后,重新格式化,还是报错?????????
发现错误
Error: Table 'CTLGS' already exists (state=42S01,code=1050) Closing: 0: jdbc:mysql://hadoop:3306/hive?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
删除数据库试下呢?
drop database hive; ?
重新初始化,成功了!
|