Guest User

Untitled

a guest
Nov 14th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. sqoop-import-all-tables --verbose --connect jdbc:mysql://X.X.X.X/edgeowt --username root -P --hive-import --warehouse-dir /user/hive/warehouse --hive-database edgeowt.db --hive-overwrite
  2.  
  3. INFO hive.HiveImport: FAILED: SemanticException [Error 10072]: Database does not exist: edgeowt.db
  4. 15/04/16 13:32:09 ERROR tool.ImportAllTablesTool: Encountered IOException running import job: java.io.IOException: Hive exited with status 88
  5.  
  6. $HIVE_HOME/bin>beeline
  7. beeline> !connect jdbc:hive2://localhost:10000 scott tiger org.apache.hive.jdbc.HiveDriver
  8. 0: jdbc:hive2://localhost:10000> show databases;
  9. +----------------+--+
  10. | database_name |
  11. +----------------+--+
  12. | default |
  13. | edgeowt |
  14. +----------------+--+
  15.  
  16. Permission Owner Group Size Replication Block Size Name
  17. drwxr-xr-x hduser supergroup 0 B 0 0 B candidate
  18. drwxr-xr-x scott supergroup 0 B 0 0 B edgeowt.db
  19. drwxr-xr-x scott supergroup 0 B 0 0 B hd_temperature
  20.  
  21. 0: jdbc:hive2://localhost:10000>GRANT ALL ON DATABASE edgeowt TO USER hduser;
  22.  
  23. 0: jdbc:hive2://localhost:10000> SHOW GRANT ON DATABASE edgeowt;
  24. +-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+--+
  25. | database | table | partition | column | principal_name | principal_type | privilege | grant_option | grant_time | grantor |
  26. +-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+--+
  27. | edgeowt | | | | admin | ROLE | ALL | false | 1429170366000 | scott |
  28. | edgeowt | | | | hduser | USER | ALL | false | 1429170906000 | scott |
  29. +-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+--+
  30.  
  31. # Set JAVA_HOME (we will also configure JAVA_HOME directly for Hadoop later on)
  32. export JAVA_HOME=/usr/lib/jvm/java-7-oracle
  33. # Set Hadoop-related environment variables
  34. export HADOOP_INSTALL=/opt/hadoop
  35. export PATH=$PATH:$HADOOP_INSTALL/bin
  36. export PATH=$PATH:$HADOOP_INSTALL/sbin
  37. export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
  38. export HADOOP_COMMON_HOME=$HADOOP_INSTALL
  39. export HADOOP_HDFS_HOME=$HADOOP_INSTALL
  40. export YARN_HOME=$HADOOP_INSTALL
  41. export HADOOP_HOME=$HADOOP_INSTALL
  42.  
  43. # Set hive home
  44. export HIVE_HOME=/opt/hive
  45. export PATH=$PATH:$HIVE_HOME/bin
  46.  
  47. # Set HCatlog home
  48. export HCAT_HOME=$HIVE_HOME/hcatalog
  49. export PATH=$PATH:$HCAT_HOME/bin
  50.  
  51. # Set Sqoop home
  52. export HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=$HADOOP_HOME/lib/native"
  53. export SQOOP_HOME=/opt/sqoop
  54. export SQOOP_CONF_DIR="$SQOOP_HOME/conf"
  55. export SQOOP_CLASSPATH="$SQOOP_CONF_DIR"
  56. export PATH=$PATH:$SQOOP_HOME/bin
  57.  
  58. sqoop-import-all-tables --verbose --connect jdbc:mysql://X.X.X.X/edgeowt --username root -P --hive-import --warehouse-dir /user/hive/warehouse --hive-database edgeowt --hive-overwrite
  59.  
  60. sqoop-import-all-tables --connect jdbc:mysql://X.X.X.X/edgeowt --username root -P --hive-import --hive-database edgeowt --hive-overwrite -m 4
  61.  
  62. sqoop-import-all-tables --verbose --connect jdbc:mysql://X.X.X.X/edgeowt --username root -P --hive-import --warehouse-dir /user/hive/warehouse --hive-table edgeowt.db --hive-overwrite
  63.  
  64. #!/bin/sh
  65. #tabfold="/usr/local/hivetables"
  66. #cd $tabfold
  67. mysql -u $1 -p$2 -N information_schema -e "select table_name from tables where table_schema = '$3'" > /usr/local/hivetables/tables.txt
  68. HOSTFILE="/usr/local/hivetables/tables.txt"
  69. for host in $(cat $HOSTFILE)
  70. do
  71. $SQOOP_HOME/bin/sqoop import --connect jdbc:mysql://localhost:3306/$3 --table $host --username $1 --password $2 --hive-import --hive-table $4.$host --warehouse-dir /user/hive/warehouse
  72. done
  73.  
  74. sudo cp /etc/impala/conf.dist/hive-site.xml /etc/sqoop/conf/
  75. sudo cp /etc/impala/conf.dist/hive-site.xml /etc/sqoop/conf.cloudera.sqoop_client/
Add Comment
Please, Sign In to add comment