背景:偏好种类过多,每次创建、完善画像hql工作量巨大。为了解决此问题,将hql配置化生成,并且使用spark运行。
由于不同的偏好量不同,脚本动态分配资源,直接上代码!
脚本:sh /....../prefer_res_normal.sh 参数1 参数2 21840 (21840约等于偏好M数,必须为840的倍数)
#!/bin/bash
partitions=`expr ${3} / 140`
numexe=`expr ${3} / 840`
--master yarn \
--driver-memory 4G \
--driver-cores 1 \
--num-executors ${numexe} \
--executor-memory 12G \
--executor-cores 2 \
--conf spark.default.parallelism=${partitions} \
--conf spark.sql.shuffle.partitions=${partitions} \
--conf spark.storage.memoryFraction=0.5 \
--conf spark.shuffle.memoryFraction=0.3 \
--conf spark.shuffle.io.maxRetries=30 \
--conf spark.shuffle.io.retryWait=30s \
--conf spark.network.timeout=300 \
--conf spark.reducer.maxSizeInFlight=96m \
--conf spark.shuffle.sort.bypassMergeThreshold=1000 \
--conf spark.executor.logs.rolling.maxRetainedFiles=5 \
改了三个hive参数
hive.me