Support Questions

Find answers, ask questions, and share your expertise

Error Connecting to secured phoenix through SQuirrelSQL

avatar

Getting Below Error:

java.util.concurrent.TimeoutException
	at java.util.concurrent.FutureTask.get(FutureTask.java:205)
	at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.awaitConnection(OpenConnectionCommand.java:132)
	at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$100(OpenConnectionCommand.java:45)
	at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$2.run(OpenConnectionCommand.java:115)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

I am using Below URL for connection,

jdbc:phoenix:zk-host-1,zk-host-2,zk-host-3:2181:/hbase-secure:/Users/user1/user1.headless.keytab:user1@EXAMPLE.COM

Please help?

1 ACCEPTED SOLUTION

avatar

I have solved this issue, By adding hbase-site.xml and core-site.xml files to the phoenix jars,

As Squirrel doesn't take hbase-site.xml and core-site.xml files directly to classpath, Squirrel tries to unzip them like normal jar files.

By extracting phoenix jar and added hbase-site.xml and core-site.xml files to the jar again created new jar with same name.

Added it to the Squirrel-sql Lib directory and restarted the Squirrel-sql.

After this I am able to connect to phoenix using Squirrel-Sql.

Thank you very much for your help.

@Sergey Soldatov and @Josh Elser

View solution in original post

9 REPLIES 9

avatar

Why SquirrelSQL is not able to make a connection to HBase cluster is not clear from the stack trace.

would you mind enabling debugging and paste the logs here.

have you tried connecting using sqlline with the same url from the same machine.

avatar
Super Guru

You are using an incorrect URL. Please read the documentation https://phoenix.apache.org/#Connection

jdbc:phoenix:zk-host-1,zk-host-2,zk-host-3:2181:/hbase-secure:user1@EXAMPLE.COM:/Users/user1/user1.headless.keytab

avatar

@Josh Elser

I tried Both getting same Error.

jdbc:phoenix:zk-host-1,zk-host-2,zk-host-3:2181:/hbase-secure:user1@EXAMPLE.COM:/Users/user1/user1.headless.keytab

avatar
Super Guru

The one you have in the description is wrong and will never work. The one here is the form you must use.

Please follow Ankit's suggestion to provide for information. A TimeoutException that makes no reference to Phoenix code is not helpful.

Please also be aware that hbase-site.xml and core-site.xml are required to be on the classpath for Phoenix to connect to a secured HBase installation. This may be the root of your problem, but it is unknown without more data.

avatar
Super Collaborator

Make sure that both hbase and hadoop conf dirs are in the classpath. It can be configured through Extra Class Path tab of the Phoenix driver. Also make sure that you added directories, but not xml files.

Similar type of timeouts usually happen because HBase client (which is a part of Phoenix) to detect secured environment requires from cluster both hbase-site.xml and core-site.xml. If it doesn't find that both hbase and hadoop are secured, it tries to use plain connection to region servers which will be timed out.

avatar

@Sergey Soldatov

Thanks for response,

Which directories do you want me to add in the SQL lib.

I guess it should be /usr/hdp/current/hbase-master/lib/hbase*.jar and /usr/hdp/current/hadoop-client/hadoop*.jar.

Please confirm.

avatar
Super Collaborator

I'm talking about the config directories. Those are : /etc/hbase/conf and /etc/hadoop/conf. Some versions of HDP have a copy of core-site.xml in the hbase conf dir (you may check it manually). The only jar you need to add to the driver configuration is /usr/hdp/current/phoenix-client/phoenix-client.jar. Don't add anything else.

avatar

I have solved this issue, By adding hbase-site.xml and core-site.xml files to the phoenix jars,

As Squirrel doesn't take hbase-site.xml and core-site.xml files directly to classpath, Squirrel tries to unzip them like normal jar files.

By extracting phoenix jar and added hbase-site.xml and core-site.xml files to the jar again created new jar with same name.

Added it to the Squirrel-sql Lib directory and restarted the Squirrel-sql.

After this I am able to connect to phoenix using Squirrel-Sql.

Thank you very much for your help.

@Sergey Soldatov and @Josh Elser

avatar
Super Collaborator

That's an incorrect approach. You don't need to add xml files to the jars. As I already mentioned before, you need to add directories where those files located, not files themselves. That's how java classpath work. It accepts jars and directories only. So if you need a resource in the java classpath, you need to have it in a jar file (like you did) OR put the parent directory to the classpath. In Squirrel it can be done in the Extra classpath tab of the Driver configuration:

26400-screen-shot-2017-08-07-at-54956-pm.png