You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Jay Ramadorai <jr...@tripadvisor.com> on 2011/02/03 15:22:14 UTC

Making Thrift work with Hive in client-server mode

Can someone explain how the Thriftserver finds the Hive metastore?

I am running with all non-default values and need to know how to connect to Thrift so it finds Hive with the right metastore.

I am running Derby in server mode on a non-default port. And my metastore name is non-default. And I want to run my Thrift server on a non-default port.

My hive-site looks like this:
<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:derby://myhost:2222/MYmetastore_db;create=true</value>
  <description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
  <name>javax.jdo.option.ConnectionDriverName</name>
  <value>org.apache.derby.jdbc.ClientDriver</value>
  <description>Driver class name for a JDBC metastore</description>
</property>
--------
I start derby up as follows :
cd $DERBY_HOME/data
nohup $DERBY_HOME/bin/startNetworkServer -h 0.0.0.0 -p 3333 &
---------
I am able to connect from the Hive CLI just fine and able to create, drop, select from tables in the right metastore.
--------
Now I start my Thrift server as follows:
HIVE_PORT=11000
export HIVE_PORT
nohup hive  --service hiveserver &

Thrift server starts up fine and attaches to port 11000
------------
Now I try to run the Hive server test: 
ant test -Dtestcase=TestJdbcDriver -Dstandalone=true
...and of course it says Tests Failed, with no further specific detail.

The Test java program (http://wiki.apache.org/hadoop/Hive/HiveClient)  tries to connect as:
DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", "")
My question is besides changing it to 
DriverManager.getConnection("jdbc:hive://myhost:11000/default", "", "")
what else do I need to do?
What does the "default" in the connect string signify? Should that be my metastore name? There is also a DATABASE in Hive called "default", so I am not so sure that I should change this.

Bottom line how is the Thrift server supposed to find the metatore, and how should I connect to the Thrift server from a jdbc client.
Thanks
JayR




Re: Making Thrift work with Hive in client-server mode

Posted by Jay Ramadorai <jr...@tripadvisor.com>.
Sorry. I had an error in my message below. I start up Derby on the same port that is specified in hive-site. So my derby start looks like:
> 
> nohup $DERBY_HOME/bin/startNetworkServer -h 0.0.0.0 -p 2222 &
(not 3333)
 
BTW, all the ports shown here are examples only.

On Feb 3, 2011, at 9:22 AM, Jay Ramadorai wrote:

> Can someone explain how the Thriftserver finds the Hive metastore?
> 
> I am running with all non-default values and need to know how to connect to Thrift so it finds Hive with the right metastore.
> 
> I am running Derby in server mode on a non-default port. And my metastore name is non-default. And I want to run my Thrift server on a non-default port.
> 
> My hive-site looks like this:
> <property>
>   <name>javax.jdo.option.ConnectionURL</name>
>   <value>jdbc:derby://myhost:2222/MYmetastore_db;create=true</value>
>   <description>JDBC connect string for a JDBC metastore</description>
> </property>
> <property>
>   <name>javax.jdo.option.ConnectionDriverName</name>
>   <value>org.apache.derby.jdbc.ClientDriver</value>
>   <description>Driver class name for a JDBC metastore</description>
> </property>
> --------
> I start derby up as follows :
> cd $DERBY_HOME/data
> nohup $DERBY_HOME/bin/startNetworkServer -h 0.0.0.0 -p 3333 &
> ---------
> I am able to connect from the Hive CLI just fine and able to create, drop, select from tables in the right metastore.
> --------
> Now I start my Thrift server as follows:
> HIVE_PORT=11000
> export HIVE_PORT
> nohup hive  --service hiveserver &
> 
> Thrift server starts up fine and attaches to port 11000
> ------------
> Now I try to run the Hive server test: 
> ant test -Dtestcase=TestJdbcDriver -Dstandalone=true
> ...and of course it says Tests Failed, with no further specific detail.
> 
> The Test java program (http://wiki.apache.org/hadoop/Hive/HiveClient)  tries to connect as:
> DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", "")
> My question is besides changing it to 
> DriverManager.getConnection("jdbc:hive://myhost:11000/default", "", "")
> what else do I need to do?
> What does the "default" in the connect string signify? Should that be my metastore name? There is also a DATABASE in Hive called "default", so I am not so sure that I should change this.
> 
> Bottom line how is the Thrift server supposed to find the metatore, and how should I connect to the Thrift server from a jdbc client.
> Thanks
> JayR
> 
> 
>