0

I have hadoop single node installed. Now I download hive and configured the environment variables in .bashrc file and now I create a hive-site.xml with this content:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>

</configuration>

Now I'm starting hive but Im getting a lot of errors. Do you see why this errors are happening? It is because of hive-site.xml? What are the necessary proprieties in this hive-site.xml? I´m trying to find this info to see if we edit this hive-site.xml file correctly the errors disappear, and I already try some configuration examples but the errors still continues..

[hdoopadmin@hadoop ~]$ hive

Logging initialized using configuration in jar:file:/usr/local/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.net.ConnectException: Call From hadoop/10.2.0.15 to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.net.ConnectException: Call From hadoop/10.2.0.15 to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:792)
    at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:732)
    at org.apache.hadoop.ipc.Client.call(Client.java:1480)
    at org.apache.hadoop.ipc.Client.call(Client.java:1407)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229)
    at com.sun.proxy.$Proxy15.getFileInfo(Unknown Source)
    at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:771)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:187)
    at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
    at com.sun.proxy.$Proxy16.getFileInfo(Unknown Source)
    at org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:2116)
    at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1305)
    at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1301)
    at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
    at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1301)
    at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1424)
    at org.apache.hadoop.hive.ql.session.SessionState.createRootHDFSDir(SessionState.java:596)
    at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:554)
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:508)
    ... 8 more
Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
    at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531)
    at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:495)
    at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:609)
    at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:707)
    at org.apache.hadoop.ipc.Client$Connection.access$2800(Client.java:370)
    at org.apache.hadoop.ipc.Client.getConnection(Client.java:1529)
    at org.apache.hadoop.ipc.Client.call(Client.java:1446)
    ... 28 more
[hdadmin@hadoop ~]$ 

When I start the hiveserver:

[hdadmin@hadoop ~]$ hive --service hiveserver
Starting Hive Thrift Server
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.hadoop.hive.service.HiveServer
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:214)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
[hdadmin@hadoop ~]$ 
codin
  • 743
  • 5
  • 15
  • 27
  • You may want to read where the template xml file is. Note: a blank config file is bad, so errors are understandable. https://cwiki.apache.org/confluence/display/Hive/AdminManual+Configuration#AdminManualConfiguration-hive-site.xmlandhive-default.xml.template – OneCricketeer Mar 31 '16 at 01:45
  • Also, running the `hive` command is how you connect to Hive, not start Hive Server. You could just be getting connection refused because it isn't started. – OneCricketeer Mar 31 '16 at 01:46
  • Thanks for your answer. I read that site and create the hive-site.xml inside conf directory as they say "hive-default.xml.template is located in the conf directory in your installation root, and hive-site.xml should also be created in the same directory". – codin Mar 31 '16 at 13:10
  • I didnt know that I needed to start the hive server. But I update the question with error that appears when I try to start the hive server. – codin Mar 31 '16 at 14:01
  • How did you install Hive? Following this page? https://cwiki.apache.org/confluence/display/Hive/AdminManual+Installation – OneCricketeer Mar 31 '16 at 14:04
  • Yes, Just download hive 1.2.1, extract to the /usr/local folder. Then I just configure in .bashrc the environment variables. And everything was working fine, when I write "hive" the hive starts correctly. But I want to use spark to acess hive tables and it seems that We need to have a file hive-site.xml inside hive /conf folder to connect spark with hive. So I create that hive-site.xml inside /conf folder, and now Im always getting this erros when I write "hive" to start hive.. – codin Mar 31 '16 at 14:06
  • I see. I haven't used Spark yet, so I can't really help you there, sorry. – OneCricketeer Mar 31 '16 at 14:09
  • No problem, thanks anyway! But so to install hive correctly its just necessary extract for exmaple to the /usr/local folder and configure the environment variables in .bashrc right? – codin Mar 31 '16 at 14:22
  • I don't think it matters where you extract it to as long as the environment variables are all correct, and yes, you add those into `.bashrc` – OneCricketeer Mar 31 '16 at 15:22
  • So it seems that I have hive correctly installed. And for just of hive using without spark, its also necessary create the hive-site.xm file inside the hive conf folder? – codin Mar 31 '16 at 15:26
  • I'm not sure where your conf folder is, but see if this answer helps. http://stackoverflow.com/a/27241781/2308683 – OneCricketeer Mar 31 '16 at 15:28

0 Answers0