Could not establish connection to localhost:10000/default: java.net.ConnectException: Connection refused - hadoop

I have work on Hadoop/Hive. I have installed Hadoop 1.1.2 and Hive 0.10.0.When I use Hive as command prompt then it works fine,but when I am using as it JDBC in Eclipse then gives the below error :
Could not establish connection to localhost:10000/default:
java.net.ConnectException: Connection refused

You can connect to Hive in two modes. Through thrift server and embedded mode.
By seeing your url localhost:10000/default, it looks like you are trying to connect to the thrift sever. So please ensure that you are have started the hive thrift server by the following command.
$ hive --service hiveserver
If you want to connect in embedded mode. you should give the url as
jdbc:hive://
To use the embedded mode you should add the hive/conf and the jars in hive/lib to your classpath.
It is to be noted that, use of the Thrift server is not thread safe as of now.

Related

hive shell is not starting in cloudera

I tried restarting my system, checked whether there is enough space or not and also made sure my hive server2 is running. But I'm getting these errors when given '$hive' in Cloudera.
Logging initialized using configuration in
file:/etc/hive/conf.dist/hive-log4j.properties
WARN: The method class
org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
Exception in thread "main" java.lang.RuntimeException:
org.apache.hadoop.hive.ql.metadata.HiveException:
java.lang.RuntimeException:
org.apache.hadoop.hive.ql.metadata.HiveException:
java.lang.RuntimeException: Unable to instantiate
org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
The process of starting Hive2 is changed, as Hive got deprecated. Usage of Beeline is recommended.
Beeline was developed specifically to interact with the new server. Unlike Hive CLI, which is an Apache Thrift-based client, Beeline is a JDBC client based on the SQLLine CLI — although the JDBC driver used communicates with HiveServer2 using HiveServer2’s Thrift APIs.
As Hive development has shifted from the original Hive server (HiveServer1) to the new server (HiveServer2), users and developers accordingly need to switch to the new client tool. However, there’s more to this process than simply switching the executable name from “hive” to “beeline”.
More information provided over here
Use the below command to enter into interactive mode. Beeline supports same commands that Hive server does. You can execute same script in Beeline without any modifications.
beeline -u jdbc:hive2://
To start the Hive metastore,
sudo service hive-metastore start

Unable to connect to hbase using phoenix jdbc driver (Can't get the locations error)

I am working on hbase(1.2.6) with phoenix(4.10.0-Hbase-1.2).
I am getting this error :
org.apache.hadoop.hbase.client.RetriesExhaustedException: Can't get the locations error
Below is my code through which I am trying to connect to hbase using phoenix:
Connection connection = DriverManager.getConnection("jdbc:phoenix:localhost");
Below is my hdfs-site.xml file where I have made some changes:
What changes I need to do? Please suggest..
A combined answer with #vrb
The Zookeeper port is a non-standard port, and needs to be specified on the jdbc url used with the Connection/DriverManager
Connection connection = DriverManager.getConnection("jdbc:phoenix:localhost:12181");
Check the "conf/regionserver" file in hbase for hostnames and use the same hostname to connect to hbase.
connection = DriverManager.getConnection("jdbc:phoenix:{hostname_in_regionserver_conf_file}:2181");
Also ensure that the "phoenix-X.X.X-HBase-X.X-client.jar" jar is in the classpath of you java file.

Hive - issues while starting

I have been using Hive for sometime now on Ubuntu while Hadoop is in Pseudo Distribution mode however today out of nowhere i am getting error while starting Hive shell.I have not made any changes in configuration at all -
Caused by: Meta Exception(message:Could not connect to meta store using any of the URIs provided. Most recent failure: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused
The hivemetastore service is not running. You can start the service with the command below. This command is for installations made using packages.
service hive-metastore start
For tarball installations, you can start the hive metastore using the below command
hive --service metastore &

Beeline command issue

I am new to Hive and hopefully this is going to be an easy thing to solve
for someone with more experience, but I am having trouble doing it on my
own.
On my EC2 app server I am running the following command with no error:
beeline -u jdbc:hive2://master
This is working on Hive 13 which was installed through a bootstrap action
using the latest AMI version. 'master' is pointing to my EMR cluster
Then I downloaded the source for Hive 14 and built it. I have replaced my
/home/hadoop/hive directory with the package that was built.
However, if I try to execute the same command, I get an error:
scan complete in 6ms
Connecting to jdbc:hive2://master
Error: Could not open client transport with JDBC Uri: jdbc:hive2://master:
Cannot open without port. (state=08S01,code=0)
Beeline version 0.14.0 by Apache Hive
0: jdbc:hive2://master (closed)>
Running it with the port provided works correctly:
beeline -u jdbc:hive2://master:10000
I would like to be able to able to run the command without providing the
default port number.
Can anyone direct me with an instruction.
Thanks,
Hive Beeline Connection in Two Modes:
1.Embedded Mode:
If both Hive Client and Hive server are same then connect beeline by using below url:
!connect jdbc:hive2://
2.Remote Mode:
If server in one machine but client in one machine you can connect beeline using below url:
!connect jdbc:hive2://<host>:<port>

JDBC connection to Shark Server hangs

I am using following configuration for my shark cluster
Scala 2.10.3
Spark 0.9.0
Hive 0.12.0-chd5.0.2
Shark 0.9.0
Spark and Hive are configured via Cloudera manager (CDH 5.0.2)
I am following this tutorial to connect to shark server:
https://cwiki.apache.org/confluence/display/Hive/HiveClient
I start shark server as follows:./shark --service sharkserver 9956
I am able to connect to hive server using code in above mentioned tutorial.
But when i try to connect to shark server it hung at this line
Connection con = DriverManager.getConnection("jdbc:hive://localhost:9956/default", "", "");
It does not give any error or exception, just program stuck at that line.
I was able to solve this problem by running server in sudo mode.
In default mode shark server was unable to write a file because of permission denied error.

Resources