Scheduler Server의 디렉토리 구조는 아래와 같습니다.
/ /apps /bin /conf /lib /logs
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/commons-dbcp-1.4.jar /apps/lib/commons-pool-1.5.4.jar /apps/lib/ehcache-core-2.6.9.jar /apps/lib/glue-core-4.2.7-RELEASE.jar /apps/lib/glue-scheduler-job-1.2.0.jar /apps/lib/glue-schema-4.2.7-RELEASE.jar /apps/lib/jcl-over-slf4j-1.7.7.jar /apps/lib/license-api-1.1.4.jar /apps/lib/logback-classic-1.1.3.jar /apps/lib/logback-core-1.1.3.jar /apps/lib/slf4j-api-1.7.7.jar /apps/lib/spring-beans-3.2.8.RELEASE.jar /apps/lib/spring-context-3.2.8.RELEASE.jar /apps/lib/spring-core-3.2.8.RELEASE.jar /apps/lib/spring-expression-3.2.8.RELEASE.jar /apps/lib/spring-jdbc-3.2.8.RELEASE.jar /apps/lib/spring-tx-3.2.8.RELEASE.jar /apps/lib/xmlbeans-2.4.0.jar
insert into SCHEDULE_JOB_INFO(JOB_NAME,JOB_GROUP,JOB_CLASS,DURABILITY,RECOVERY,STATUS,SCHEDULER_NAME) values('job001','sample1','com.poscoict.app.quartz.GlueJavaProcessStartJobImpl','T','T','N',''); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('job001','sample1','class', 'com.poscoict.app.job.GlueSimpleJob','usage'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('job001','sample1','ref-all', '/scheduler-server/apps/lib/*', 'cp'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('job001','sample1','biz-app', '/scheduler-server/apps/sample1.jar','cp'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('job001','sample1','CONFIG_PATH','/scheduler-server/apps/conf', 'D'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('job001','sample1','directory', '/scheduler-server/logs', 'K'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('job001','sample1','java', '/jdk1.7.0_25/bin/java', 'java'); insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE) values('job001','sample1','ServiceName', 'job001-service','S'); insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE) values('job001','sample1','sleep-second','5', 'S'); insert into SCHEDULE_JOB_INFO(JOB_NAME,JOB_GROUP,JOB_CLASS,DURABILITY,RECOVERY,STATUS,SCHEDULER_NAME) values('SamplePgm','sample2','com.poscoict.app.quartz.GlueJavaProcessStartJobImpl','T','T','N',''); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('SamplePgm','sample2','class', 'com.poscoict.app.job.GlueSimpleJob','usage'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('SamplePgm','sample2','ref-all', '/scheduler-server/apps/lib/*', 'cp'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('SamplePgm','sample2','biz-app', '/scheduler-server/apps/sample2.jar','cp'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('SamplePgm','sample2','CONFIG_PATH','/scheduler-server/apps/conf', 'D'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('SamplePgm','sample2','directory', '/scheduler-server/logs', 'K'); insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) values('SamplePgm','sample2','java', '/jdk1.7.0_25/bin/java', 'java'); insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE) values('SamplePgm','sample2','className', 'sample.job.SamplePgm','S'); insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE) values('SamplePgm','sample2','sleep-second','5', 'S');
bin 디렉토리에는 실행스크립트 파일이 있습니다.
실행스크립트에 다음과 같은 정보를 설정할 수 있습니다.
/bin/startup.bat /bin/startup.sh
startup.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.posco.glue.server.PoscoSchedulerServer %SCHEDULER_NM%
startup.sh
export JAVA_HOME=/DBMS/DCCM/apps/tech_st/10.1.3/appsutil/jdk/jre export SCHEJULER_NM=scheduler export SCHEDULER_HOME=/DBMS/DCCM/GLUE/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.posco.glue.server.PoscoSchedulerServer $SCHEJULER_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
accepted.ip : NIO Event 처리 기준.
주어진 IP로 요청된 Event(reload, fire등) 만 처리합니다.
default 는 전체 허용입니다.
purge.scheduled.job.cron.expression : 로그삭제 Job의 실행주기 정의.
cron 표현식으로 작성합니다. default 는 매분 정각에 수행됩니다.
purge.scheduled.job.day.time : 로그삭제 Job 실행시 로그삭제 기준.
default 는 10일이며, 로그삭제 Job이 실행될 때마다 10일 이전의 log 파일을 삭제합니다.
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
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.maxActive=-1 cm-dataSource.maxIdle=8 cm-dataSource.validationQuery=select 1 from daul
cm-dataSource.driverClassName : DBCP 1.4 의 API 참고. (org.apache.commons.dbcp.BasicDataSource)
cm-dataSource.url : DBCP 1.4 의 API 참고.(org.apache.commons.dbcp.BasicDataSource)
cm-dataSource.username : DBCP 1.4 의 API 참고.(org.apache.commons.dbcp.BasicDataSource)
cm-dataSource.password : DBCP 1.4 의 API 참고.(org.apache.commons.dbcp.BasicDataSource)
cm-dataSource.minIdle : DBCP 1.4 의 API 참고.(org.apache.commons.dbcp.BasicDataSource)
cm-dataSource.maxActive : DBCP 1.4 의 API 참고.(org.apache.commons.dbcp.BasicDataSource)
cm-dataSource.maxIdle : DBCP 1.4 의 API 참고.(org.apache.commons.dbcp.BasicDataSource)
cm-dataSource.validationQuery : DBCP 1.4 의 API 참고.(org.apache.commons.dbcp.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.jobStore.class: org.quartz.simpl.RAMJobStore
http://www.quartz-scheduler.org/documentation/quartz-2.x/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/aopalliance-1.0.jar /lib/backport-util-concurrent-3.0.jar /lib/bcprov-jdk15-1.46.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-4.2.7-RELEASE.jar /lib/glue-schedule-4.2.7-RELEASE.jar /lib/glue-schema-4.2.7-RELEASE.jar /lib/httpclient-4.5.jar /lib/httpcore-4.4.1.jar /lib/jackson-core-asl-1.9.12.jar /lib/jackson-mapper-asl-1.9.12.jar /lib/jcl-over-slf4j-1.7.7.jar /lib/license-api-1.1.4.jar /lib/logback-classic-1.1.3.jar /lib/logback-core-1.1.3.jar /lib/mina-core-1.0.10.jar /lib/quartz-2.2.1.jar /lib/slf4j-api-1.7.7.jar /lib/spring-aop-3.2.8.RELEASE.jar /lib/spring-beans-3.2.8.RELEASE.jar /lib/spring-context-3.2.8.RELEASE.jar /lib/spring-context-support-3.2.8.RELEASE.jar /lib/spring-core-3.2.8.RELEASE.jar /lib/spring-expression-3.2.8.RELEASE.jar /lib/spring-jdbc-3.2.8.RELEASE.jar /lib/spring-tx-3.2.8.RELEASE.jar /lib/stax-api-1.0.1.jar /lib/xmlbeans-2.4.0.jar