-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathblah
180 lines (152 loc) · 5.55 KB
/
blah
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Databricks notebook source
# MAGIC %sh
# MAGIC ls -l /databricks/jars/recordservice-spark-2.0.jar
# COMMAND ----------
# MAGIC %sh
# MAGIC echo '[driver]."spark.recordservice.planner.hostports" = "10.180.45.243:50075"' >> /databricks/common/conf/cerebro.conf
# COMMAND ----------
# MAGIC %fs
# MAGIC rm /databricks/init/test-1/clear-metastore.sh
# COMMAND ----------
# MAGIC %scala
# MAGIC import com.cerebro.recordservice.spark
# COMMAND ----------
# MAGIC %scala
# MAGIC val df = spark.read.format("com.cerebro.recordservice.spark").load("db.table")
# MAGIC display(df)
# COMMAND ----------
# MAGIC %sh
# MAGIC cat conf/spark-branch.conf
# COMMAND ----------
# MAGIC %sh
# MAGIC cat conf/00-custom-spark.conf
# COMMAND ----------
# MAGIC %fs
# MAGIC rm /databricks/init/test-1/add-metastore.sh
# COMMAND ----------
# MAGIC %scala
# MAGIC
# MAGIC dbutils.fs.put(
# MAGIC "/databricks/init/test-1/add-metastore.sh",
# MAGIC """#!/bin/sh
# MAGIC |# Loads environment variables to determine the correct JDBC driver to use.
# MAGIC |source /etc/environment
# MAGIC |# Quoting the label (i.e. EOF) with single quotes to disable variable interpolation.
# MAGIC |cat > /databricks/hive/conf/hive-site.xml << 'EOM'
# MAGIC
# MAGIC |foo
# MAGIC |<configuration>
# MAGIC |<property>
# MAGIC |<name>javax.jdo.option.ConnectionURL</name>
# MAGIC |<value>jdbc:mariadb://nikedirect-db.chkweekm4xjq.us-east-1.rds.amazonaws.com:3306/organization0?trustServerCertificate=true&useSSL=true</value>
# MAGIC |<description>JDBC connect string for a JDBC metastore</description>
# MAGIC | </property>
# MAGIC |
# MAGIC |<property>
# MAGIC |<name>javax.jdo.option.ConnectionDriverName</name>
# MAGIC |<value>org.mariadb.jdbc.Driver</value>
# MAGIC |<description>Driver class name for a JDBC metastore</description>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC |<name>javax.jdo.option.ConnectionUserName</name>
# MAGIC |<value>l2lu3DUYHtCQTdjd</value>
# MAGIC |<description>Username to use against metastore database</description>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC |<name>javax.jdo.option.ConnectionPassword</name>
# MAGIC |<value>T65nQrSRCaW3TVO4K5RTuLLP636K9nlhkv3wSkI1</value>
# MAGIC |<description>Password to use against metastore database</description>
# MAGIC |</property> <!-- If the following two properties are not set correctly, the metastore will attempt to initialize its schema upon startup -->
# MAGIC
# MAGIC |<property>
# MAGIC |<name>datanucleus.autoCreateSchema</name>
# MAGIC |<value>false</value>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC |<name>datanucleus.fixedDatastore</name>
# MAGIC |<value>true</value>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC |<name>datanucleus.connectionPool.minPoolSize</name>
# MAGIC |<value>0</value>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC |<name>datanucleus.connectionPool.initialPoolSize</name>
# MAGIC |<value>0</value>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC |<name>datanucleus.connectionPool.maxPoolSize</name>
# MAGIC |<value>1</value>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC |<name>hive.stats.autogather</name>
# MAGIC |<value>false</value>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC |<name>mapred.reduce.tasks</name>
# MAGIC |<value>100</value>
# MAGIC |</property>
# MAGIC
# MAGIC |<!-- To mitigate the problem of PROD-4498 and per HIVE-7140, we need to bump the timeout. Since the default value of this property used by Impala is 3600 seconds, we will use this value for actual deployment (http://www.cloudera.com/content/cloudera/en/documentation/core/latest/topics/cm_props_cdh530_impala.html). -->
# MAGIC |<property>
# MAGIC |<name>hive.metastore.client.socket.timeout</name>
# MAGIC |<value>3600</value>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC |<name>hive.metastore.client.connect.retry.delay</name>
# MAGIC |<value>10</value>
# MAGIC |</property>
# MAGIC
# MAGIC |<property>
# MAGIC | <name>hive.metastore.failure.retries</name>
# MAGIC |<value>30</value>
# MAGIC | </property>
# MAGIC
# MAGIC |<property>
# MAGIC | <name>recordservice.planner.hostports</name>
# MAGIC | <value>10.180.45.243:50075</value>
# MAGIC | </property>
# MAGIC
# MAGIC | <property>
# MAGIC | <name>hive.metastore.rawstore.impl</name>
# MAGIC | <value>com.cerebro.hive.metastore.CerebroObjectStore</value>
# MAGIC | </property>
# MAGIC
# MAGIC |</configuration>
# MAGIC 'EOM'
# MAGIC """.stripMargin)
# COMMAND ----------
# MAGIC %fs
# MAGIC head /databricks/init/external-metastore.sh
# COMMAND ----------
# MAGIC %sh
# MAGIC cat /databricks/hive/conf/hive-site.xml
# COMMAND ----------
# MAGIC %fs
# MAGIC mkdirs /databricks/init/test-1
# COMMAND ----------
# MAGIC %scala
# MAGIC
# MAGIC dbutils.fs.put(
# MAGIC "/databricks/init/test-1/clear-metastore.sh",
# MAGIC """#!/bin/sh
# MAGIC |# Loads environment variables to determine the correct JDBC driver to use.
# MAGIC |source /etc/environment
# MAGIC |# Quoting the label (i.e. EOF) with single quotes to disable variable interpolation.
# MAGIC |rm /databricks/driver/conf/00-custom-spark.conf
# MAGIC
# MAGIC """
# MAGIC )
# COMMAND ----------
# MAGIC %fs
# MAGIC head /databricks/init/test-1/clear-metastore.sh
# COMMAND ----------