-
Notifications
You must be signed in to change notification settings - Fork 6
/
makefile
181 lines (166 loc) · 6.37 KB
/
makefile
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
180
181
pwd := $(shell pwd)
ipaddr := $(shell hostname -I | cut -d ' ' -f 1)
gcp_project := du-hast-mich
region := asia-east1
workerType := e2-standard-2
workerZone := b
job := raycom-streaming
pubsub_topic := firebase-rt-topic
pubsub_sub := firebase-rt-sub
bq_firebase_schema := bq_firebase.json
bq_storageWriteApiTriggeringFrequencySec := 60
gcs_bucket := bindiego
jdbcuri := jdbc:mysql://10.140.0.3:3306/gcp
jdbcusr := gcp
jdbcpwd := gcp2020
bigtable_instance := bigbase
eshost := https://k8es.ingest.bindiego.com
esuser := elastic
espass := changeme
esindex := raycom-dataflow-ingest
esBatchSize := 2000
esBatchBytes := 10485760
esNumThread := 2
esIsIgnoreInsecureSSL := false
isBasic := true
clean:
@mvn clean
build:
@mvn compile
dfup: build
@mvn -Pdataflow-runner compile exec:java \
-Dexec.mainClass=bindiego.BindiegoStreaming \
-Dexec.cleanupDaemonThreads=false \
-Dexec.args="--project=$(gcp_project) \
--streaming=true \
--enableStreamingEngine \
--autoscalingAlgorithm=THROUGHPUT_BASED \
--maxNumWorkers=20 \
--workerMachineType=$(workerType) \
--diskSizeGb=64 \
--numWorkers=3 \
--tempLocation=gs://$(gcs_bucket)/tmp/ \
--gcpTempLocation=gs://$(gcs_bucket)/tmp/gcp/ \
--gcsTempLocation=gs://$(gcs_bucket)/tmp/gcs/ \
--stagingLocation=gs://$(gcs_bucket)/staging/ \
--runner=DataflowRunner \
--experiments=use_runner_v2 \
--topic=projects/$(gcp_project)/topics/$(pubsub_topic) \
--subscription=projects/$(gcp_project)/subscriptions/$(pubsub_sub) \
--numShards=1 \
--windowSize=6s \
--allowedLateness=8s \
--earlyFiringPeriod=2s \
--lateFiringCount=1 \
--filenamePrefix=raycom. \
--outputDir=gs://$(gcs_bucket)/raycom/out/ \
--errOutputDir=gs://$(gcs_bucket)/raycom/out/err/ \
--bqSchema=gs://$(gcs_bucket)/raycom/schemas/$(bq_firebase_schema) \
--bqOutputTable=$(gcp_project):raycom.firebase_rt \
--storageWriteApiTriggeringFrequencySec=$(bq_storageWriteApiTriggeringFrequencySec) \
--avroSchema=gs://$(gcs_bucket)/raycom/schemas/dingoactions.avsc \
--btInstanceId=$(bigtable_instance) \
--btTableIdTall=bttall \
--btTableIdWide=btwide \
--jdbcClass=com.mysql.cj.jdbc.Driver \
--jdbcConn=$(jdbcuri) \
--jdbcUsername=$(jdbcusr) \
--jdbcPassword=$(jdbcpwd) \
--esHost=$(eshost) \
--esUser=$(esuser) \
--esPass=$(espass) \
--esIndex=$(esindex) \
--esMaxBatchSize=$(esBatchSize) \
--esMaxBatchBytes=$(esBatchBytes) \
--esNumThread=$(esNumThread) \
--esIsIgnoreInsecureSSL=$(esIsIgnoreInsecureSSL) \
--defaultWorkerLogLevel=INFO \
--jobName=$(job) \
--update \
--region=$(region) \
--isBasic=$(isBasic)"
#--workerZone=$(region)-$(workerZone) \
df: build
@mvn -Pdataflow-runner compile exec:java \
-Dexec.mainClass=bindiego.BindiegoStreaming \
-Dexec.cleanupDaemonThreads=false \
-Dexec.args="--project=$(gcp_project) \
--streaming=true \
--enableStreamingEngine \
--autoscalingAlgorithm=THROUGHPUT_BASED \
--maxNumWorkers=20 \
--workerMachineType=$(workerType) \
--diskSizeGb=64 \
--numWorkers=3 \
--tempLocation=gs://$(gcs_bucket)/tmp/ \
--gcpTempLocation=gs://$(gcs_bucket)/tmp/gcp/ \
--gcsTempLocation=gs://$(gcs_bucket)/tmp/gcs/ \
--stagingLocation=gs://$(gcs_bucket)/staging/ \
--runner=DataflowRunner \
--experiments=use_runner_v2 \
--topic=projects/$(gcp_project)/topics/$(pubsub_topic) \
--subscription=projects/$(gcp_project)/subscriptions/$(pubsub_sub) \
--numShards=1 \
--windowSize=6s \
--allowedLateness=8s \
--earlyFiringPeriod=2s \
--lateFiringCount=1 \
--filenamePrefix=raycom. \
--outputDir=gs://$(gcs_bucket)/raycom/out/ \
--errOutputDir=gs://$(gcs_bucket)/raycom/out/err/ \
--bqSchema=gs://$(gcs_bucket)/raycom/schemas/$(bq_firebase_schema) \
--bqOutputTable=$(gcp_project):raycom.firebase_rt \
--storageWriteApiTriggeringFrequencySec=$(bq_storageWriteApiTriggeringFrequencySec) \
--avroSchema=gs://$(gcs_bucket)/raycom/schemas/dingoactions.avsc \
--btInstanceId=$(bigtable_instance) \
--btTableIdTall=bttall \
--btTableIdWide=btwide \
--jdbcClass=com.mysql.cj.jdbc.Driver \
--jdbcConn=$(jdbcuri) \
--jdbcUsername=$(jdbcusr) \
--jdbcPassword=$(jdbcpwd) \
--esHost=$(eshost) \
--esUser=$(esuser) \
--esPass=$(espass) \
--esIndex=$(esindex) \
--esMaxBatchSize=$(esBatchSize) \
--esMaxBatchBytes=$(esBatchBytes) \
--esNumThread=$(esNumThread) \
--esIsIgnoreInsecureSSL=$(esIsIgnoreInsecureSSL) \
--defaultWorkerLogLevel=INFO \
--jobName=$(job) \
--region=$(region) \
--isBasic=$(isBasic)"
#--workerZone=$(region)-$(workerZone) \
cancel:
@gcloud dataflow jobs cancel $(job) --region=$(region)
drain:
@gcloud dataflow jobs drain $(job) --region=$(region)
btcluster:
@cbt createinstance $(bigtable_instance) "Bigbase" bigbaby $(region)-a 1 SSD
btrelease:
@cbt deleteinstance $(bigtable_instance)
btinit:
@cbt createtable bttall && \
cbt createfamily bttall stats && \
cbt createfamily bttall window_info
-cbt ls bttall
@cbt createtable btwide && \
cbt createfamily btwide stats
-cbt ls btwide
btclear:
@-cbt deletetable bttall
@-cbt deletetable btwide
btdata:
@-echo "============= Tall ================"; cbt read bttall count=10
@-echo "============= Wide ================"; cbt read btwide count=10
pubsub_init:
@-gcloud pubsub topics create $(pubsub_topic)
@-gcloud pubsub subscriptions create $(pubsub_sub) --topic=$(pubsub_topic) --topic-project=$(gcp_project)
gcs_init:
@-gcloud storage buckets create gs://$(gcs_bucket) --project=$(gcp_project) --default-storage-class=STANDARD --location=$(region) --uniform-bucket-level-access
@-gsutil cp schemas/$(bq_firebase_schema) gs://$(gcs_bucket)/raycom/schemas/$(bq_firebase_schema)
@-gsutil cp schemas/dingoactions.avsc gs://$(gcs_bucket)/raycom/schemas/dingoactions.avsc
bq_init:
@-bq --location=US mk --dataset raycom
.PHONY: df dfup cancel drain btcluster btinit btdata btclear btrelease pubsub_init gcs_init build clean