디렉토리 구조

Scheduler Server의 디렉토리 구조는 아래와 같습니다.

/
/apps
/bin
/conf
/lib
/logs

ROOT 디렉토리

ROOT 디렉토리에는 다음 파일이 있습니다.

/scheduler-server.jar
/README.txt
/LICENSE
/NOTICE

apps 디렉토리

Biz App' 이 설치되는 위치입니다. (ex sample1.jar)
Job 설치 를 참고해서 application 및 library를 추가합니다.

apps 디렉토리에는 다음 파일이 있습니다.

/apps/sample1.jar                <-- Job(sample1.job001) 프로그램 및 소스
/apps/sample2.jar                <-- Job(sample2.SamplePgm) 프로그램 및 소스 
/apps/sample3.jar
/apps/lib/bcprov-jdk16on-1.60.jar
/apps/lib/commons-codec-1.6.jar
/apps/lib/commons-dbcp2-2.4.0.jar
/apps/lib/commons-pool2-2.5.0.jar
/apps/lib/ehcache-core-2.6.9.jar
/apps/lib/glue-core-5.0.2-RELEASE.jar
/apps/lib/glue-scheduler-job-2.0.1.jar
/apps/lib/glue-schema-5.0.2-RELEASE.jar
/apps/lib/jcl-over-slf4j-1.7.30.jar
/apps/lib/license-api-1.2.2.jar
/apps/lib/logback-classic-1.2.3.jar
/apps/lib/logback-core-1.2.3.jar
/apps/lib/slf4j-api-1.7.30.jar
/apps/lib/spring-beans-4.3.7.RELEASE.jar
/apps/lib/spring-context-4.3.7.RELEASE.jar
/apps/lib/spring-core-4.3.7.RELEASE.jar
/apps/lib/spring-expression-4.3.7.RELEASE.jar
/apps/lib/spring-jdbc-4.3.7.RELEASE.jar
/apps/lib/spring-tx-4.3.7.RELEASE.jar
/apps/lib/spring-web-4.3.7.RELEASE.jar
/apps/lib/spring-websocket-4.3.7.RELEASE.jar
/apps/lib/xmlbeans-2.4.0.jar

bin 디렉토리

bin 디렉토리에는 실행스크립트 파일이 있습니다.
실행스크립트에 다음과 같은 정보를 설정할 수 있습니다.

  • JAVA_HOME : 필수. Java Home을 변수로 지정합니다.
  • SCHEDULER_NM : 필수. Scheduler Server를 구분할 수 있는 이름으로 부여합니다.
  • SCHEDULER_HOME : 필수. Scheduler Server가 설치된 ROOT 디렉토리로 지정합니다.
  • CONFIG_PATH : 필수. -D 옵션입니다.
  • logback.configurationFile : 필수. -D 옵션입니다.
  • glue.scheduler.server.port : default 8805. -D 옵션입니다. Scheduler Server별로 port를 따로 부여합니다.
  • glue.scheduler.server.address : default java.net.InetAddress.getLocalHost() 의 값. -D 옵션입니다. 2개 이상의 IP를 갖는 경우 명시적으로 설정할 수 있습니다.
/bin/startup.bat
/bin/startup.sh
/bin/startup-easy.bat  <-- 아래 참고
/bin/startup-easy.sh   <-- 아래 참고
  • startup-easy.bat

    @echo off
    setlocal
    set "JAVA_HOME=C:/Java/jdk1.7.0_80"
    set "SCHEDULER_NM=scheduler"
    set "SCHEDULER_HOME=C:/scheduler-server"
    cd "%SCHEDULER_HOME%"
    echo Using JAVA_HOME:      %JAVA_HOME%
    echo Using SCHEDULER_HOME: %SCHEDULER_HOME%
    echo Using CONFIG_PATH:    %SCHEDULER_HOME%/conf
    
    "%JAVA_HOME%/bin/java" -DCONFIG_PATH=%SCHEDULER_HOME%/conf -Dlogback.configurationFile=%SCHEDULER_HOME%/conf/logback.xml -Dglue.scheduler.server.port=8805 -cp *;lib/* com.poscoict.app.server.GlueSchedulerMinaServer %SCHEDULER_NM%
    
  • startup-easy.sh

    export JAVA_HOME=/usr/local/jdk/jre
    export SCHEJULER_NM=scheduler
    export SCHEDULER_HOME=/usr/local/scheduler-server
    cd $SCHEDULER_HOME
    echo "Using JAVA_HOME : "$JAVA_HOME
    echo "Using SCHEDULER_HOME : "$SCHEDULER_HOME
    echo "Using CONFIG_PATH : "$SCHEDULER_HOME/conf
    
    $JAVA_HOME/bin/java -DCONFIG_PATH=$SCHEDULER_HOME/conf -Dlogback.configurationFile=$SCHEDULER_HOME/conf/logback.xml -Dglue.scheduler.server.port=8805 -cp ./*:./lib/* com.poscoict.app.server.GlueSchedulerMinaServer $SCHEJULER_NM
    

conf 디렉토리

conf 디렉토리에는 다음과 같은 설정파일이 있습니다.
실행스크립트에서 CONFIG_PATH로 지정된 위치입니다.

/conf/glue.properties
/conf/logback.xml
/conf/scheduler.properties
/conf/quartz.properties
  • glue.properties

    accepted.ip=172.31.47.160,172.31.225.206,172.30.*
    purge.scheduled.job.cron.expression=0 * * * * ?
    purge.scheduled.job.day.time=10
    quartz.listener.logging.enabled=false
    mina.iohandler.logging.enabled=false
    
    • accepted.ip : NIO Event 처리 기준.
      주어진 IP로 요청된 Event(reload, fire등) 만 처리합니다.
      default 는 전체 허용입니다.

    • purge.scheduled.job.cron.expression : 로그삭제 Job의 실행주기 정의.
      cron 표현식으로 작성합니다. default 는 매분 정각에 수행됩니다.
      _hidden_._hidden_ 이라는 JobKey 로 scheduler server 에서 자동으로 수행되며, 가능한 다른 잡 수행에 영향을 최소화하는 시간으로 지정합니다.

    • purge.scheduled.job.day.time : 로그삭제 Job 실행시 로그삭제 기준.
      default 는 10일이며, 로그삭제 Job이 실행될 때마다 10일 이전의 log 파일을 삭제합니다.

    • quartz.listener.logging.enabled : SchedulerListener 의 주요 method 이력 DB 로깅 여부
      default 는 false 입니다.

      select * from SCHEDULE_SERVER_HISTORY where EVENT_TYPE like 'QUARTZ%';
      
    • mina.iohandler.logging.enabled : IoHandlerAdapter 의 messageReceived() 실행 이력 DB 로깅 여부.
      default 는 false 입니다.

      select * from SCHEDULE_SERVER_HISTORY where EVENT_TYPE like 'HTTP%';
      
  • logback.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration debug="true">
        <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>${SCHEDULER_HOME}/logs/scheduler-server.log</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
                <fileNamePattern>${SCHEDULER_HOME}/logs/scheduler-server.log.%i</fileNamePattern>
                <minIndex>1</minIndex>
                <maxIndex>10</maxIndex>
            </rollingPolicy>
            <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
                <maxFileSize>5MB</maxFileSize>
            </triggeringPolicy>
            <encoder>
                <pattern>%d [%thread] %-5level %logger - %msg%n</pattern>
            </encoder>
        </appender>
    
        <logger name="com.poscoict.glueframework">
            <level value="info" />
        </logger>
        <logger name="com.poscoict.app">
            <level value="debug" />
        </logger>
        <logger name="com.poscoict.glueframework.dao.jdbc.GlueJdbcDao">
            <level value="warn"/>
        </logger>
        <logger name="org.quartz">
            <level value="info" />
        </logger>
    
        <root level="warn">
            <appender-ref ref="FILE" />
        </root>
    </configuration>
    
  • scheduler.properties ( 1.4.2 이상 )
    • 공통 properties 와 함께 각 DB에 해당하는 properties 의 주석을 해제 하여 사용한다.
      • Oracle : Common + Oracle
      • PPAS : Common + PPAS
      • MySQL : Common + Common for MySQL or Maria + MySQL
      • Maria : Common + Common for MySQL or Maria + Maria
    • Maria DB 인 경우 예시
      ###############################################################################
      #                 Common properties
      ###############################################################################
      cm-dataSource.username=username
      cm-dataSource.password=password
      cm-dataSource.minIdle=0
      cm-dataSource.maxIdle=8
      cm-dataSource.maxTotal=-1
      ###############################################################################
      #                 Common for MySQL and Maria
      ###############################################################################
      cm-seq.column=seq_nm
      cm-seq.name=mysql_seq
      queryLoader.rootPath=mysql
      cm-dataSource.validationQuery=select 1 from dual
      #
      ###############################################################################
      #                 Maria
      ###############################################################################
      cm-dataSource.driverClassName=org.mariadb.jdbc.Driver
      cm-dataSource.url=jdbc:mariadb://127.0.0.1:port/database
      #
      ###############################################################################
      #                 MySQL
      ###############################################################################
      #cm-dataSource.driverClassName=com.mysql.jdbc.Driver
      #cm-dataSource.url=jdbc:mysql://127.0.0.1:port/database?characterEncoding=euckr
      #
      ###############################################################################
      #                 PPAS
      ###############################################################################
      #cm-dataSource.driverClassName=com.edb.Driver
      #cm-dataSource.url=jdbc:edb://127.0.0.1:port/database
      #queryLoader.rootPath=query
      #cm-dataSource.validationQuery=select current_date
      #
      ###############################################################################
      #                 PostgreSQL
      ###############################################################################
      #cm-dataSource.driverClassName=org.postgresql.Driver
      #cm-dataSource.url=jdbc:postgresql://127.0.0.1:port/database
      #queryLoader.rootPath=postgresql
      #cm-dataSource.validationQuery=select current_date
      #
      ###############################################################################
      #                 Oracle
      ###############################################################################
      #cm-dataSource.driverClassName=oracle.jdbc.driver.OracleDriver
      #cm-dataSource.url=jdbc:oracle:thin:@127.0.0.1:1521:XE
      #queryLoader.rootPath=query
      #cm-dataSource.validationQuery=select 1 from dual
      ###############################################################################
      
  • scheduler.properties ( 1.4.1 이하 )

    1. Oracle 일경우 예시
      cm-dataSource.driverClassName=oracle.jdbc.driver.OracleDriver
      cm-dataSource.url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL
      cm-dataSource.username=scott
      cm-dataSource.password=tiger
      cm-dataSource.minIdle=0
      cm-dataSource.maxTotal=-1
      cm-dataSource.maxIdle=8
      cm-dataSource.validationQuery=select 1 from daul 
      
    2. PostgreSQL 일경우 예시
      cm-dataSource.driverClassName=org.postgresql.Driver
      cm-dataSource.url=jdbc:postgresql://127.0.0.1:5432/postgres
      cm-dataSource.username=postgres
      cm-dataSource.password=postgres
      cm-dataSource.minIdle=0
      cm-dataSource.maxTotal=-1
      cm-dataSource.maxIdle=8
      cm-dataSource.validationQuery=select current_date 
      
    • cm-dataSource.driverClassName : DBCP 2.4.0 의 API 참고. (org.apache.commons.dbcp2.BasicDataSource)

    • cm-dataSource.url : DBCP 2.4.0 의 API 참고.(org.apache.commons.dbcp2.BasicDataSource)

    • cm-dataSource.username : DBCP 2.4.0 의 API 참고.(org.apache.commons.dbcp2.BasicDataSource)

    • cm-dataSource.password : DBCP 2.4.0 의 API 참고.(org.apache.commons.dbcp2.BasicDataSource)

    • cm-dataSource.minIdle : DBCP 2.4.0 의 API 참고.(org.apache.commons.dbcp2.BasicDataSource)

    • cm-dataSource.maxTotal : DBCP 2.4.0 의 API 참고.(org.apache.commons.dbcp2.BasicDataSource)

    • cm-dataSource.maxIdle : DBCP 2.4.0 의 API 참고.(org.apache.commons.dbcp2.BasicDataSource)

    • cm-dataSource.validationQuery : DBCP 2.4.0 의 API 참고.(org.apache.commons.dbcp2.BasicDataSource)

  • quartz.properties

    # Default Properties file for use by StdSchedulerFactory
    # to create a Quartz Scheduler Instance, if a different
    # properties file is not explicitly specified.
    #
    
    org.quartz.scheduler.instanceName: DefaultQuartzScheduler
    org.quartz.scheduler.rmi.export: false
    org.quartz.scheduler.rmi.proxy: false
    org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
    
    org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
    org.quartz.threadPool.threadCount: 10
    org.quartz.threadPool.threadPriority: 5
    org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
    
    org.quartz.jobStore.misfireThreshold: 60000
    
    org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
    
    • org.quartz.threadPool.threadCount : 동시실행 가능한 Job의 수
    • org.quartz.jobStore.misfireThreshold : 단위는 milliseconds로 60000은 60초(1분)을 의미함. Job 실행 불발(misfire) 판단 시간. 예정된 시간보다 30초 지연되면 Job을 실행시키나, 61초 지연되면, 불발로 판단하고 실행하지 않음.
    • org.quartz.jobStore.class : Quartz의 모든 data( JobDetails & Triggers )는 메모리에 저장됨.
      1. in Memory
        org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
        
      2. in DataBase

        http://www.quartz-scheduler.org/documentation/quartz-2.2.2/configuration/ConfigDataSources.html 참고

        org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
        org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
        org.quartz.jobStore.useProperties=false
        org.quartz.jobStore.dataSource=myDS
        org.quartz.jobStore.tablePrefix=QRTZ_
        org.quartz.jobStore.isClustered=false
        org.quartz.dataSource.myDS.driver: oracle.jdbc.driver.OracleDriver
        org.quartz.dataSource.myDS.URL: jdbc:oracle:thin:@192.168.41.141:1521:XE
        org.quartz.dataSource.myDS.user: scott
        org.quartz.dataSource.myDS.password: tiger
        org.quartz.dataSource.myDS.maxConnections: 5
        org.quartz.dataSource.myDS.validationQuery: select sysdate from dual
        org.quartz.dataSource.myDS.idleConnectionValidationSeconds: 50
        org.quartz.dataSource.myDS.validateOnCheckout: false
        org.quartz.dataSource.myDS.discardIdleConnectionsSeconds: 10
        

lib 디렉토리

lib 디렉토리에는 다음과 같은 라이브러리들이 있습니다.
JDBC Driver(ex. ojdbc6.jar)는 직접 추가합니다.

/lib/backport-util-concurrent-3.0.jar
/lib/bcprov-jdk15on-1.60.jar
/lib/c3p0-0.9.1.1.jar
/lib/commons-codec-1.6.jar
/lib/commons-dbcp-1.4.jar
/lib/commons-lang3-3.1.jar
/lib/commons-pool-1.5.4.jar
/lib/ehcache-core-2.6.9.jar
/lib/glue-core-5.0.1-RELEASE.jar
/lib/glue-schedule-5.0.1-RELEASE.jar
/lib/glue-schema-5.0.1-RELEASE.jar
/lib/httpclient-4.5.jar
/lib/httpcore-4.4.1.jar
/lib/jackson-annotations-2.6.0.jar
/lib/jackson-core-2.6.7.jar
/lib/jackson-databind-2.6.7.jar
/lib/jaxb-api-2.2.11.jar
/lib/jaxb-core-2.2.11.jar
/lib/jaxb-impl-2.2.11.jar
/lib/jcl-over-slf4j-1.7.30.jar
/lib/license-api-1.2.2.jar
/lib/logback-classic-1.2.3.jar
/lib/logback-core-1.2.3.jar
/lib/mina-core-1.0.10.jar
/lib/quartz-2.2.1.jar
/lib/slf4j-api-1.7.30.jar
/lib/spring-aop-4.3.7.RELEASE.jar
/lib/spring-beans-4.3.7.RELEASE.jar
/lib/spring-context-4.3.7.RELEASE.jar
/lib/spring-context-support-4.3.7.RELEASE.jar
/lib/spring-core-4.3.7.RELEASE.jar
/lib/spring-expression-4.3.7.RELEASE.jar
/lib/spring-jdbc-4.3.7.RELEASE.jar
/lib/spring-tx-4.3.7.RELEASE.jar
/lib/spring-web-4.3.7.RELEASE.jar
/lib/spring-websocket-4.3.7.RELEASE.jar
/lib/xmlbeans-2.4.0.jar

logs 디렉토리

logs 디렉토리에는 로그파일이 쌓입니다.

/logs/scheduler-server.log