配置远程PostgreSQL为Hive元存储时HiveServer2启动挂起求助
HiveServer2启动挂起及Beeline连接拒绝问题排查请求
环境版本
Hive 3.1.3 Hadoop 3.3.4 Spark 3.2.4 PostgresSQL 14.9
已完成操作
- 执行命令初始化PostgreSQL元存储表成功:
执行输出:/home/ivan/hive/bin/schematool -dbType postgres -initSchemaMetastore connection URL: jdbc:postgresql://localhost:5432/metastore Metastore Connection Driver : org.postgresql.Driver Metastore connection User: hive Starting metastore schema initialization to 2.3.0 Initialization script hive-schema-2.3.0.postgres.sql Initialization script completed schemaTool completed - 通过pgAdmin确认PostgreSQL中的元存储Schema正常
问题现象
- 启动Hive元存储服务(
hive --service metastore)和HiveServer2(hive --service hiveserver2 --hiveconf hive.server2.thrift.port=10000 --hiveconf hive.root.logger=INFO,console)后,HiveServer2持续生成新Session ID但处于挂起状态 - 使用Beeline连接时出现拒绝错误:
beeline> !connect jdbc:hive2://localhost:10000 Connecting to jdbc:hive2://localhost:10000 Enter username for jdbc:hive2://localhost:10000: ivan Enter password for jdbc:hive2://localhost:10000: **** Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status. Error: Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000: java.net.ConnectException: Connection refused (Connection refused) (state=08S01,code=0) - 执行端口检查命令
netstat -ntpl | egrep "10000|10001|10002",未发现HiveServer2占用相关端口,确认服务挂起
hive-site.xml关键配置
<configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:postgresql://localhost:5432/metastore</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>org.postgresql.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hive</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>1234</value> </property> <property> <name>hive.metastore.warehouse.dir</name> <value>hdfs://192.168.0.5:9000/user/hive/warehouse</value> </property> <property> <name>hive.server2.thrift.http.port</name> <value>10001</value> <description>Port number of HiveServer2 Thrift interface when hive.server2.transport.mode is 'http'.</description> </property> <property> <name>hive.server2.thrift.port</name> <value>10000</value> <description>Port number of HiveServer2 Thrift interface when hive.server2.transport.mode is 'binary'.</description> </property> </configuration>
请求协助
恳请协助排查并解决HiveServer2挂起及Beeline连接拒绝的问题。
内容的提问来源于stack exchange,提问作者Ivan
相关产品推荐
相关产品推荐

