hive配置后无法正常启动
解决步骤
1.修改core-site.xml
core-site.xml增加如下内容:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 1<property>
2 <name>hadoop.proxyuser.root.hosts</name>
3 <value>*</value>
4</property>
5<property>
6 <name>hadoop.proxyuser.root.groups</name>
7 <value>*</value>
8</property>
9<property>
10 <name>hadoop.proxyuser.hadoop.hosts</name>
11 <value>*</value>
12</property>
13 <property>
14 <name>hadoop.proxyuser.hadoop.groups</name>
15 <value>*</value>
16</property>
17
18
修改hive/conf目录hive-site.xml增加如下内容:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 1<property>
2 <name>javax.jdo.option.ConnectionURL</name>
3 <value>jdbc:mysql://mini2:3306/hive?createDatabaseIfNotExist=true&useSSL=false</value>
4 <description>JDBC connect string for a JDBC metastore</description>
5</property>
6
7<property>
8 <name>javax.jdo.option.ConnectionDriverName</name>
9 <value>com.mysql.jdbc.Driver</value>
10 <description>Driver class name for a JDBC metastore</description>
11</property>
12
13<property>
14 <name>javax.jdo.option.ConnectionUserName</name>
15 <value>root</value>
16 <description>username to use against metastore database</description>
17</property>
18
19<property>
20 <name>javax.jdo.option.ConnectionPassword</name>
21 <value>123456you</value>
22 <description>password to use against metastore database</description>
23</property>
24<property>
25 <name>hive.server2.thrift.port</name>
26 <value>10000</value>
27 </property>
28<property>
29 <name>hive.server2.thrift.bind.host</name>
30 <value>192.168.62.133</value>
31 </property>
32
33
2、错误
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 1estedThrowablesStackTrace:
2Required table missing : "`DBS`" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"
3org.datanucleus.store.rdbms.exceptions.MissingTableException: Required table missing : "`DBS`" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"
4
5 at org.datanucleus.store.rdbms.table.AbstractTable.exists(AbstractTable.java:606)
6 at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run(RDBMSStoreManager.java:2896)
7 at org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:119)
8 at org.datanucleus.store.rdbms.RDBMSStoreManager.manageClasses(RDBMSStoreManager.java:1627)
9 at org.datanucleus.store.rdbms.RDBMSStoreManager.getDatastoreClass(RDBMSStoreManager.java:672)
10 at org.datanucleus.store.rdbms.RDBMSStoreManager.getPropertiesForGenerator(RDBMSStoreManager.java:2088)
11 at org.datanucleus.store.AbstractStoreManager.getStrategyValue(AbstractStoreManager.java:1271)
12 at org.datanucleus.ExecutionContextImpl.newObjectId(ExecutionContextImpl.java:3760)
13 at org.datanucleus.state.StateManagerImpl.setIdentity(StateManagerImpl.java:2267)
14 at org.datanucleus.state.StateManagerImpl.initialiseForPersistentNew(StateManagerImpl.java:484)
15 at org.datanucleus.state.StateManagerImpl.initialiseForPersistentNew(StateManagerImpl.java:120)
16 at org.datanucleus.state.ObjectProviderFactoryImpl.newForPersistentNew(ObjectProviderFactoryImpl.java:218)
17 at org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2079)
18 at org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:1923)
19 at org.datanucleus.ExecutionContextImpl.persistObject(ExecutionContextImpl.java:1778)
20 at org.datanucleus.ExecutionContextThreadedImpl.persistObject(ExecutionContextThreadedImpl.java:217)
21 at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:724)
22 at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:749)
23 at org.apache.hadoop.hive.metastore.ObjectStore.createDatabase(ObjectStore.java:675)
24 at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
25 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
26 at java.lang.reflect.Method.invoke(Method.java:498)
27 at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:101)
28 at com.sun.proxy.$Proxy34.createDatabase(Unknown Source)
29 at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB_core(HiveMetaStore.java:639)
30 at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:659)
31 at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:431)
32 at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
33 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
34 at java.lang.reflect.Method.invoke(Method.java:498)
35 at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:148)
36 at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:107)
37 at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:79)
38 at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:92)
39 at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:6891)
40 at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:164)
41 at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:70)
42 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
43 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
44 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
45 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
46 at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1706)
47 at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:83)
48 at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:133)
49 at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:104)
50 at org.apache.hive.service.cli.CLIService.init(CLIService.java:114)
51 at org.apache.hive.service.server.HiveServer2$StartOptionExecutor.execute(HiveServer2.java:855)
52 at org.apache.hive.service.server.HiveServer2.main(HiveServer2.java:724)
53 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
54 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
55 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
56 at java.lang.reflect.Method.invoke(Method.java:498)
57 at org.apache.hadoop.util.RunJar.run(RunJar.java:239)
58 at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
59
60
在hvie-site.xml中将hive.metastore.schema.verification参数设置为false
1
2
3
4
5
6 1<property>
2 <name>hive.metastore.schema.verification</name>
3 <value>false</value>
4</property>
5
6
3.metastore’s schema version
第二个错误
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 1 at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
2 at org.apache.hadoop.util.RunJar.run(RunJar.java:234) ~[hadoop-common-2.8.0.jar:?]
3 at org.apache.hadoop.util.RunJar.main(RunJar.java:148) ~[hadoop-common-2.8.0.jar:?]
4 Caused by: java.lang.reflect.InvocationTargetException
5 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_144]
6 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_144]
7 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_144]
8 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_144]
9 at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1699) ~[hive-exec-2.3.0.jar:2.3.0]
10 ... 32 more
11Caused by: org.apache.hadoop.hive.metastore.api.MetaException: Hive Schema version 2.3.0 does not match metastore's schema version 1.2.0 Metastore is not upgraded or corrupt
12 at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:83) ~[hive-exec-2.3.0.jar:2.3.0]
13 at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:92) ~[hive-exec-2.3.0.jar:2.3.0]
14 at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:6889) ~[hive-exec-2.3.0.jar:2.3.0]
15 at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:159) ~[hive-exec-2.3.0.jar:2.3.0]
16 at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:70) ~[hive-exec-2.3.0.jar:2.3.0]
17 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_144]
18 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_144]
19 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_144]
20 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_144]
21 at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1699) ~[hive-exec-2.3.0.jar:2.3.0]
22
23
先去mysql上执行
1
2
3
4
5
6 1mysql -h mini1 -u root -p
2SELECT 'Upgrading MetaStore schema from 2.2.0 to 2.3.0' AS MESSAGE;
3use hive
4UPDATE VERSION SET SCHEMA_VERSION='2.3.0', VERSION_COMMENT='Hive release version 2.3.0' where VER_ID=1;
5
6
然后执行 schematool -dbType mysql -initSchema
再执行./hive/bin/hiveserver2