jlinn / quartz-redis-jobstore

A Quartz Scheduler JobStore using Redis.
Apache License 2.0
137 stars 66 forks source link

ERR This instance has cluster support disabled #10

Open riteshpuj2013 opened 8 years ago

riteshpuj2013 commented 8 years ago

Hi @jlinn

I am getting this exception when i set the redisCluster property to true:

Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: ERR This instance has cluster support disabled at redis.clients.jedis.Protocol.processError(Protocol.java:117) at redis.clients.jedis.Protocol.process(Protocol.java:151) at redis.clients.jedis.Protocol.read(Protocol.java:205) at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297) at redis.clients.jedis.Connection.getBinaryBulkReply(Connection.java:216) at redis.clients.jedis.Connection.getBulkReply(Connection.java:205) at redis.clients.jedis.Jedis.clusterNodes(Jedis.java:3166) at redis.clients.jedis.JedisClusterInfoCache.discoverClusterNodesAndSlots(JedisClusterInfoCache.java:48) at redis.clients.jedis.JedisClusterConnectionHandler.initializeSlotsCache(JedisClusterConnectionHandler.java:36) at redis.clients.jedis.JedisClusterConnectionHandler.(JedisClusterConnectionHandler.java:25) at redis.clients.jedis.JedisSlotBasedConnectionHandler.(JedisSlotBasedConnectionHandler.java:21) at redis.clients.jedis.JedisCluster.(JedisCluster.java:53) at redis.clients.jedis.JedisCluster.(JedisCluster.java:48) at redis.clients.jedis.JedisCluster.(JedisCluster.java:35) at redis.clients.jedis.JedisCluster.(JedisCluster.java:27) at redis.clients.jedis.JedisCluster.(JedisCluster.java:31) at net.joelinn.quartz.jobstore.RedisJobStore.initialize(RedisJobStore.java:116) at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1321) at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1525) at com.quartzsamples.fromdoc.schedulers.Example1.main(Example1.java:29)

quartz, properties file

org.quartz.jobStore.class = net.joelinn.quartz.jobstore.RedisJobStore org.quartz.jobStore.host = localhost

org.quartz.jobStore.port =

org.quartz.jobStore.redisCluster = true

org.quartz.jobStore.redisSentinel =

org.quartz.jobStore.masterGroupName =

org.quartz.jobStore.database:

org.quartz.jobStore.keyPrefix = aprefix org.quartz.jobStore.lockTimeout = 30000 org.quartz.threadPool.threadCount = 3

Example1 Class

package com.quartzsamples.fromdoc.schedulers;

import static org.quartz.JobBuilder.newJob; import static org.quartz.TriggerBuilder.newTrigger;

import java.util.Date;

import org.quartz.DateBuilder; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.SchedulerFactory; import org.quartz.Trigger; import org.quartz.impl.StdSchedulerFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory;

import com.quartzsamples.fromdoc.jobs.HelloJob;

public class Example1 { public static void main(String[] args) throws SchedulerException {

    Logger log = LoggerFactory.getLogger(Example1.class);
    Date mydate = DateBuilder.evenHourDate(new Date());
    JobDetail job = newJob(HelloJob.class).withIdentity("myJob").build();
    Trigger trig = newTrigger().withIdentity("mytrigger").startAt(mydate).build();
    SchedulerFactory sf = new StdSchedulerFactory(
            "com/quartzsamples/fromdoc/properties/quartz.properties");
    Scheduler sched = sf.getScheduler();
        sched.scheduleJob(job, trig);
        sched.start();

}

}

Job Class

package com.quartzsamples.fromdoc.jobs;

import java.util.Date;

import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException;

public class HelloJob implements Job{

@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
    System.out.println("From HelloJob Class "+new Date());
    System.out.println(arg0.getFireInstanceId());
}

}

Please help me with this.

jlinn commented 8 years ago

It looks like you're seeing that error because clustering is disabled on your target Redis instance. Is the cluster-enabled setting turned on in your Redis config?

riteshpuj2013 commented 8 years ago

Thanks for pointing out. Once i did setup the cluster, the exception was gone. Can you help me with some guide which has this kind of information to use quartz with redis.

Thank you so much again.

Danny-Hazelcast commented 7 years ago

related issue, but connecting to a redis pack enterprise cluster configured with the web console https://github.com/jlinn/quartz-redis-jobstore/issues/26