Clusters of spring and quartz (ii)

Source: Internet
Author: User

One: Frontier

After writing these two articles only suddenly remembered, forgot the most important thing, that is in the configuration file here configuration, as well as the database configuration. This is depressed Ah! Go ahead!

II: Content Configuration

We need to configure a quartz.properties configuration file at the time of integration, if you do not configure the words, will read the default quartz.properties file in Quartz-2.2.1.jar, so we say here configuration, directly post configuration!

# Default Properties File forUse by stdschedulerfactory# to create a Quartz Scheduler Instance,ifa different# properties file is not explicitly specified. #属性可以为任何值, uniquely identified in JDBC Jobstoreh, But all cluster nodes must be the same org.quartz.scheduler.instanceName=The defaultquartzscheduler# property is auto, which generates the instance ID based on the host name and the top ten stamp. Org.quartz.scheduler.instanceId=AUTOorg.quartz.scheduler.rmi.export=falseOrg.quartz.scheduler.rmi.proxy=falseorg.quartz.scheduler.wrapJobExecutionInUserTransaction=false#属性为JobStoreTX, persisting the task into the data because the nodes in the cluster rely on the database to propagate the state of the Scheduler instance # you can only apply quartz clusters when using JDBC Jobstore. This means that you must use JOBSTORETX or JOBSTORECMT as the job store; #你不能在集群中使用RAMJobStoreorg. Quartz.threadpool .class=Org.quartz.simpl.SimpleThreadPoolorg.quartz.threadPool.threadCount= 10org.quartz.threadPool.threadPriority= 5Org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true#====================================#Configure jobstore#===================================Org.quartz.jobStore.misfireThreshold= 10000Org.quartz.jobStore.class=Org.quartz.impl.jdbcjobstore.JobStoreTX Org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate Org.quartz.jobStore.tablePrefix=qrtz_ #这是集成需要执行数据库的前缀org. Quartz.jobStore.maxMisfiresToHandleAtATime=10org.quartz.jobStore.isClustered=trueOrg.quartz.jobStore.clusterCheckinInterval= 20000#==================================#Configure datasource#=================================Org.quartz.jobStore.dataSource=rzds Org.quartz.dataSource.rzDS.driver=Com.mysql.jdbc.Driverorg.quartz.dataSource.rzDS.URL=jdbc:mysql://Localhost:3306/userOrg.quartz.datasource.rzds.user=Rootorg.quartz.dataSource.rzDS.password=adminorg.quartz.dataSource.rzDS.maxConnections=30

quartz2.2.1 the code that executes under MySQL, go to the official website to download Quartz's package (http://quartz-scheduler.org/downloads/destination?name= quartz-2.2.1-distribution.tar.gz&bucket=tcdistributions&file= quartz-2.2.1-distribution.tar.gz), in Quartz-2.2.1-distribution\quartz-2.2.1\docs\dbtables, find your type database

# # Quartz seems to work best with the driver Mm.mysql-2.0.7-bin.jar## consider using MySQL with InnoDB tables to avoid locking issues## in your Quartz properties file, you ' ll need to set # Org.quartz.jobStore.driverDelegateClass =org.quartz.impl.jdbcjobstore.stdjdbcdelegate#drop table if EXISTS qrtz_fired_triggers;drop table if EXISTS qrtz_ Paused_trigger_grps;drop table if EXISTS qrtz_scheduler_state;drop table if EXISTS qrtz_locks;drop table if EXISTS qrtz_si Mple_triggers;drop table if EXISTS qrtz_simprop_triggers;drop table if EXISTS qrtz_cron_triggers;drop table if EXISTS Qrtz _blob_triggers;drop table if EXISTS qrtz_triggers;drop table if EXISTS qrtz_job_details;drop table if EXISTS Qrtz_calendar S CREATE TABLE qrtz_job_details (sched_name VARCHAR (120) not NULL, Job_name VARCHAR (200) not NULL, Job_group VARCHAR (200) not NULL, DESCRIPTION VARCHAR (250) NULL, Job_class_name VARCHAR (250) not NULL, is_durable VARCHAR (1) not NULL, Is_nonconcurrent VARCHAR (1) not NULL, Is_update_data VARCHAR (1) not NULL, Requests_recovery VARCHAR (1) NOT NULL, Job_data BLOB null, PRIMARY KEY (Sched_name,job_name,job_group)); CREATE TABLE qrtz_triggers (sched_name VARCHAR (120) not NULL, Trigger_name VARCHAR (200) not NULL, Trigger_group VARCHAR (200) not NULL, Job_name VARCHAR (200) not NULL, Job_group VARCHAR (200) not NULL, DESCRIPTION VARCHAR (250) NULL, Next_fire_time BIGINT (13) NULL, Prev_fire_time BIGINT (13) NULL, priority INTEGER NULL, Trigger_state VARCHAR (16) not NULL, Trigger_type VARCHAR (8) not NULL, Start_time BIGINT (13) not NULL, End_time BIGINT (13) NULL, Calendar_name VARCHAR (200) NULL, Misfire_instr SMALLINT (2) NULL, job_data BLOB null, PRIMARY key (Sched_name,trigger_name,trigger_group), FOREIGN key (sched_name,job_ Name,job_group) REFERENCES qrtz_job_details (Sched_name,job_name,job_group)); CREATE TABLE qrtz_simple_triggers (sched_name VARCHAR (120) not NULL, Trigger_name VARCHAR (200) not NULL, Trigger_group VARCHAR (200) not NULL, Repeat_count BIGINT (7) not NULL, Repeat_interval BIGINT (12) not NULL, times_triggered BIGINT (10) not NULL, PRIMARY key (Sched_name,trigger_name,trigger_group), FOREIGN key (sched_name,trigger_name,trigger_gr OUP) REFERENCES qrtz_triggers (Sched_name,trigger_name,trigger_group)); CREATE TABLE qrtz_cron_triggers (sched_name VARCHAR (120) not NULL, Trigger_name VARCHAR (200) not NULL, Trigger_group VARCHAR (200) not NULL, Cron_expression VARCHAR (200) not NULL, time_zone_id VARCHAR (80), PRIMARY key (Sched_name,trigger_name,trigger_group), FOREIGN key (Sched_name,trigger_name,trigger_group) REFERENCES qrtz_triggers (Sched_name,trigger_name,trigger_group)); CREATE TABLE qrtz_simprop_triggers (sched_name VARCHAR (120) not NULL, Trigger_name VARCHAR (200) not NULL, Trigger_group VARCHAR (200) not NULL, Str_prop_1 VARCHAR (512) NULL, str_prop_2 VARCHAR (512) NULL, Str_prop_3 VARCHAR (512) NULL, int_prop_1 int NULL, int_prop_2 int NULL, long_prop_1 BIGINT null, long_prop_2 BIGINT NULL, DEC _prop_1 NUMERIC (13,4) NULL, dec_prop_2 NUMERIC (13,4) NULL, Bool_prop_1 VARCHAR (1) NULL, bool_prop_2 VARCHAR (1) NULL, PRIMARY key (Sched_name,trigger_name,trigger_group), FOREIGN key (Sched_name,trigger_name,trigger_group) REFERENCES qrtz_triggers (Sched_name,trigger_name,trigger_group)); CREATE TABLE qrtz_blob_triggers (sched_name VARCHAR (120) not NULL, Trigger_name VARCHAR (200) not NULL, Trigger_group VARCHAR (200) NOT NULL, Blob_data BLOB null, PRIMARY key (Sched_name,trigger_name,trigger_group), FOREIGN key (Sched_name , Trigger_name,trigger_group) REFERENCES qrtz_triggers (Sched_name,trigger_name,trigger_group)); CREATE TABLE Qrtz_calendars (sched_name VARCHAR (120) not NULL, Calendar_name VARCHAR (200) not NULL, the CALENDAR BLOB is not null, PRIMARY KEY (sched_name,calendar_name)); CREATE TABLE Qrtz_paused_trigger_grps (sched_name VARCHAR (120) not NULL, Trigger_group VARCHAR (200) not NULL, PRIMARY KEY (Sched_name,trigger_group)); CREATE TABLE qrtz_fired_triggers (sched_name VARCHAR (120) not NULL, entry_id VARCHAR (95) not NULL, Trigger_name VARCHAR (200) not NULL, Trigger_group VARCHAR (200) not NULL, instance_name VARCHAR (200) not NULL, Fired_time BIGINT (13) not NULL, Sched_time BIGINT (13) is not NULL, the priority INTEGER is not NULL, the state VARCHAR (16) not NULL, Job_name VARCHAR (200) NULL, Job_group VARCHAR (200) NULL, is_nonconcurrent VARCHAR (1) NULL, Requests_recovery VARCHAR (1) NULL, PRIMARY KEY (sched_name,entry_id)); CREATE TABLE qrtz_scheduler_state (sched_name VARCHAR (120) not NULL, instance_name VARCHAR (200) not NULL, Last_checkin_time BIGINT (13) not NULL, Checkin_interval BIGINT (13) not NULL, PRIMARY KEY (sched_name,instance_name)); CREATE TABLE qrtz_locks (sched_name VARCHAR (120) not NULL, Lock_name VARCHAR (40Not NULL, PRIMARY KEY (sched_name,lock_name)); commit;

This is basically configured, as for the quartz.properties above configuration, I basically are Baidu, there is a description of the place, you can take a look!

Three: summary

Today is the integration to do a good job, a sense of accomplishment ah, haha! Try, come on! Tomorrow should talk to me again, do not know how the wages of the matter how ah! Hope is good Oh! go,boy!

Clusters of spring and quartz (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.