wudianlong hace 3 años
commit
13f57123b2
Se han modificado 3 ficheros con 31 adiciones y 0 borrados
  1. 5 0
      config/config.sh
  2. 19 0
      hive_ddl/saga_dw_ods.sql
  3. 7 0
      job/mysql_to_hdfs.sh

+ 5 - 0
config/config.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+MYSQL_URL=jdbc:mysql://192.168.0.76:3306/sagacloud_review?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false
+MYSQL_USER=root
+MYSQL_PASSWORD=123456

+ 19 - 0
hive_ddl/saga_dw_ods.sql

@@ -0,0 +1,19 @@
+drop table if exists ods_energy_week_day;
+create table if not exists ods_energy_week_day (
+    id integer,
+    project_id string comment "项目id",
+    `date` string comment "yyyyMMdd,日期",
+    energy_cooling decimal(10, 4) comment "中央供冷系统,能耗",
+    energy_heating decimal(10, 4)  comment "中央供热系统,能耗",
+    energy_ac_terminal decimal(10, 4) comment "空调末端系统,能耗",
+    energy_light decimal(10, 4) comment "照明系统,能耗",
+    energy_others decimal(10, 4) comment "其它,能耗",
+    create_time string comment "创建时间",
+    update_time string comment "更新时间"
+) COMMENT '能耗系统'
+ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
+STORED AS ORC
+LOCATION
+'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_energy_week_day'
+TBLPROPERTIES (
+'orc.compress'='SNAPPY');

+ 7 - 0
job/mysql_to_hdfs.sh

@@ -0,0 +1,7 @@
+#! /bin/bash
+. ../config/config.sh
+
+url=$MYSQL_URL
+user=$MYSQL_USER
+password=$MYSQL_PASSWORD
+