Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to access HDFS and Hive database.

avatar
Explorer

Hello community,

I have logged into the Sandbox for the first time using Putty.exe.

I'm currently at the location shown in the image below.

Can someone please show me how to access the HDFS drive and Hive database

57385-sandbox.png

7 REPLIES 7

avatar
Master Mentor
@Carlton Patterson


Once you are able to login to Sandbox on SSH port 2222 then you should be able to run the commands.

# ssh root@localhost -p 2222
Enter password: hadoop


Now you can run the hdfs commands like inside the Sandbox terminal:

# su - hdfs
# hdfs dfs -ls /


Also if you want to access the "HDFS" filesystem using Ambari File View then login to ambari UI with credential (admin / admin)
http://localhost:8080

The access the "File View" from the drop down menu on the top right corner.

Similarly in order to access "hive"

# su - hive
# hive --hiveconf hive.execution.engine=tez 


Or use the "Hive View" from ambari UI.

.

avatar
Explorer

Hi Jay, can you please let me know why I'm suddenly not able to access the Sandbox on port 2222? I was able before, but now I can't.

avatar
Explorer

Hi Jay,

This a great answer - I had no idea about port 2222.

I'm going to try and explain what I'm attempting to do.

I have created the following .hql code to create a table. When I execute the code Ambari successfully creates the the table.

CREATE EXTERNAL TABLE mysample
(
 code STRING,
 description STRING,
 total_emp INT,
 salary INT
)
ROW FORMAT DELIMITED
 FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/root/music'
TBLPROPERTIES ("skip.header.line.count" = "1");

However, whenever run the the following code from Zeppelin I'm unable to see any data

%jdbc(hive)
select * from newmoves.nexflix2 limit 14

I have uploaded a dataset called 'movies.csv' into the /root/music folder on the the Sandbox. However, it was mentioned to me that the problem was that I pointed the location to dataset to LOCATION '/root/music'. Apparently, the directory needs to be in HDFS not in Local. Therefore, can someone let me know what I need to do to get the 'movies.csv' file into HDFS.

As you have probably will have guessed, I'm very new to Sandbox etc... so I hope I explained myself well enough for someone to help me.

Cheers

avatar
Explorer

Hello I made an error,

I meant to say when try to run the following I don't see any data

%jdbc(hive)
select * from mysample limit 14

avatar
Explorer

OK, So I'm getting there. I have uploaded a table into Sandbox from the GUI, the table is movies3.csv and I've called the table movies4

movies4.png

I have also uploaded the same table using from putty

putty.png

when I run the command I get data

%jdbc(hive)
select * from movies4 limit 14 

But when I run the following command I don't get any data.

%jdbc(hive)
select * from mymovies limit 14

I to generate the mymovies table i used the following .hql

CREATE EXTERNAL TABLE mymovies
(
 movieId INT,
 title STRING,
 genre STRING
)
ROW FORMAT DELIMITED
 FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/home/hive'
TBLPROPERTIES ("skip.header.line.count" = "1");

Can someone please let me know why i don't get any data with .hql

avatar
Explorer

Hi Jay,

Can you please help figure out why the Sandbox suddenly won't allow to login to it on port 2222? I was able before, as you suggested above, but now I can't.