| I"¦E<h2 id="apache-griffin-å
¥é¨æå">Apache Griffin å
¥é¨æå</h2> |
| |
| <p>æ°æ®è´¨éæ¨¡åæ¯å¤§æ°æ®å¹³å°ä¸å¿
ä¸å¯å°çä¸ä¸ªåè½ç»ä»¶ï¼<a href="http://griffin.apache.org">Apache Griffin</a>ï¼ä»¥ä¸ç®ç§°Griffinï¼æ¯ä¸ä¸ªå¼æºçå¤§æ°æ®æ°æ®è´¨éè§£å³æ¹æ¡ï¼å®æ¯ææ¹å¤çåæµæ¨¡å¼ä¸¤ç§æ°æ®è´¨éæ£æµæ¹å¼ï¼å¯ä»¥ä»ä¸åç»´åº¦ï¼æ¯å¦ç¦»çº¿ä»»å¡æ§è¡å®æ¯åæ£æ¥æºç«¯åç®æ ç«¯çæ°æ®æ°éæ¯å¦ä¸è´ãæºè¡¨çæ°æ®ç©ºå¼æ°éçï¼åº¦éæ°æ®èµäº§ï¼ä»èæåæ°æ®çå确度ãå¯ä¿¡åº¦ã</p> |
| |
| <p>å¨Griffinçæ¶æä¸ï¼ä¸»è¦å为DefineãMeasureåAnalyzeä¸ä¸ªé¨åï¼å¦ä¸å¾æç¤ºï¼</p> |
| |
| <p><img src="/images/arch-1.png" alt="arch" /></p> |
| |
| <p>åé¨åçèè´£å¦ä¸ï¼</p> |
| |
| <ul> |
| <li>Defineï¼ä¸»è¦è´è´£å®ä¹æ°æ®è´¨éç»è®¡çç»´åº¦ï¼æ¯å¦æ°æ®è´¨éç»è®¡çæ¶é´è·¨åº¦ãç»è®¡çç®æ ï¼æºç«¯åç®æ ç«¯çæ°æ®æ°éæ¯å¦ä¸è´ï¼æ°æ®æºéæä¸å段çéç©ºçæ°éãä¸éå¤å¼çæ°éãæå¤§å¼ãæå°å¼ãtop5ç弿°éçï¼</li> |
| <li>Measureï¼ä¸»è¦è´è´£æ§è¡ç»è®¡ä»»å¡ï¼çæç»è®¡ç»æ</li> |
| <li>Analyzeï¼ä¸»è¦è´è´£ä¿åä¸å±ç¤ºç»è®¡ç»æ</li> |
| </ul> |
| |
| <p>åºäºä»¥ä¸åè½ï¼æä»¬å¤§æ°æ®å¹³å°è®¡åå¼å
¥Griffinä½ä¸ºæ°æ®è´¨éè§£å³æ¹æ¡ï¼å®ç°æ°æ®ä¸è´æ§æ£æ¥ã空å¼ç»è®¡çåè½ã以䏿¯å®è£
æ¥éª¤æ»ç»ï¼</p> |
| |
| <h3 id="å®è£
é¨ç½²">å®è£
é¨ç½²</h3> |
| |
| <h4 id="ä¾èµåå¤">ä¾èµåå¤</h4> |
| |
| <ul> |
| <li>JDK (1.8 or later versions)</li> |
| <li>MySQL(version 5.6å以ä¸)</li> |
| <li>Hadoop (2.6.0 or later)</li> |
| <li>Hive (version 2.x)</li> |
| <li>Spark (version 2.2.1)</li> |
| <li>Livyï¼livy-0.5.0-incubatingï¼</li> |
| <li>ElasticSearch (5.0 or later versions)</li> |
| </ul> |
| |
| <h4 id="åå§å">åå§å</h4> |
| |
| <p>åå§åæä½å
·ä½è¯·åè<a href="https://github.com/apache/griffin/blob/master/griffin-doc/deploy/deploy-guide.md">Apache Griffin Deployment Guide</a>ï¼ç±äºæçæµè¯ç¯å¢ä¸Hadoopé群ãHiveé群已æå¥½ï¼æ
è¿éçç¥HadoopãHiveå®è£
æ¥éª¤ï¼åªä¿çæ·è´é
ç½®æä»¶ãé
ç½®Hadoopé
ç½®æä»¶ç®å½æ¥éª¤ã</p> |
| |
| <p>1ãMySQLï¼</p> |
| |
| <p>å¨MySQLä¸åå»ºæ°æ®åºquartzï¼ç¶åæ§è¡<a href="https://github.com/apache/griffin/blob/master/service/src/main/resources/Init_quartz_mysql_innodb.sql">Init_quartz_mysql_innodb.sql</a>èæ¬åå§å表信æ¯ï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mysql -u <username> -p <password> < Init_quartz_mysql_innodb.sql |
| </code></pre></div></div> |
| |
| <p>2ãHadoopåHiveï¼</p> |
| |
| <p>ä»Hadoopæå¡å¨æ·è´é
ç½®æä»¶å°Livyæå¡å¨ä¸ï¼è¿éå设å°é
ç½®æä»¶æ¾å¨/usr/data/confç®å½ä¸ã</p> |
| |
| <p>å¨Hadoopæå¡å¨ä¸å建/home/spark_confç®å½ï¼å¹¶å°Hiveçé
ç½®æä»¶hive-site.xmlä¸ä¼ å°è¯¥ç®å½ä¸ï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#å建/home/spark_confç®å½ |
| hadoop fs -mkdir -p /home/spark_conf |
| #ä¸ä¼ hive-site.xml |
| hadoop fs -put hive-site.xml /home/spark_conf/ |
| </code></pre></div></div> |
| |
| <p>3ã设置ç¯å¢åéï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#!/bin/bash |
| export JAVA_HOME=/data/jdk1.8.0_192 |
| |
| #sparkç®å½ |
| export SPARK_HOME=/usr/data/spark-2.1.1-bin-2.6.3 |
| #livyå½ä»¤ç®å½ |
| export LIVY_HOME=/usr/data/livy/bin |
| #hadoopé
ç½®æä»¶ç®å½ |
| export HADOOP_CONF_DIR=/usr/data/conf |
| </code></pre></div></div> |
| |
| <p>4ãLivyé
ç½®ï¼</p> |
| |
| <p>æ´æ°livy/confä¸çlivy.confé
ç½®æä»¶ï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>livy.server.host = 127.0.0.1 |
| livy.spark.master = yarn |
| livy.spark.deployMode = cluster |
| livy.repl.enable-hive-context = true |
| </code></pre></div></div> |
| |
| <p>å¯å¨livyï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>livy-server start |
| </code></pre></div></div> |
| |
| <p>5ãElasticsearché
ç½®ï¼</p> |
| |
| <p>å¨ESéå建griffinç´¢å¼ï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl -XPUT http://es:9200/griffin -d ' |
| { |
| "aliases": {}, |
| "mappings": { |
| "accuracy": { |
| "properties": { |
| "name": { |
| "fields": { |
| "keyword": { |
| "ignore_above": 256, |
| "type": "keyword" |
| } |
| }, |
| "type": "text" |
| }, |
| "tmst": { |
| "type": "date" |
| } |
| } |
| } |
| }, |
| "settings": { |
| "index": { |
| "number_of_replicas": "2", |
| "number_of_shards": "5" |
| } |
| } |
| } |
| ' |
| </code></pre></div></div> |
| |
| <h4 id="æºç æå
é¨ç½²">æºç æå
é¨ç½²</h4> |
| |
| <p>å¨è¿éæä½¿ç¨æºç ç¼è¯æå
çæ¹å¼æ¥é¨ç½²Griffinï¼Griffinçæºç å°åæ¯ï¼<a href="https://github.com/apache/griffin.git">https://github.com/apache/griffin.git</a>ï¼è¿éæä½¿ç¨çæºç tagæ¯griffin-0.4.0ï¼ä¸è½½å®æå¨ideaä¸å¯¼å
¥å¹¶å±å¼æºç çç»æå¾å¦ä¸ï¼</p> |
| |
| <p><img src="/images/project.jpg" alt="project" /></p> |
| |
| <p>Griffinçæºç ç»æå¾æ¸
æ°ï¼ä¸»è¦å
æ¬griffin-docãmeasureãserviceåuiå个模åï¼å
¶ä¸griffin-docè´è´£åæ¾Griffinçææ¡£ï¼measureè´è´£ä¸spark交äºï¼æ§è¡ç»è®¡ä»»å¡ï¼service使ç¨spring bootä½ä¸ºæå¡å®ç°ï¼è´è´£ç»ui模åæä¾äº¤äºæéçrestful apiï¼ä¿åç»è®¡ä»»å¡ï¼å±ç¤ºç»è®¡ç»æã</p> |
| |
| <p>æºç 导å
¥æå»ºå®æ¯åï¼éè¦ä¿®æ¹é
ç½®æä»¶ï¼å
·ä½ä¿®æ¹çé
ç½®æä»¶å¦ä¸ï¼</p> |
| |
| <p>1ãservice/src/main/resources/application.propertiesï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Apache Griffinåºç¨åç§° |
| spring.application.name=griffin_service |
| # MySQLæ°æ®åºé
ç½®ä¿¡æ¯ |
| spring.datasource.url=jdbc:mysql://10.xxx.xx.xxx:3306/griffin_quartz?useSSL=false |
| spring.datasource.username=xxxxx |
| spring.datasource.password=xxxxx |
| spring.jpa.generate-ddl=true |
| spring.datasource.driver-class-name=com.mysql.jdbc.Driver |
| spring.jpa.show-sql=true |
| # Hive metastoreé
ç½®ä¿¡æ¯ |
| hive.metastore.uris=thrift://namenode.test01.xxx:9083 |
| hive.metastore.dbname=default |
| hive.hmshandler.retry.attempts=15 |
| hive.hmshandler.retry.interval=2000ms |
| # Hive cache time |
| cache.evict.hive.fixedRate.in.milliseconds=900000 |
| # Kafka schema registryï¼æéé
ç½® |
| kafka.schema.registry.url=http://namenode.test01.xxx:8081 |
| # Update job instance state at regular intervals |
| jobInstance.fixedDelay.in.milliseconds=60000 |
| # Expired time of job instance which is 7 days that is 604800000 milliseconds.Time unit only supports milliseconds |
| jobInstance.expired.milliseconds=604800000 |
| # schedule predicate job every 5 minutes and repeat 12 times at most |
| #interval time unit s:second m:minute h:hour d:day,only support these four units |
| predicate.job.interval=5m |
| predicate.job.repeat.count=12 |
| # external properties directory location |
| external.config.location= |
| # external BATCH or STREAMING env |
| external.env.location= |
| # login strategy ("default" or "ldap") |
| login.strategy=default |
| # ldapï¼ç»å½çç¥ä¸ºldapæ¶é
ç½® |
| ldap.url=ldap://hostname:port |
| ldap.email=@example.com |
| ldap.searchBase=DC=org,DC=example |
| ldap.searchPattern=(sAMAccountName={0}) |
| # hdfs default name |
| fs.defaultFS= |
| # elasticsearché
ç½® |
| elasticsearch.host=griffindq02-test1-rgtj1-tj1 |
| elasticsearch.port=9200 |
| elasticsearch.scheme=http |
| # elasticsearch.user = user |
| # elasticsearch.password = password |
| # livyé
ç½® |
| livy.uri=http://10.104.xxx.xxx:8998/batches |
| # yarn urlé
ç½® |
| yarn.uri=http://10.104.xxx.xxx:8088 |
| # griffin event listener |
| internal.event.listeners=GriffinJobEventHook |
| </code></pre></div></div> |
| |
| <p>2ãservice/src/main/resources/quartz.properties</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| # |
| org.quartz.scheduler.instanceName=spring-boot-quartz |
| org.quartz.scheduler.instanceId=AUTO |
| org.quartz.threadPool.threadCount=5 |
| org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX |
| # If you use postgresql as your database,set this property value to org.quartz.impl.jdbcjobstore.PostgreSQLDelegate |
| # If you use mysql as your database,set this property value to org.quartz.impl.jdbcjobstore.StdJDBCDelegate |
| # If you use h2 as your database, it's ok to set this property value to StdJDBCDelegate, PostgreSQLDelegate or others |
| org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate |
| org.quartz.jobStore.useProperties=true |
| org.quartz.jobStore.misfireThreshold=60000 |
| org.quartz.jobStore.tablePrefix=QRTZ_ |
| org.quartz.jobStore.isClustered=true |
| org.quartz.jobStore.clusterCheckinInterval=20000 |
| </code></pre></div></div> |
| |
| <p>3ãservice/src/main/resources/sparkProperties.jsonï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{ |
| "file": "hdfs:///griffin/griffin-measure.jar", |
| "className": "org.apache.griffin.measure.Application", |
| "name": "griffin", |
| "queue": "default", |
| "numExecutors": 2, |
| "executorCores": 1, |
| "driverMemory": "1g", |
| "executorMemory": "1g", |
| "conf": { |
| "spark.yarn.dist.files": "hdfs:///home/spark_conf/hive-site.xml" |
| }, |
| "files": [ |
| ] |
| } |
| </code></pre></div></div> |
| |
| <p>4ãservice/src/main/resources/env/env_batch.jsonï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{ |
| "spark": { |
| "log.level": "INFO" |
| }, |
| "sinks": [ |
| { |
| "type": "CONSOLE", |
| "config": { |
| "max.log.lines": 10 |
| } |
| }, |
| { |
| "type": "HDFS", |
| "config": { |
| "path": "hdfs://namenodetest01.xx.xxxx.com:9001/griffin/persist", |
| "max.persist.lines": 10000, |
| "max.lines.per.file": 10000 |
| } |
| }, |
| { |
| "type": "ELASTICSEARCH", |
| "config": { |
| "method": "post", |
| "api": "http://10.xxx.xxx.xxx:9200/griffin/accuracy", |
| "connection.timeout": "1m", |
| "retry": 10 |
| } |
| } |
| ], |
| "griffin.checkpoint": [] |
| } |
| </code></pre></div></div> |
| |
| <p>é
ç½®æä»¶ä¿®æ¹å¥½åï¼å¨ideaéçterminaléæ§è¡å¦ä¸mavenå½ä»¤è¿è¡ç¼è¯æå
ï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvn -Dmaven.test.skip=true clean install |
| </code></pre></div></div> |
| |
| <p>å½ä»¤æ§è¡å®æåï¼ä¼å¨serviceåmeasure模åçtargetç®å½ä¸åå«çå°service-0.4.0.jaråmeasure-0.4.0.jar两个jarï¼å°è¿ä¸¤ä¸ªjarå嫿·è´å°æå¡å¨ç®å½ä¸ãè¿ä¸¤ä¸ªjarçä½¿ç¨æ¹å¼å¦ä¸ï¼</p> |
| |
| <p>1ã使ç¨å¦ä¸å½ä»¤å°measure-0.4.0.jarè¿ä¸ªjarä¸ä¼ å°HDFSç/griffinæä»¶ç®å½éï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#æ¹åjaråç§° |
| mv measure-0.4.0.jar griffin-measure.jar |
| #ä¸ä¼ griffin-measure.jarå°HDFSæä»¶ç®å½é |
| hadoop fs -put measure-0.4.0.jar /griffin/ |
| </code></pre></div></div> |
| |
| <p>è¿æ ·åçç®çä¸»è¦æ¯å 为sparkå¨yarnéç¾¤ä¸æ§è¡ä»»å¡æ¶ï¼éè¦å°HDFSç/griffinç®å½ä¸å è½½griffin-measure.jarï¼é¿å
åçç±»org.apache.griffin.measure.Applicationæ¾ä¸å°çé误ã</p> |
| |
| <p>2ãè¿è¡service-0.4.0.jarï¼å¯å¨Griffin管çåå°ï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nohup java -jar service-0.4.0.jar>service.out 2>&1 & |
| </code></pre></div></div> |
| |
| <p>å ç§éåï¼æä»¬å¯ä»¥è®¿é®Apache Griffinçé»è®¤UI(é»è®¤æ
åµä¸ï¼spring bootçç«¯å£æ¯8080)ã</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>http://IP:8080 |
| </code></pre></div></div> |
| |
| <p>UIæä½ææ¡£é¾æ¥ï¼<a href="https://github.com/apache/griffin/blob/master/griffin-doc/ui/user-guide.md">Apache Griffin User Guide</a>ãéè¿UIæä½çé¢ï¼æä»¬å¯ä»¥å建èªå·±çç»è®¡ä»»å¡ï¼é¨åç»æå±ç¤ºçé¢å¦ä¸ï¼</p> |
| |
| <p><img src="/images/dashboard-big.png" alt="dashboard" /></p> |
| |
| <h4 id="åè½ä½éª">åè½ä½éª</h4> |
| |
| <p>1ãå¨hiveéå建表demo_srcådemo_tgtï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>--create hive tables here. hql script |
| --Note: replace hdfs location with your own path |
| CREATE EXTERNAL TABLE `demo_src`( |
| `id` bigint, |
| `age` int, |
| `desc` string) |
| PARTITIONED BY ( |
| `dt` string, |
| `hour` string) |
| ROW FORMAT DELIMITED |
| FIELDS TERMINATED BY '|' |
| LOCATION |
| 'hdfs:///griffin/data/batch/demo_src'; |
| |
| --Note: replace hdfs location with your own path |
| CREATE EXTERNAL TABLE `demo_tgt`( |
| `id` bigint, |
| `age` int, |
| `desc` string) |
| PARTITIONED BY ( |
| `dt` string, |
| `hour` string) |
| ROW FORMAT DELIMITED |
| FIELDS TERMINATED BY '|' |
| LOCATION |
| 'hdfs:///griffin/data/batch/demo_tgt'; |
| </code></pre></div></div> |
| |
| <p>2ãçææµè¯æ°æ®ï¼</p> |
| |
| <p>ä»<a href="http://griffin.apache.org/data/batch/">http://griffin.apache.org/data/batch/</a>å°åä¸è½½æææä»¶å°Hadoopæå¡å¨ä¸ï¼ç¶å使ç¨å¦ä¸å½ä»¤æ§è¡gen-hive-data.shèæ¬ï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nohup ./gen-hive-data.sh>gen.out 2>&1 & |
| </code></pre></div></div> |
| |
| <p>注æè§å¯gen.outæ¥å¿æä»¶ï¼å¦ææé误ï¼è§æ
åµè¿è¡è°æ´ãè¿éæçæµè¯ç¯å¢HadoopåHiveå®è£
å¨åä¸å°æå¡å¨ä¸ï¼å æ¤ç´æ¥è¿è¡èæ¬ã</p> |
| |
| <p>3ãéè¿UIçé¢å建ç»è®¡ä»»å¡ï¼å
·ä½æç
§<a href="https://github.com/apache/griffin/blob/master/griffin-doc/ui/user-guide.md">Apache Griffin User Guide</a> |
| 䏿¥æ¥æä½ã</p> |
| |
| <h3 id="踩åè¿ç¨">踩åè¿ç¨</h3> |
| |
| <p>1ãgen-hive-data.shèæ¬çææ°æ®å¤±è´¥ï¼æ¥no such file or directoryé误ã</p> |
| |
| <p>é误åå ï¼HDFSä¸ç/griffin/data/batch/demo_src/å/griffin/data/batch/demo_tgt/ç®å½ä¸âdt=æ¶é´âç®å½ä¸åå¨ï¼å¦dt=20190113ã</p> |
| |
| <p>è§£å³åæ³ï¼ç»èæ¬ä¸å¢å hadoop fs -mkdirå建ç®å½æä½ï¼ä¿®æ¹å®åå¦ä¸ï¼</p> |
| |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#!/bin/bash |
| |
| #create table |
| hive -f create-table.hql |
| echo "create table done" |
| |
| #current hour |
| sudo ./gen_demo_data.sh |
| cur_date=`date +%Y%m%d%H` |
| dt=${cur_date:0:8} |
| hour=${cur_date:8:2} |
| partition_date="dt='$dt',hour='$hour'" |
| sed s/PARTITION_DATE/$partition_date/ ./insert-data.hql.template > insert-data.hql |
| hive -f insert-data.hql |
| src_done_path=/griffin/data/batch/demo_src/dt=${dt}/hour=${hour}/_DONE |
| tgt_done_path=/griffin/data/batch/demo_tgt/dt=${dt}/hour=${hour}/_DONE |
| hadoop fs -mkdir -p /griffin/data/batch/demo_src/dt=${dt}/hour=${hour} |
| hadoop fs -mkdir -p /griffin/data/batch/demo_tgt/dt=${dt}/hour=${hour} |
| hadoop fs -touchz ${src_done_path} |
| hadoop fs -touchz ${tgt_done_path} |
| echo "insert data [$partition_date] done" |
| |
| #last hour |
| sudo ./gen_demo_data.sh |
| cur_date=`date -d '1 hour ago' +%Y%m%d%H` |
| dt=${cur_date:0:8} |
| hour=${cur_date:8:2} |
| partition_date="dt='$dt',hour='$hour'" |
| sed s/PARTITION_DATE/$partition_date/ ./insert-data.hql.template > insert-data.hql |
| hive -f insert-data.hql |
| src_done_path=/griffin/data/batch/demo_src/dt=${dt}/hour=${hour}/_DONE |
| tgt_done_path=/griffin/data/batch/demo_tgt/dt=${dt}/hour=${hour}/_DONE |
| hadoop fs -mkdir -p /griffin/data/batch/demo_src/dt=${dt}/hour=${hour} |
| hadoop fs -mkdir -p /griffin/data/batch/demo_tgt/dt=${dt}/hour=${hour} |
| hadoop fs -touchz ${src_done_path} |
| hadoop fs -touchz ${tgt_done_path} |
| echo "insert data [$partition_date] done" |
| |
| #next hours |
| set +e |
| while true |
| do |
| sudo ./gen_demo_data.sh |
| cur_date=`date +%Y%m%d%H` |
| next_date=`date -d "+1hour" '+%Y%m%d%H'` |
| dt=${next_date:0:8} |
| hour=${next_date:8:2} |
| partition_date="dt='$dt',hour='$hour'" |
| sed s/PARTITION_DATE/$partition_date/ ./insert-data.hql.template > insert-data.hql |
| hive -f insert-data.hql |
| src_done_path=/griffin/data/batch/demo_src/dt=${dt}/hour=${hour}/_DONE |
| tgt_done_path=/griffin/data/batch/demo_tgt/dt=${dt}/hour=${hour}/_DONE |
| hadoop fs -mkdir -p /griffin/data/batch/demo_src/dt=${dt}/hour=${hour} |
| hadoop fs -mkdir -p /griffin/data/batch/demo_tgt/dt=${dt}/hour=${hour} |
| hadoop fs -touchz ${src_done_path} |
| hadoop fs -touchz ${tgt_done_path} |
| echo "insert data [$partition_date] done" |
| sleep 3600 |
| done |
| set -e |
| </code></pre></div></div> |
| |
| <p>2ãHDFSç/griffin/persistç®å½ä¸æ²¡æç»è®¡ç»ææä»¶ï¼æ£æ¥è¯¥ç®å½çæéï¼è®¾ç½®åéçæéå³å¯ã</p> |
| |
| <p>3ãESä¸çmetricæ°æ®ä¸ºç©ºï¼æä¸¤ç§å¯è½ï¼</p> |
| |
| <ul> |
| <li>service/src/main/resources/env/env_batch.jsonéçESé
置信æ¯ä¸æ£ç¡®</li> |
| <li>æ§è¡sparkä»»å¡çyarnæå¡å¨ä¸æ²¡æé
ç½®ESæå¡å¨çhostnameï¼è¿æ¥å¼å¸¸</li> |
| </ul> |
| |
| <p>4ãå¯å¨service-0.4.0.jarä¹åï¼è®¿é®ä¸å°UIçé¢ï¼æ¥çå¯å¨æ¥å¿æ å¼å¸¸ãæ£æ¥æå
æ¶æ¯ä¸æ¯æ§è¡çmvn packageå½ä»¤ï¼å°è¯¥å½ä»¤æ¿æ¢æmvn -Dmaven.test.skip=true clean installå½ä»¤éæ°æå
å¯å¨å³å¯ã</p> |
| |
| :ET |