Scheduler Server의 디렉토리 구조는 아래와 같습니다.
/ /apps /bin /conf /lib /logs
ROOT 디렉토리에는 다음 파일이 있습니다.
/scheduler-server.jar
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-jdk15on-<version>.jar /apps/lib/commons-dbcp2-<version>.jar /apps/lib/commons-lang3-<version>.jar /apps/lib/commons-pool2-<version>.jar /apps/lib/ehcache-<version>.jar /apps/lib/glue-core-<version>.jar /apps/lib/glue-scheduler-job-<version>.jar /apps/lib/glue-schema-<version>.jar /apps/lib/license-api-<version>.jar /apps/lib/logback-classic-<version>.jar /apps/lib/logback-core-<version>.jar /apps/lib/slf4j-api-<version>.jar /apps/lib/spring-aop-<version>.jar /apps/lib/spring-beans-<version>.jar /apps/lib/spring-context-<version>.jar /apps/lib/spring-context-support-<version>.jar /apps/lib/spring-core-<version>.jar /apps/lib/spring-expression-<version>.jar /apps/lib/spring-jcl-<version>.jar /apps/lib/spring-jdbc-<version>.jar /apps/lib/spring-tx-<version>.jar
bin 디렉토리에는 실행스크립트 파일이 있습니다.
실행스크립트에 다음과 같은 정보를 설정할 수 있습니다.
JAVA_HOME
: 필수. Java Home을 변수로 지정합니다.SCHEDULER_NM
: 필수. Scheduler Server를 구분할 수 있는 이름으로 부여합니다.SCHEDULER_HOME
: 필수. Scheduler Server가 설치된 ROOT 디렉토리로 지정합니다.CONFIG_PATH
: 필수. -D 옵션입니다.cipher.path
: optional. -D 옵션입니다. DB패스워드 암호화 적용시 사용할 암호화 KeyFile 위치입니다.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.8.0_202" set "SCHEDULER_NM=scheduler" set "SCHEDULER_HOME=C:/scheduler-server" set "CIPHER_PATH=C:/scheduler-server/key" cd "%SCHEDULER_HOME%" echo Using JAVA_HOME: %JAVA_HOME% echo Using SCHEDULER_HOME: %SCHEDULER_HOME% echo Using cipher.path: %CIPHER_PATH% echo Using CONFIG_PATH: %SCHEDULER_HOME%/conf "%JAVA_HOME%/bin/java" -DCONFIG_PATH=%SCHEDULER_HOME%/conf -Dcipher.path=%CIPHER_PATH% -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 SCHEDULER_NM=scheduler export SCHEDULER_HOME=/usr/local/scheduler-server export CIPHER_PATH=/usr/local/scheduler-server/key cd $SCHEDULER_HOME echo "Using JAVA_HOME : "$JAVA_HOME echo "Using SCHEDULER_HOME : "$SCHEDULER_HOME echo "Using CONFIG_PATH : "$SCHEDULER_HOME/conf echo "Using cipher.path : "$CIPHER_PATH $JAVA_HOME/bin/java -DCONFIG_PATH=$SCHEDULER_HOME/conf -Dcipher.path=$CIPHER_PATH -Dlogback.configurationFile=$SCHEDULER_HOME/conf/logback.xml -Dglue.scheduler.server.port=8805 -cp ./*:./lib/* com.poscoict.app.server.GlueSchedulerMinaServer $SCHEDULER_NM
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 의 주석을 해제 하여 사용한다.
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 이하 )
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
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 )는 메모리에 저장됨.
in Memory
org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
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 디렉토리에는 다음과 같은 라이브러리들이 있습니다.
JDBC Driver(ex. ojdbc6.jar)는 직접 추가합니다.
/lib/backport-util-concurrent-<version>.jar /lib/bcprov-jdk15on-<version>.jar /lib/c3p0-<version>.jar /lib/commons-beanutils-<version>.jar /lib/commons-collections-<version>.jar /lib/commons-configuration2-<version>.jar /lib/commons-dbcp2-<version>.jar /lib/commons-lang3-<version>.jar /lib/commons-pool2-<version>.jar /lib/ehcache-<version>.jar /lib/glue-core-<version>.jar /lib/glue-schedule-<version>.jar /lib/glue-schema-<version>.jar /lib/glue-tester-<version>.jar /lib/httpclient-<version>.jar /lib/httpcore-<version>.jar /lib/jackson-annotations-<version>.jar /lib/jackson-core-<version>.jar /lib/jackson-databind-<version>.jar /lib/license-api-<version>.jar /lib/logback-classic-<version>.jar /lib/logback-core-<version>.jar /lib/mina-core-<version>.jar /lib/quartz-<version>.jar /lib/slf4j-api-<version>.jar /lib/spring-aop-<version>.jar /lib/spring-beans-<version>.jar /lib/spring-context-<version>.jar /lib/spring-context-support-<version>.jar /lib/spring-core-<version>.jar /lib/spring-expression-<version>.jar /lib/spring-jcl-<version>.jar /lib/spring-jdbc-<version>.jar /lib/spring-tx-<version>.jar
logs 디렉토리에는 로그파일이 쌓입니다.
/logs/scheduler-server.log