jlinn / quartz-redis-jobstore

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

Auth fails under cluster mode #24

Open armersong opened 7 years ago

armersong commented 7 years ago

Password is not unused when creating JedisCluster instance.
Pls see: RedisJobStore.java line 129

Set<HostAndPort> nodes = buildNodesSetFromHost();
jedisCluster = new JedisCluster(nodes);
storage = new RedisClusterStorage(redisSchema, mapper, signaler, instanceId, lockTimeout);

Related config in quartz.properties:

# set the scheduler's JobStore class (required)
org.quartz.jobStore.class = net.joelinn.quartz.jobstore.RedisJobStore
# set the Redis host (required)
# <your redis host or a comma-delimited list of host:port if clustered use is desired>
org.quartz.jobStore.host = localhost:6379,localhost:6379
# set the scheduler's trigger misfire threshold in milliseconds (optional, defaults to 60000)
org.quartz.jobStore.misfireThreshold = 60000
# set the redis password (optional, defaults null)
org.quartz.jobStore.password = 123456
# set the redis port (optional, defaults to 6379)
org.quartz.jobStore.port = 6379
# enable Redis clustering (optional, defaults to false)
org.quartz.jobStore.redisCluster = true
# enable Redis sentinel (optional, defaults to false)
#org.quartz.jobStore.redisSentinel = <true or false>
# set the sentinel master group name (required if redisSentinel = true)
#org.quartz.jobStore.masterGroupName = <your master group name>
# set the redis database (optional, defaults to 0)
org.quartz.jobStore.database: 0
# set the Redis key prefix for all JobStore Redis keys (optional, defaults to none)
org.quartz.jobStore.keyPrefix = purchase/quartz/
# set the Redis lock timeout in milliseconds (optional, defaults to 30000)
org.quartz.jobStore.lockTimeout = 30000

log info:

Caused by: redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.
        at redis.clients.jedis.Protocol.processError(Protocol.java:127)
        at redis.clients.jedis.Protocol.process(Protocol.java:161)
        at redis.clients.jedis.Protocol.read(Protocol.java:215)
        at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
        at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:285)
        at redis.clients.jedis.Connection.getObjectMultiBulkReply(Connection.java:291)
        at redis.clients.jedis.Jedis.clusterSlots(Jedis.java:3376)
        at redis.clients.jedis.JedisClusterInfoCache.discoverClusterNodesAndSlots(JedisClusterInfoCache.java:54)
        at redis.clients.jedis.JedisClusterConnectionHandler.initializeSlotsCache(JedisClusterConnectionHandler.java:39)
        at redis.clients.jedis.JedisClusterConnectionHandler.<init>(JedisClusterConnectionHandler.java:17)
        at redis.clients.jedis.JedisSlotBasedConnectionHandler.<init>(JedisSlotBasedConnectionHandler.java:20)
        at redis.clients.jedis.JedisSlotBasedConnectionHandler.<init>(JedisSlotBasedConnectionHandler.java:15)
        at redis.clients.jedis.BinaryJedisCluster.<init>(BinaryJedisCluster.java:41)
        at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:83)
        at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:70)
        at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:66)
        at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:62)
        at net.joelinn.quartz.jobstore.RedisJobStore.initialize(RedisJobStore.java:129)
        at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1333)
        at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
        at org.springframework.scheduling.quartz.SchedulerFactoryBean.createScheduler(SchedulerFactoryBean.java:597)
        at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:480)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579)
Linone commented 7 years ago

+1

Would it be possible to release version with the fix?

Linone commented 7 years ago

If anybody has this issue and is in need of new version, here's mirror on gitlab with built artifacts:

https://gitlab.com/LazyBun/quartz-redis-jobstore-fork/commit/43e3910193c3cb6fa3d8390e3ebae9d166c7133d/pipelines