美文网首页
apache griffin 0.6服务运行

apache griffin 0.6服务运行

作者: 侧耳倾听y | 来源:发表于2021-01-14 14:57 被阅读0次

    安装griffin运行所需要的环境

    依赖环境:
    hadoop、spark、hive、livy、es
    hadoop和spark上次装了,这次贴上其它的安装参考链接
    hive安装参考:https://monday.blog.csdn.net/article/details/104139457
    livey安装参考:https://www.cnblogs.com/beststrive/archive/2004/01/13/11933519.html
    es安装参考:
    https://blog.csdn.net/m0_37684037/article/details/98657019

    livy安装后默认访问地址:http://localhost:8998/
    es安装后默认访问地址:http://localhost:9200/

    执行mysql的qrtz脚本

    griffin使用了quartz调度,所以需要先在mysql把一些相关的表建立聊一下。执行Init_quartz_mysql_innodb.sql文件。

    修改配置文件

    pom.xml 放开下面依赖的注释

    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>${mysql.java.version}</version>
    </dependency>
    

    application.properties 就改了mysql的配置,其它都没有修改

    spring.datasource.url=jdbc:mysql://xx:3306/griffin_test?autoReconnect=true&useSSL=false
    spring.datasource.username=root
    spring.datasource.password=123456
    spring.jpa.generate-ddl=true
    spring.datasource.driver-class-name=com.mysql.jdbc.Driver
    spring.jpa.show-sql=true
    spring.jpa.hibernate.ddl-auto=update
    

    env_batch.json

    {
      "spark": {
        "log.level": "WARN"
      },
      "sinks": [
        {
          "name": "console",
          "type": "CONSOLE",
          "config": {
            "max.log.lines": 10
          }
        },
        {
          "name": "hdfs",
          "type": "HDFS",
          "config": {
            "path": "hdfs://localhost:9000/user/root/griffin/persist",
            "max.persist.lines": 10000,
            "max.lines.per.file": 10000
          }
        },
        {
          "name": "elasticsearch",
          "type": "ELASTICSEARCH",
          "config": {
            "method": "post",
            "api": "http://localhost:9200/griffin/accuracy",
            "connection.timeout": "1m",
            "retry": 10
          }
        }
      ],
      "griffin.checkpoint": []
    }
    

    sparkProperties.json 记得把你的measure打的jar包上传到hdfs

    {
      "file": "hdfs://localhost:9000/user/root/griffin/measure-0.6.0.jar",
      "className": "org.apache.griffin.measure.Application",
      "queue": "default",
      "numExecutors": 2,
      "executorCores": 1,
      "driverMemory": "1g",
      "executorMemory": "1g",
      "conf": {
        "spark.yarn.dist.files": "hdfs://localhost:9000/user/root/griffin/data/hive-site.xml"
      },
      "files": [
      ]
    }
    

    quartz.properties

    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
    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
    

    打包 运行

    打包之前有个操作,把你的hive-site.xml配置文件复制到measure模块的resource下面。我刚开始没这么做,执行spark任务的时候会报错找不到表。

    在idea的Terminal运行如下命令

    mvn -Dmaven.test.skip=true clean install
    

    在target目录下会看到service-0.6.0.tar.gz,解压。进入到service-0.6.0/bin目录,运行start.sh文件,启动项目后,localhost:8080访问一下。
    创建任务和运行都非常简单,就不再演示了。

    注意

    在运行的过程中,遇到了不少问题,下面贴出来

    • 数据源

    看起来创建任务界面的数据源,都是从hive读取的,所以所连接的hive必须有表,使用官网的脚本创建一下即可。

    • 保存任务报错

    保存任务的时候会报错,因为缺少相关的表,但我明明设置了spring.jpa.hibernate.ddl-auto=update属性,还是不行,只能手动创建表。

    CREATE TABLE `DATACONNECTOR` (
      `ID` bigint(20) NOT NULL DEFAULT '0',
      `CONFIG` varchar(1024) DEFAULT NULL,
      `CREATEDDATE` bigint(20) DEFAULT NULL,
      `DATAFRAMENAME` varchar(255) DEFAULT NULL,
      `DATATIMEZONE` varchar(255) DEFAULT NULL,
      `DATAUNIT` varchar(255) DEFAULT NULL,
      `MODIFIEDDATE` bigint(20) DEFAULT NULL,
      `NAME` varchar(255) DEFAULT NULL,
      `TYPE` varchar(255) DEFAULT NULL,
      `VERSION` varchar(255) DEFAULT NULL,
      PRIMARY KEY (`ID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    • 跑任务的时候报错

    livy向spark提交任务的时候报错(在http://localhost:8998看日志)。一直报找不到表的错误,这个需要在打包之前,把hive的配置文件hive-site.xml放到measure模块下面,上面提了一下。

    相关文章

      网友评论

          本文标题:apache griffin 0.6服务运行

          本文链接:https://www.haomeiwen.com/subject/kzlvaktx.html