Guest User

Untitled

a guest
Nov 12th, 2017
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. scala> val hc = new org.apache.spark.sql.hive.HiveContext(sc)
  2. warning: there was one deprecation warning; re-run with -deprecation for details
  3. hc: org.apache.spark.sql.hive.HiveContext = org.apache.spark.sql.hive.HiveContext@6dde913e
  4.  
  5. scala> hc.setConf("hive.metastore.uris","thrift://127.0.0.1:9083")
  6.  
  7. scala> val df = hc.sql("show databases")
  8. df: org.apache.spark.sql.DataFrame = [databaseName: string]
  9.  
  10. scala> df.show
  11. +------------+
  12. |databaseName|
  13. +------------+
  14. | default|
  15. +------------+
  16.  
  17.  
  18. scala> val dfTables = hc.sql("show tables");
  19. dfTables: org.apache.spark.sql.DataFrame = [database: string, tableName: string ... 1 more field]
  20.  
  21. scala> dfTables.show
  22. +--------+---------+-----------+
  23. |database|tableName|isTemporary|
  24. +--------+---------+-----------+
  25. +--------+---------+-----------+
  26.  
  27. hive> show databases;
  28. OK
  29. default
  30. mydbbackup
  31. Time taken: 7.593 seconds, Fetched: 2 row(s)
  32. hive> use mydbbackup;
  33. OK
  34. Time taken: 0.021 seconds
  35. hive> show tables;
  36. OK
  37. customers
  38. customerspart
  39. customerspart1
  40. Time taken: 0.194 seconds, Fetched: 3 row(s)
  41. hive>
  42.  
  43. <configuration>
  44. <property>
  45. <name>javax.jdo.option.ConnectionURL</name>
  46. <value>jdbc:derby:;databaseName=/home/hduser/apache-hive-2.3.0-bin/metastore_db;create=true</value>
  47. <description>
  48. JDBC connect string for a JDBC metastore.
  49. To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
  50. For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
  51. </description>
  52. </property>
  53. <property>
  54. <name>hive.metastore.warehouse.dir</name>
  55. <value>/user/hive/warehouse</value>
  56. <description>location of default database for the warehouse</description>
  57. </property>
  58. <property>
  59. <name>hive.metastore.uris</name>
  60. <value/>
  61. <description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
  62. </property>
  63. <property>
  64. <name>javax.jdo.option.ConnectionDriverName</name>
  65. <value>org.apache.derby.jdbc.EmbeddedDriver</value>
  66. <description>Driver class name for a JDBC metastore</description>
  67. </property>
  68. <property>
  69. <name>javax.jdo.PersistenceManagerFactoryClass</name>
  70. <value>org.datanucleus.api.jdo.JDOPersistenceManagerFactory</value>
  71. <description>class implementing the jdo persistence</description>
  72. </property>
  73. </configuration>
  74.  
  75. total 40
  76. drwxr-xr-x 2 root root 4096 Nov 12 20:22 ./
  77. drwxr-xr-x 12 root root 4096 Nov 9 22:57 ../
  78. -rw-r--r-- 1 root root 996 Nov 9 22:57 docker.properties.template
  79. -rw-r--r-- 1 root root 1105 Nov 9 22:57 fairscheduler.xml.template
  80. -rw-r--r-- 1 root root 2025 Nov 9 22:57 log4j.properties.template
  81. -rw-r--r-- 1 root root 7313 Nov 9 22:57 metrics.properties.template
  82. -rw-r--r-- 1 root root 865 Nov 9 22:57 slaves.template
  83. -rw-r--r-- 1 root root 1292 Nov 9 22:57 spark-defaults.conf.template
  84. -rwxr-xr-x 1 root root 3699 Nov 9 22:57 spark-env.sh.template*
Add Comment
Please, Sign In to add comment