Hadoop/HDFS Commands
In this article we will go over some frequently used HDFS commands Hadoop Commands The Hadoop Distributed File System …
Command : hive
Command : quit;
Command : exit
;
CREATE TABLE
IF NOT EXISTS snDrivers
(
driverId INT ,
name string ,
ssn INT ,
location string ,
certified string,
wageplan string
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;
CREATE EXTERNAL TABLE
IF NOT EXISTS DriversExternal
(
driverId INT ,
name string ,
ssn INT ,
location string ,
certified string,
wageplan string
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;
Command : desc extended drivers
Step 01 : Download the driver data file from here
Step 02 : Copy into your Linux machine on which you have hadoop installed (Please note this is not HDFS file system)
Step 03 : Execute the command in hive command line OR in Ambari
LOAD DATA LOCAL INPATH '/entechlog/hive/input/drivers.csv' OVERWRITE INTO TABLE drivers;
Step 04 : Validate the load by querying the table, After executing this command the results area in hive view will show the results.
select * from drivers order by name;
Step 05 : You can also see the HDFS file by navigating to /apps/hive/warehouse/
OR /hive/warehouse/
. This default location can be overridden by adding below line to your create table statement
LOCATION ‘HDFS path where you would live to save’
Step 01 : Download the driver data file from here
Step 02 : Upload the file to HDFS using Ambari Files view
Step 03 : Execute the command in hive command line OR in Ambari
LOAD DATA INPATH '/user/admin/hive/input/drivers.csv' OVERWRITE INTO TABLE drivers;
Step 04 : Validate the load by querying the table, After executing this command the results area in hive view will show the results
select * from drivers order by name;
SELECT COUNT(*) FROM DRIVERS;
In this article we will go over some frequently used HDFS commands Hadoop Commands The Hadoop Distributed File System …
Overview There are multiple ways to replicate data from an Amazon RDS instance to your preferred analytics platform. An …