You are on page 1of 3

root@ubuntu:/home/prasad# hadoop fs -cat /hdfsdir/exportdata.

txt
1001,srinu,30000
1002,nani,23000
1003,lakshmi,25000
1004,nelageri,65000
1005,ganeshrao,25400
1006,jaksan,32000
1007,denaesh,12000
1008,kamesh,22000
root@ubuntu:/home/prasad# hadoop fs -cat /exportdata.txt
cat: File does not exist: /exportdata.txt
root@ubuntu:/home/prasad# sqoop export --connect jdbc:mysql://localhost/data1 -table exporttab --export-dir '/hdfsdir/exportdata.txt'
13/12/06 09:28:41 INFO manager.MySQLManager: Preparing to use a MySQL streaming
resultset.
13/12/06 09:28:41 INFO tool.CodeGenTool: Beginning code generation
13/12/06 09:28:41 INFO manager.SqlManager: Executing SQL statement: SELECT t.* F
ROM `exporttab` AS t LIMIT 1
13/12/06 09:28:41 INFO manager.SqlManager: Executing SQL statement: SELECT t.* F
ROM `exporttab` AS t LIMIT 1
13/12/06 09:28:41 INFO orm.CompilationManager: HADOOP_HOME is /usr/lib/hadoop
13/12/06 09:28:41 INFO orm.CompilationManager: Found hadoop core jar at: /usr/li
b/hadoop/hadoop-0.20.2-cdh3u5-core.jar
13/12/06 09:28:44 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-root
/compile/ebe3133a942338a73820b052d370c7e5/exporttab.jar
13/12/06 09:28:44 INFO mapreduce.ExportJobBase: Beginning export of exporttab
13/12/06 09:28:48 INFO input.FileInputFormat: Total input paths to process : 1
13/12/06 09:28:48 INFO input.FileInputFormat: Total input paths to process : 1
13/12/06 09:28:49 INFO mapred.JobClient: Running job: job_201312060044_0004
13/12/06 09:28:50 INFO mapred.JobClient: map 0% reduce 0%
13/12/06 09:29:00 INFO mapred.JobClient: map 100% reduce 0%
13/12/06 09:29:02 INFO mapred.JobClient: Job complete: job_201312060044_0004
13/12/06 09:29:02 INFO mapred.JobClient: Counters: 16
13/12/06 09:29:02 INFO mapred.JobClient: Job Counters
13/12/06 09:29:02 INFO mapred.JobClient:
SLOTS_MILLIS_MAPS=10559
13/12/06 09:29:02 INFO mapred.JobClient:
Total time spent by all reduces wai
ting after reserving slots (ms)=0
13/12/06 09:29:02 INFO mapred.JobClient:
Total time spent by all maps waitin
g after reserving slots (ms)=0
13/12/06 09:29:02 INFO mapred.JobClient:
Launched map tasks=1
13/12/06 09:29:02 INFO mapred.JobClient:
Data-local map tasks=1
13/12/06 09:29:02 INFO mapred.JobClient:
SLOTS_MILLIS_REDUCES=0
13/12/06 09:29:02 INFO mapred.JobClient: FileSystemCounters
13/12/06 09:29:02 INFO mapred.JobClient:
HDFS_BYTES_READ=269
13/12/06 09:29:02 INFO mapred.JobClient:
FILE_BYTES_WRITTEN=69909
13/12/06 09:29:02 INFO mapred.JobClient: Map-Reduce Framework
13/12/06 09:29:02 INFO mapred.JobClient:
Map input records=8
13/12/06 09:29:02 INFO mapred.JobClient:
Physical memory (bytes) snapshot=81
145856
13/12/06 09:29:02 INFO mapred.JobClient:
Spilled Records=0
13/12/06 09:29:02 INFO mapred.JobClient:
CPU time spent (ms)=1150
13/12/06 09:29:02 INFO mapred.JobClient:
Total committed heap usage (bytes)=
39911424
13/12/06 09:29:02 INFO mapred.JobClient:
Virtual memory (bytes) snapshot=408
338432
13/12/06 09:29:02 INFO mapred.JobClient:
Map output records=8
13/12/06 09:29:02 INFO mapred.JobClient:
SPLIT_RAW_BYTES=115
13/12/06 09:29:02 INFO mapreduce.ExportJobBase: Transferred 269 bytes in 16.7519
seconds (16.0578 bytes/sec)
13/12/06 09:29:02 INFO mapreduce.ExportJobBase: Exported 8 records.

root@ubuntu:/home/prasad# sqoop eval --connect jdbc:mysql://localhost/data1 --qu


ery "select * from exporttab"
13/12/06 09:31:44 INFO manager.MySQLManager: Preparing to use a MySQL streaming
resultset.
---------------------------------------------------| exid
| exname
| exsal
|
---------------------------------------------------| 1001
| srinu
| 30000
|
| 1002
| nani
| 23000
|
| 1003
| lakshmi
| 25000
|
| 1004
| nelageri
| 65000
|
| 1005
| ganeshrao
| 25400
|
| 1006
| jaksan
| 32000
|
| 1007
| denaesh
| 12000
|
| 1008
| kamesh
| 22000
|
---------------------------------------------------root@ubuntu:/home/prasad# mysql -p root -u
mysql: option '-u' requires an argument
root@ubuntu:/home/prasad# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 70
Server version: 5.1.49-1ubuntu8 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show tables
-> ;
ERROR 1046 (3D000): No database selected
mysql> show datadases;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'datad
ases' at line 1
mysql> show databases;
+--------------------+
| Database
|
+--------------------+
| information_schema |
| Chaitu_Lab
|
| Gopal_Lab
|
| NewYearDB
|
| RK
|
| Roja
|
| data1
|
| mysql
|
| sampledb
|
| week5
|
+--------------------+
10 rows in set (0.00 sec)
mysql> use data1;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> shoe tables;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'shoe
tables' at line 1
mysql> show tables;
+-----------------+
| Tables_in_data1 |
+-----------------+
| dept
|
| emptable
|
| evalTest
|
| exporttab
|
+-----------------+
4 rows in set (0.00 sec)
mysql> select * from exporttab;
+------+-----------+-------+
| exid | exname
| exsal |
+------+-----------+-------+
| 1001 | srinu
| 30000 |
| 1002 | nani
| 23000 |
| 1003 | lakshmi | 25000 |
| 1004 | nelageri | 65000 |
| 1005 | ganeshrao | 25400 |
| 1006 | jaksan
| 32000 |
| 1007 | denaesh | 12000 |
| 1008 | kamesh
| 22000 |
+------+-----------+-------+
8 rows in set (0.00 sec)
mysql> quit;

You might also like