I have a Hortonworks Hadoop cluster where the data nodes are on a separate network off of the master/head node. The only way to access the data nodes is through the master node or an edge node. From the edge node, I execute the hive command to connect into my hive database.
I cannot connect to the hive database from my desktop with DBeaver (4.3.0, 64-bit Windows) or the hive command line interface. Through DBeaver, I tried creating an SSH tunnel to my edge node and continually receive "Could not open client transport with JDBC Uri. jdbc:hive2://127.0.0.1:[port#]/[database].
Configuration for Hive/Apache Hive driver:
General Tab:
Host: dataNodeName
Port: 10000
Database/Schema: databaseName
User name: myUID
SSH Tunnel Tab (Network page):
Checked Use SSH Tunnel
Host/IP: edgeNodeServerName
Port: 22
User Name: myUID
Authentication Method: Password
Password: myPWD
Advanced
Local port: 0
Keep-Alive interval (ms): 0
When I select "Test Connection" with local port set to "0", I receive the above error message with random port numbers. If I set the local port to "10000", I receive the above error with port number "10000".
It looks like DBeaver is ignoring the generic JDBC connection settings--the host name in the created JDBC string is 127.0.0.1 instead of the data node name.
What am I missing? How do I setup DBeaver to access a Hive database located on a "hidden" network?
Is your hostname configured with the IP address mentioned in the jdbc connect syntax (127.0.0.1)?
Are you able to connect to beeline from your Unix shell?
Syntax to connect to beeline(hiveserver2):
beeline -u jdbc:hive2://<hostname>:<hive listener port>/<database> -n username> -p <password>
If you're able to connect to beeline, you should be able to connect to hive using same port number and host from DBeaver.
Hive listener port by default is configured on 10000, but there's a possibility that your admin can change the port number. Check the port number in hive-site.xml, or get it from admin.
Could you please uncheck the SSH tunnel and try?
This link has all the setup from scratch, please check if you have missed any step.
https://www.linkedin.com/pulse/query-hive-hiveserver2-from-windows-using-universal-database-nimmala
Not sure if your environment is Kerberized or not but assuming it is -
Following is what worked for me while connecting to Cloudera -
Fetch the krb5.conf or krb5.ini from your admins and place it in some directory. I normally put the file in a location where I put my keytabs.
Create jaas.conf file and place it at the same location(or the location of your choice)
jaas.conf must look like below(copy paste) -
Client {
com.sun.security.auth.module.Krb5LoginModule required
debug=true
doNotPrompt=true
useKeyTab=true
keyTab="C:\Users{user}\krb5cc_{user}"
useTicketCache=true
renewTGT=true
principal="{user}#DOMAIN.ORG" ;
};
Edit your dbeaver.ini file and provide the reference to both of this files(append the following lines to existing dbeaver.ini). Make sure you backup dbeaver.ini, with re installations or replacing with newer version, dbeaver.ini may get replaced, in that case you can copy the lines below from your backup dbeaver.ini file -
-Djavax.security.auth.useSubjectCredsOnly=false
-Djava.security.krb5.debug=true
-Dsun.security.krb5.debug=true
-Djava.security.krb5.conf=C:\Users{User}\Documents\Keytabs\krb5.conf
-Djava.security.auth.login.config=C:\Users{User}\Documents\Keytabs\jaas.conf
Last Step(You may need or may not)
I init my keytab before connecting. So I use Shell Commands -
Press F4 after creating the connection
Make sure in user you just put the user name for which you are initializing the keytab and nothing else. It should not be {user}#domain.org.
Use the shell commands to init the keytab
I also was having trouble configuring DBeaver to Hive, my solution was to use Cloudera's ODBC Driver. It worked a lot better then the JDBC drivers (auto-complete working, quicker, no need to run kinit), and I could automatize its creation.
The only problem is that you must be admin to install it.
Related
I'm aware of similar questions here however my setup is different.
There are 3 hops in my connection setup and the final connection is through Kerberos.
Today I SSH to the first computer through a CyberArk connection with a command like:
ssh username#hopname#172.2.2.2#172.1.1.1
This bring me to the first command prompt through which I connect to another machine with a ssh like: ssh 172.3.3.3
In this machine I can not login to hive REPL with the 'hive' command. I type 'beeline' which loads hive REPL fore me.
This is the setup for the SSH Tunnel:
When I 'test tunnel configuration' this it appears to be successful:
Lastly I need to enter the main JDBC connection URL in the main page:
When I normally connect through beeline I can see that my connection is in this format:
jdbc:hive2://172.4.5.6:2400,172.5.6.7:2400,172.6.7.8:2400,172.7.8.9:2400,172.8.9.9:2400/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;principal=hive/hadoop.hadoop.com#HADOOP.COM
Therefore this is the string I put into the JDBC URL.
When I try to connect through this setup the progress bar goes across a third of the way and pauses for 30 seconds and then I receive this message:
I'm not sure where the error logs are for more detail but looking around dbeaver files i couldn't find any.
When I connect to my database remotely I use ssh to connect to the remote machine, then I run sudo -u postgres psql to access PostgresSQL. The postgres user is passwordless in my OS.
I can make an SSH tunnel connect in Datagrip, but I can't seem to find a way to switch to postgres user prior to attempting to access the database.
Is there a way to do this?
First, you need to configure SSH tunnel on datasource ssh/ssl tab (host/port/username/password).
Secondly, you need to specify database credentials to your db on general tab.
Also, make sure you configured server correctly for non-local connections.
You should go to ~/.ssh/config file and set the tunnel with the user, which is used on the server, and put 'postgres' as a user name in the connection properties.
Note, it is working only in 2017.3 EAP now (release will be available this week)
Both databases are on remote server and I can get connected to and query on them using TOAD.
When connecting to database configured with OraClient11g_Home1 from Python on my desktop the connection is established successfully. However, trying to connect to database which is using OraClient12Home1 results into ORA-12170 error,i.e. TNS: Connect timeout occurred. Below are configurations.
Edited to contain more information:
I connect to the database using a remote desktop connection. The code is written to automate part of my testing activities by querying two databases and checking whether a single command has been successful on multiple systems(e.g. Ericsson and Huawei)
Output of one query is the input to another one (I can get output from the 11g DB and have previously wrote scripts for it, but this is the first time we're getting connected to the DB on Ora12 using python. I can access both DBs using TOAD on the remote desktop or connect and query 11g DB using python on my desktop but Ora12 throws time out for the same code.
the connection part of the code and how they are queried is as below:
#Get chrono number, action code and status from provisioning table
ip = '********'
port = *****
service_name = '*****'
dsn = cx_Oracle.makedsn(ip, port, service_name)
connection = cx_Oracle.connect("********","********",dsn)
cursor = connection.cursor()
totalChronoList = list()
myQuery=list()
inputData = list()
myQuery = ("select CHRONO_NUM_N, ACTION_CODE_V, STATUS_V from gsm_subs_provisioning where ACTION_DT_DT > SYSDATE - 2 order by ACTION_DT_DT desc")
cursor.execute(myQuery)
inputData.append(cursor.fetchall())
The configurations are as below:
OraClient11g_home1 (11.2.0.1)
ORACLE_HOME:C:\Oracle\product\11.2.0\client_1
ORACLE_HOME_NAME:OraClient11g_home1
ORACLE_HOME_KEY:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraClient11g_home1
ORACLE_SID:
NLS_LANG:AMERICAN_AMERICA.WE8MSWIN1252
SQLPATH:C:\Oracle\product\11.2.0\client_1\dbs
LOCAL:
Client DLL:C:\Oracle\product\11.2.0\client_1\oci.dll
TNSNames.ora:C:\Oracle\product\11.2.0\client_1\Network\Admin\tnsnames.ora
SQLNet.ora:C:\Oracle\product\11.2.0\client_1\Network\Admin\sqlnet.ora
LDAP.ora:C:\Oracle\product\11.2.0\client_1\Network\Admin\ldap.ora
Login.sql:
GLogin.sql:
In system PATH:Yes
Home is valid:Yes
OraClient12Home1 (12.1.0.2)
ORACLE_HOME:E:\app\client\Oracle\product\12.1.0\client_1
ORACLE_HOME_NAME:OraClient12Home1
ORACLE_HOME_KEY:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraClient12Home1
ORACLE_SID:
NLS_LANG:AMERICAN_AMERICA.WE8MSWIN1252
SQLPATH:E:\app\client\Oracle\product\12.1.0\client_1\dbs
LOCAL:
Client DLL:E:\app\client\Oracle\product\12.1.0\client_1\bin\oci.dll
TNSNames.ora:
SQLNet.ora:E:\app\client\Oracle\product\12.1.0\client_1\Network\Admin\sqlnet.ora
LDAP.ora:
Login.sql:
GLogin.sql:E:\app\client\Oracle\product\12.1.0\client_1\sqlplus\admin\glogin.sql
In system PATH:Yes
Home is valid:Yes
ORA-12170: TNS:Connect timeout occurred means you can't access the host and/or port of the DB. I bet in your case it is some restriction on firewalls (most reason, but may be others). First of all try to check is the port accessible. Easiest way - run powershell statement:
Test-NetConnection <host-or-ip> -port <port>
Then go with findings to sysadmin/dba.
Update: As you connect to DB using easy access method (ip, port, service name), you don’t have to care about tnsnames.ora.
In your 12c client we can see that no tnsnames.ora file is found.
Copy this file from the 11g client directory.
I am trying to run Cassandra (CQL Shell) and I am receiving the following error, I have tried all the google responses to existing questions, nothing has fixed it so far.
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(10061, "Tried connecting to [('127.0.0.1', 9042)]. Last error: No connection could be made because the target machine actively refused it")})
Before installing Apache Cassandra, JDK must be installed.
Can you make sure the IP address is set correctly on your rpc_address setting in your cassandra.yaml file, on your cassandra server.
Also, you need to make sure port 9042 is open and available for incoming traffic (if your IT department is setting up servers, it is possible this port is blocked, unless otherwise specified...)
Hope it helps.
I also faced the same issue , but may be the below 2 way's can help :
Option 1 :
In my case i haven't started the Cassandra Server and was directly trying to connect to Cassandra.
(a) Firstly start the cassandra server via cmd --> \bin>cassandra.bat -f
and then
(b) Try to connect to it's node --> \bin>cqlsh.bat -u cassandra
Option 2:
Try changing the rpc_address in your cassandra.yaml file to eihter 127.0.0.1 instead of localhost
or to 0.0.0.0 instead of localhost
and then again start the server from new CMD.
My application uses the blazer gem for visualizing DB queries.
During the setup I've encountered the following error:
FATAL: no pg_hba.conf entry for host "111.22.33.44", user "blazer", database "my_db", SSL off
My application is hosted on EngineYard and uses PostgreSQL.
How can I find and modify the pg_hba.conf on EngineYard?
upd
I do have SSH access to EngineYard cloud.
Instance: General Purpose (M3) Large.
OS: EngineYard's Gentoo.
You can try the following steps. I've assumed that your DB name is my_db.
Connect to the instance via SSH (the link can be found on the EngineYard environment page)
Connect to the
database as superuser psql -U postgres -h localhost -d
my_db. If you don't have the password, check your database secrets here /data/my_db/current/config/database.yml
After connecting to DB identify location of hba file by typing SHOW
hba_file;
Quit psql by typing \q
Use previously identified path to open the hba_file file and add the missing user. E.g via vim sudo vim /db/postgresql/9.5/data/pg_hba.conf. Note the sudo command
The use should be added under # IPv4 postgres
user for 10.x with md5:
Connect to the database again
Reload the configuration via select pg_reload_conf(); command
After all steps are performed, Blazer queries should be accessible.