Hadoop Hive 初始化元数据 数据库连接错误

Brady.Lan 2019-05-08 07:14:07
执行 schematool -dbType mysql -initSchema 报错

[root@localhost conf]# schematool -dbType mysql -initSchema
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/modules/hive-2.3/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/modules/hadoop-3.2.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.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://172.16.0.11:3306;databaseName=hive_metastore;create=true
Metastore Connection Driver : org.apache.derby.jdbc.EmbeddedDriver
Metastore connection User: root
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
Underlying cause: java.sql.SQLNonTransientConnectionException : Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Failed to parse the host:port pair '172.16.0.11:3306;databaseName=hive_metastore;create=true'.
SQL Error code: 0
Use --verbose for detailed stacktrace.
*** schemaTool failed ***


执行 show databases; 也报错
hive> show databases;
FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Un.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient


执行 ./hive --service metastore 也是报数据库连接错误
Caused by: java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlyingtions.WrongArgumentException: Failed to parse the host:port pair '172.16.0.11:3306;databaseName=hive_metastore
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:361)
at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)
... 54 more
Caused by: com.mysql.cj.exceptions.UnableToConnectException: Cannot load connection class because of underexceptions.WrongArgumentException: Failed to parse the host:port pair '172.16.0.11:3306;databaseName=hive_metastore
at sun.reflect.GeneratedConstructorAccessor16.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.jav
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
... 59 more
Caused by: com.mysql.cj.exceptions.WrongArgumentException: Failed to parse the host:port pair '172.16.0.11ie;create=true'.
at sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.jav
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.conf.ConnectionUrlParser.parseHostPortPair(ConnectionUrlParser.java:502)
at com.mysql.cj.conf.ConnectionUrlParser.buildHostInfoResortingToGenericSyntaxParser(ConnectionUrl
at com.mysql.cj.conf.ConnectionUrlParser.parseAuthoritySegment(ConnectionUrlParser.java:269)
at com.mysql.cj.conf.ConnectionUrlParser.parseAuthoritySection(ConnectionUrlParser.java:183)
at com.mysql.cj.conf.ConnectionUrlParser.getHosts(ConnectionUrlParser.java:632)
at com.mysql.cj.conf.ConnectionUrl.getConnectionUrlInstance(ConnectionUrl.java:198)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:196)
... 58 more
Caused by: java.lang.NumberFormatException: For input string: "3306;databaseName=hive_metastore;create=true
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at com.mysql.cj.conf.ConnectionUrlParser.parseHostPortPair(ConnectionUrlParser.java:500)
... 64 more



备注:
mysql-connector-java-8.0.16
select @@version 8.0.11

数据库用户
user host
root %
root 172.16.0.11
root master.hadoop

问题应该是在数据库连接通信这个点,尝试了很多帖子上的方法,还是不行,望高手解救。
...全文
57 点赞 收藏 1
写回复
1 条回复
Brady.Lan 2019年05月09日
是 hive_site.xml文件配置缺失导致的问题 <property> <name>hive.metastore.warehouse.dir</name> <value>/opt/modules/hive-2.3/warehouse</value> <description>location of default database for the warehouse</description> </property> <property> <name>hive.querylog.location</name> <value>/opt/modules/hive-2.3/log/</value> <description>Location of Hive run time structured log file</description> </property> <property> <name>hive.exec.local.scratchdir</name> <value>/opt/modules/hive-2.3/tmp/${user.name}</value> <description>Local scratch space for Hive jobs</description> </property> <property> <name>hive.downloaded.resources.dir</name> <value>/opt/modules/hive-2.3/tmp/</value> <description>Temporary local directory for added resources in the remote file system.</description> </property> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://172.16.0.11:3306/littlefreddie</value> <description> JDBC connect string for a JDBC metastore. To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL. For example, jdbc:postgresql://myhost/db?ssl=true for postgres database. </description> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description>Driver class name for a JDBC metastore</description> </property> 这些没有配置,,谢谢。
回复 点赞
发动态
发帖子
Hadoop
创建于2011-06-27

6873

社区成员

4305

社区内容

分布式计算/Hadoop/Hbase/Cassandra/Storm/Spark/大数据
社区公告
暂无公告