schematool -dbType mysql -initSchema 失败

schematool -dbType mysql -initSchema

hadoop@master:~$ schematool -dbType mysql -initSchema
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/hive-2.3.4/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/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://master:3306/hiveDB?createDatabaseIfNotExist=true
Metastore Connection Driver :	 com.mysql.jdbc.Driver
Metastore connection User:	 gyt
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
Underlying cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException : Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
SQL Error code: 0
Use --verbose for detailed stacktrace.
*** schemaTool failed ***

原因:
配置 hive-site.xml 时,

	
		javax.jdo.option.ConnectionURL
       	jdbc:mysql://master:3306/hiveDB?createDatabaseIfNotExist=true
        Hive access metastore using JDBC connectionURL
	

应该改为:

	
		javax.jdo.option.ConnectionURL
        jdbc:mysql://localhost:3306/hiveDB?createDatabaseIfNotExist=true
        Hive access metastore using JDBC connectionURL
	

你可能感兴趣的:(Hive,Hadoop生态圈学习)