user3311626
user3311626

Reputation: 1

Hadoop- I want to load a table in hive using a file in hdfs

I am not able to create a file in local. Can you please tell me how and where to create a sample local file. I am bit confused about and local and hdfs.How to move the file from local to HDFS and once after moving how i can check the file is in hdfs. I am very new to hadooop.

Thanks , Ram

Upvotes: 0

Views: 72

Answers (1)

G S Vijay Raajaa
G S Vijay Raajaa

Reputation: 71

Assuming you are in Linux based OS

Create a file using: $ nano /path/to/file.txt .

You must have sufficient priviledge in directory where you create the file.

To move the file to HDFS ( As a user privileged to access HDFS, say hdfs user ) :

hadoop fs -put /path/to/file.txt

To check the file : hadoop fs -ls /user/<hadoop user>

To check the content of file : hadoop fs -cat /user/<hadoop user>/file.txt

Now you can create a Hive table using create external table .. and mention the path of file in HDFS.

Upvotes: 2

Related Questions