big-data-europe / docker-hive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to connect to localhost:10000

ggrossetie opened this issue · comments

Hello,

First of all, thanks for sharing your great work!

I've followed the README and everything seems to be running fine:

# docker-compose ps
                 Name                               Command               State                  Ports               
---------------------------------------------------------------------------------------------------------------------
datanode                                 /entrypoint.sh /run.sh           Up      50075/tcp                          
dockerhive_hive-metastore-postgresql_1   /docker-entrypoint.sh postgres   Up      5432/tcp                           
hive-metastore                           entrypoint.sh /opt/hive/bi ...   Up      10000/tcp, 10002/tcp               
hive-server                              entrypoint.sh /bin/sh -c s ...   Up      0.0.0.0:10000->10000/tcp, 10002/tcp
namenode                                 /entrypoint.sh /run.sh           Up      50070/tcp                
# docker ps
CONTAINER ID        IMAGE                                           COMMAND                  CREATED             STATUS                    PORTS                                 NAMES
863752049e66        dockerhive_hive-server                          "entrypoint.sh /bi..."   27 minutes ago      Up 5 minutes              0.0.0.0:10000->10000/tcp, 10002/tcp   hive-server
ba79079f48a8        dockerhive_hive-metastore                       "entrypoint.sh /op..."   27 minutes ago      Up 5 minutes              10000/tcp, 10002/tcp                  hive-metastore
4396594ad289        bde2020/hadoop-datanode:1.1.0-hadoop2.8-java8   "/entrypoint.sh /r..."   27 minutes ago      Up 27 minutes (healthy)   50075/tcp                             datanode
f78224e07505        bde2020/hadoop-namenode:1.1.0-hadoop2.8-java8   "/entrypoint.sh /r..."   27 minutes ago      Up 27 minutes (healthy)   50070/tcp                             namenode
b632b3fd642f        bde2020/hive-metastore-postgresql:2.1.0         "/docker-entrypoin..."   27 minutes ago      Up 27 minutes             5432/tcp                              dockerhive_hive-metastore-postgresql_1

But I can't connect to Hive to load data:

/opt# /opt/hive/bin/beeline -u jdbc:hive2://localhost:10000
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-2.8.0/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]
Connecting to jdbc:hive2://localhost:10000
17/10/23 12:48:30 [main]: WARN jdbc.HiveConnection: Failed to connect to 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)
Beeline version 2.1.1 by Apache Hive

I've tried to connect to the hive-metastore container but it doesn't work either. I've also try to connect from the beeline prompt:

beeline> !connect jdbc:hive2://localhost:10000
Connecting to jdbc:hive2://localhost:10000
Enter username for jdbc:hive2://localhost:10000: 
Enter password for jdbc:hive2://localhost:10000: 
17/10/23 12:52:48 [main]: WARN jdbc.HiveConnection: Failed to connect to 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)
beeline> 

Did I miss something ?
Thanks

I've run the following command (which failed) but now I can connect:

/opt/hive/bin/schematool -initSchema -dbType postgres
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-2.8.0/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:postgresql://hive-metastore-postgresql/metastore
Metastore Connection Driver :	 org.postgresql.Driver
Metastore connection User:	 hive
Starting metastore schema initialization to 2.1.0
Initialization script hive-schema-2.1.0.postgres.sql
Error: ERROR: relation "BUCKETING_COLS" already exists (state=42P07,code=0)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
Use --verbose for detailed stacktrace.
*** schemaTool failed ***

@Mogztter that is weird, did you find the reason why the connection was not working in the first place?

hmm running that command above fixed things for me too

Actually it seems like the real issue is just waiting for awhile, if you wait a minute or two, it connects. Must be something the hive server needs to set up in the background first.

after reaching in /opt#, just run this command: beeline -u jdbc:hive2://localhost:10000. i.e., remove /opt/hive/bin/

running the /opt/hive/bin/schematool -initSchema -dbType postgres does not fix the connection refused issue for me. Any ideas? Embedded mode works, but Remote does not.

root@hive-server:/opt# beeline -u jdbc:hive2://localhost:10000
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-3.2.1/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]
Connecting to jdbc:hive2://localhost:10000
20/11/12 09:13:49 [main]: WARN jdbc.HiveConnection: Failed to connect to 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)
Beeline version 3.1.2 by Apache Hive
root@hive-server:/opt# /opt/hive/bin/schematool -initSchema -dbType postgres
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-3.2.1/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:postgresql://hive-metastore-postgresql/metastore
Metastore Connection Driver :    org.postgresql.Driver
Metastore connection User:       hive
Starting metastore schema initialization to 3.1.0
Initialization script hive-schema-3.1.0.postgres.sql











Error: ERROR: relation "BUCKETING_COLS" already exists (state=42P07,code=0)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
Use --verbose for detailed stacktrace.
*** schemaTool failed ***
root@hive-server:/opt# beeline -u jdbc:hive2://localhost:10000
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-3.2.1/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]
Connecting to jdbc:hive2://localhost:10000
20/11/12 09:15:46 [main]: WARN jdbc.HiveConnection: Failed to connect to 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)
Beeline version 3.1.2 by Apache Hive
root@hive-server:/opt# 

I have the same issue, can anyone please suggest some working solution?

If the metastore has been initialized before run the container with --env IS_RESUME="true". Got it from here