Member since
10-01-2015
3933
Posts
1150
Kudos Received
374
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 3663 | 05-03-2017 05:13 PM | |
| 3018 | 05-02-2017 08:38 AM | |
| 3280 | 05-02-2017 08:13 AM | |
| 3223 | 04-10-2017 10:51 PM | |
| 1690 | 03-28-2017 02:27 AM |
02-05-2016
06:36 PM
5 Kudos
WebHCat # this will execute a hive query and save result to hdfs file in your home directory called output curl -s -d execute="select+*+from+sample_08;" \
-d statusdir="output" \
'http://localhost:50111/templeton/v1/hive?user.name=root' # if you ls on the directory, it will have two files, stderr and stdout hdfs dfs -ls output # if the job succeeded, you can cat the stdout file and view the results hdfs dfs -cat output/stdout WebHDFS # list the output directory, notice the webhdfs port curl -i "http://sandbox.hortonworks.com:50070/webhdfs/v1/user/root/output/?op=LISTSTATUS" # read the output file curl -i -L "http://sandbox.hortonworks.com:50070/webhdfs/v1/user/root/output/stdout?op=OPEN" # rename a file, if you get dr. who error, add &user.name=root or any other user in the context curl -i -X PUT "sandbox.hortonworks.com:50070/webhdfs/v1/user/root/output/stdout?op=RENAME&user.name=root&destination=/user/root/newname" # read the output of the new file curl -i -L "http://sandbox.hortonworks.com:50070/webhdfs/v1/user/root/newname?op=OPEN"
... View more
Labels:
02-05-2016
06:27 PM
6 Kudos
Sqoop # Sandbox 2.3.2 # using postgres ambari database # edit pg_hba.conf file in /var/lib/pgsql/data # Add the following line as the first line of pg_hba.conf. It allows access to all databases for all users with an encrypted password: ********************************
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 0.0.0.0/0 md5
********************************
### POSTGRES ### su postgres
psql
\c ambari
#list all tables
\dt ambari.*
select * from ambari.hosts;
### SQOOP ### #check sqoop version sqoop version # get list of commands sqoop help # more command specific sqoop help import ### DEMO ### # Download Postgres Driver curl -L 'http://jdbc.postgresql.org/download/postgresql-9.2-1002.jdbc4.jar' -o postgresql-9.2-1002.jdbc4.jar # put in the sqoop library sudo cp postgresql-9.2-1002.jdbc4.jar /usr/hdp/current/sqoop-client/lib/ # list tables in ambari database / username ambari password bigdata sqoop list-tables --connect jdbc:postgresql://127.0.0.1/ambari --username ambari -P # sqoop ambari hosts table into hdfs su guestsqoop import --connect jdbc:postgresql://127.0.0.1/ambari --username ambari -P --table hosts --target-dir /user/guest/ambari_hosts_table # HDFS view the file hdfs dfs -cat /user/guest/ambari_hosts_table/part-m-00000 # sqoop ambari hosts table into hdfs using --direct sqoop import --connect jdbc:postgresql://127.0.0.1/ambari --username ambari -password bigdata --table hosts --target-dir /user/guest/ambari_hosts_table_using_direct --direct # sqoop ambari hosts table into hive sqoop import --connect jdbc:postgresql://127.0.0.1/ambari --username ambari -password bigdata --table hosts --hive-import --create-hive-table --direct # HIVE select host_name, cpu_count from hosts;
select * from hosts; # SQOOP EXPORT # Create Hive table drop table if exists export_table;
create table export_table (
key int,
value string
)
row format delimited
fields terminated by ",";
# populate Hive with dummy data insert into export_table values("1", "ExportedValue"); # confirm Hive table has data select * from export_table; # display the values in hive as hdfs files hdfs dfs -cat /apps/hive/warehouse/export_table/000000_0 # export table to MySQL # MySQL table must exist su mysql
mysql -u root
create database export;
use export;
create table exported (rowkey int, value varchar(20));
exit;
# on HDP 2.3.2 Sandbox, SQOOP-1400 bug, use --driver com.mysql.jdbc driver to overcome the problem # sqoop export from a Hive table into MySQL sqoop export --connect jdbc:mysql://127.0.0.1/export --username hive --password hive --table exported --direct --export-dir /apps/hive/warehouse/export_table --driver com.mysql.jdbc.Driver # login to Mysql and check the table su mysql
mysql -u root
use export;
select * from exported;exit;
... View more
Labels:
02-05-2016
05:49 PM
1 Kudo
did you create a Twitter application as the guidelines of Twitter api request? You also need Access Token and Access Secret. link @Malek Ben Salem
... View more
02-05-2016
05:47 PM
provide core-site.xml and hdfs-site.xml for the remote cluster @cokorda putra susila
... View more
02-05-2016
05:45 PM
re-accepted so you can get points @keerthana gajarajakumar
... View more
02-05-2016
05:42 PM
@rbalam
here you go, a bit more recent version of the document you followed link
... View more
02-05-2016
04:56 PM
@keerthana gajarajakumar can you accept the best answer and any possible consecutive problem can be addressed in a new question?
... View more
02-05-2016
04:17 PM
1 Kudo
@John Smith if you identified another bug, I'm going to buy a lottery ticket.
... View more