0

for connect to hbase i write this code:

 Class.forName("com.salesforce.phoenix.jdbc.PhoenixDriver");
           conn = DriverManager.getConnection("jdbc:phoenix:localhost:2181");  

but after running give me this errors:

13/08/22 09:14:14 INFO zookeeper.ZooKeeper: 
Client environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 17:52 GMT
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:host.name=ubuntu
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:java.version=1.7.0_25
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:
java.vendor=Oracle Corporation
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:
java.home=/usr/local/jdk1.7.0_25/jre
13/08/22 09:14:14 INFO zookeeper.ZooKeeper:
 Client environment:java.class.path=/home/ubuntu/Phonix/phoenix-2.0.0-client.jar: 
/home/ubuntu/Downloads/hbql-0.90.0.1/hbql-0.90.0.1-src.jar:/home/ubuntu/Downloads/
 hbql-0.90.0.1/hbql-0.90.0.1.jar:/home/ubuntu/Downloads/protobuf-java-2.4.1.jar:
/home/ubuntu/NetBeansProjects/hbase-phoenix/build/classes
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:java.library.path=
/usr/local/jdk1.7.0_25/jre/lib/amd64:/usr/local/jdk1.7.0_25/jre/lib/i386:
/usr/java/packages/lib/i386:/lib:/usr/lib
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:os.arch=i386
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:os.version=
3.2.0-23-generic-pae
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:user.name=ubuntu
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:user.home=/home/ubuntu
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Client environment:user.dir=
/home/ubuntu/NetBeansProjects/hbase-phoenix
13/08/22 09:14:14 INFO zookeeper.ZooKeeper: Initiating client connection, 
connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
13/08/22 09:14:14 INFO zookeeper.RecoverableZooKeeper: 
The identifier of this process is 4944@ubuntu
13/08/22 09:14:14 INFO zookeeper.ClientCnxn: Opening socket connection to server 
localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
13/08/22 09:14:14 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected 
error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:708)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport
    (ClientCnxnSocketNIO.java:350)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
13/08/22 09:14:15 WARN zookeeper.RecoverableZooKeeper:
Possibly transient
 ZooKeeper exception:org.apache.zookeeper.KeeperException$ConnectionLossException:
 KeeperErrorCode = 
 ConnectionLoss for /hbase/hbaseid
13/08/22 09:14:15 INFO util.RetryCounter: Sleeping 2000ms before retry #1...

I cannot understand what is the problem. I install hbase 0.94.10 and zookeeper 3.4.5 individually and i am not sure configuration is true.can you guide and help me how configure them correctly

aizaz
  • 3,056
  • 9
  • 25
  • 57

2 Answers2

0

did you ensured to copy the phoenix server jar (its called only phoenix-.jar, I think it should be phoenix-2.0.0.jar in your case) to all of your region servers? Also ensure that the location of the phoenix jar is appended to the HBase classpath. You need to put the following maybe in the hbase-env.sh of all your region servers:

HBASE_CLASSPATH=$HBASE_CLASSPATH:/path/to/phoenix-2.0.0.jar

Afterwards you need to restart the cluster. Then phoenix will work. You can also read this installation guide of their github project page. UPDATE: I just saw that they updated their documentation. Thw last version of the documentation was more straigh-forward, but I think you will manage...

user2078148
  • 591
  • 1
  • 4
  • 13
0

Adding answer for anyone still looking:

Your jdbc connection string must look like:

jdbc:phoenix:zookeeper_quorum:2181:/hbase_znode OR;

jdbc:phoenix:zookeeper_quorum:/hbase_znode

(By default zookeeper listens at port 2181.)

zookeeper_quorum - Can be comma-separated server-names(must be fully qualified DNS names) hbase_znode - hbase or hbase-unsecured

e.g.

jdbc:phoenix:server1.abc.com,server2.abc.com:2181:/hbase

viczsaurav
  • 37
  • 6