• 配置Quartz.net Cluster以及远程管理


    这个例子我们介绍的是使用SQL ServerQuartz.net (version 2.0.2) cluster和crystal-quartz 实现远程管理

    我们需要一个SQLServer数据库,Quartz.net 将所有的job details 和triggers 保存到这个数据库,使用Quartz.NET提供的数据库脚本Quartz.net database schema creation script.

    image

    下面我使用crystal-quartz,用它的CrystalQuartz.Example.RemoteScheduler.Server 示例,下面是它的配置

    <?xml version="1.0"?>
    <configuration>
      <configSections>
        <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <sectionGroup name="common">
          <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/>
        </sectionGroup>
      </configSections>
      <common>
        <logging>
          <factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging">
            <arg key="showLogName" value="true"/>
            <arg key="showDataTime" value="true"/>
            <arg key="level" value="INFO"/>
            <arg key="dateTimeFormat" value="HH:mm:ss:fff"/>
          </factoryAdapter>
        </logging>
      </common>
      <quartz>
        <add key="quartz.scheduler.instanceName" value="MyScheduler" />
        <add key="quartz.scheduler.instanceId" value="AUTO" />
        <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
        <add key="quartz.threadPool.threadCount" value="5" />
        <add key="quartz.threadPool.threadPriority" value="Normal" />
        <add key="quartz.jobStore.useProperties" value="true" />
        <add key="quartz.jobStore.clustered" value="true" />
        <add key="quartz.jobStore.misfireThreshold" value="60000" />
        <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
        <add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
        <add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" />
        <add key="quartz.jobStore.dataSource" value="myDS" />
        <add key="quartz.dataSource.myDS.connectionString" value="data source=MONOMATRIX\SQLEXPRESS;initial catalog=quartznet;user id=sa;password=*****;multipleactiveresultsets=True;" />
        <add key="quartz.dataSource.myDS.provider" value="SqlServer-20" />

        <add key="quartz.scheduler.exporter.type" value="Quartz.Simpl.RemotingSchedulerExporter, Quartz"/>
        <add key="quartz.scheduler.exporter.port" value="5555"/>
        <add key="quartz.scheduler.exporter.bindName" value="QuartzScheduler"/>
        <add key="quartz.scheduler.exporter.channelType" value="tcp"/>
      </quartz>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
      </startup>
    </configuration>

    部署一个管理端,具体可以参照 https://github.com/geffzhang/crystal-quartz/tree/master/examples/CrystalQuartz.Examples.RemoteScheduler/CrystalQuartz.Example.RemoteScheduler ,下面是配置,连接到 5555端口进行远程管理:

    <configuration>
        <configSections>
            <sectionGroup name="crystalQuartz" type="CrystalQuartz.Web.Configuration.CrystalQuartzConfigurationGroup">
                <section name="provider" type="CrystalQuartz.Web.Configuration.ProviderSectionHandler" requirePermission="false" allowDefinition="Everywhere"/>
            </sectionGroup>
        </configSections>
        <crystalQuartz>
            <provider>
                <add property="Type" value="CrystalQuartz.Core.SchedulerProviders.RemoteSchedulerProvider, CrystalQuartz.Core"/>
                <add property="SchedulerHost" value="tcp://localhost:5555/QuartzScheduler"/>
            </provider>
            <!--    <provider>-->
            <!--      <add property="Type" value="CrystalQuartz.Spring.SpringSchedulerProvider, CrystalQuartz.Spring" />-->
            <!--      <add property="SchedulerName" value="scheduler" />-->
            <!--    </provider>-->
        </crystalQuartz>
        <appSettings/>
        <connectionStrings/>
        <system.web>        
            <httpHandlers>
                <add verb="*" path="CrystalQuartzPanel.axd" type="CrystalQuartz.Web.PagesHandler, CrystalQuartz.Web" validate="false"/>
            </httpHandlers>
            <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
        <!-- 
            The system.webServer section is required for running ASP.NET AJAX under Internet
            Information Services 7.0.  It is not necessary for previous version of IIS.
        -->
        <system.webServer>
            <validation validateIntegratedModeConfiguration="false"/>
        <handlers>
          <add verb="*" name="CrystalQuartzPanel" path="CrystalQuartzPanel.axd" type="CrystalQuartz.Web.PagesHandler, CrystalQuartz.Web" />
        </handlers>
        </system.webServer>
    运行一下就可以看到结果了,这里有一个示例http://monomatrix.cloudapp.net/RemoteScheduler/CrystalQuartzPanel.axd?page=job&job=localJob&group=default
    image
     

    Quartz.NET的管理工具

    Quartz.net官方开发指南 第十一课: 高级(企业级)属性

    spring&quartz的项目应用总结

    http://geekswithblogs.net/TarunArora/category/13586.aspx

    MongoDB provider for Quartz.NET

    欢迎大家扫描下面二维码成为我的客户,为你服务和上云

  • 相关阅读:
    微信小程序----map组件实现检索【定位位置】周边的POI
    nginx负载均衡和inotify+rsync文件同步
    mysql主从同步配置和读写分离实现(中间件Amoeba)
    微信小程序----Uncaught ReferenceError: ret is not defined
    微信小程序----wx:key(Now you can provide attr "wx:key" for a "wx:for" to improve performance.)
    回档|NOIP2012 同余方程
    回档|欧几里得算法和扩展欧几里得算法
    回档|Splay tree应用之郁闷的出纳员
    回档|史观小结
    回档|乘积最大
  • 原文地址:https://www.cnblogs.com/shanyou/p/2838721.html
Copyright © 2020-2023  润新知