官方redis-pubsub来源

时间:2018-04-24 14:43:09

标签: redis apache-kafka spring-cloud-dataflow

我是Spring云数据流的新手。

  1. 我在 kafka_2.11-1.1.0 中创建了一个主题 ./kafka-console-producer.sh --broker-list localhost:9092 --topic test

  2. 我在 Scdf 中注册了 redis-pubsub spring-cloud-dataflow-server-local-1.3.0.RELEASE.jar ):

  3. sink.redis-pubsub=maven://org.springframework.cloud.stream.app:redis-sink-kafka-10:1.3.1.RELEASE
    
    sink.redis-pubsub.metadata=maven://org.springframework.cloud.stream.app:redis-sink-kafka-10:jar:metadata:1.3.1.RELEASE
    
    1. 我在 Scdf :test>redis-pubsub --key=msgs --host=127.0.0.1 --port=6379中创建了以下流,但部署失败。
    2. 我想调试redis-pubsub源来理解这个问题,但我找不到它。你可以帮助我吗?

      这是流日志:

      2018-04-24 15:49:56.322 ERROR 8241 --- [main] o.s.boot.SpringApplication               : Application startup failed
      
      org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.stream.app.redis.sink.RedisSinkConfiguration': Unsatisfied dependency expressed through field 'redisConnectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConnectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration$RedisConnectionConfiguration.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: All sentinels down, cannot determine where is localhost master is running...
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
      at org.springframework.cloud.stream.app.redis.sink.kafka.RedisSinkKafka10Application.main(RedisSinkKafka10Application.java:29) [classes!/:1.3.1.RELEASE]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [redis-sink-kafka-10-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [redis-sink-kafka-10-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [redis-sink-kafka-10-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [redis-sink-kafka-10-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConnectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration$RedisConnectionConfiguration.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: All sentinels down, cannot determine where is localhost master is running...
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      ... 27 common frames omitted
      Caused by: redis.clients.jedis.exceptions.JedisConnectionException: All sentinels down, cannot determine where is localhost master is running...
      at redis.clients.jedis.JedisSentinelPool.initSentinels(JedisSentinelPool.java:180) ~[jedis-2.9.0.jar!/:na]
      at redis.clients.jedis.JedisSentinelPool.<init>(JedisSentinelPool.java:95) ~[jedis-2.9.0.jar!/:na]
      at redis.clients.jedis.JedisSentinelPool.<init>(JedisSentinelPool.java:76) ~[jedis-2.9.0.jar!/:na]
      at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.createRedisSentinelPool(JedisConnectionFactory.java:263) ~[spring-data-redis-1.8.9.RELEASE.jar!/:na]
      at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.createPool(JedisConnectionFactory.java:248) ~[spring-data-redis-1.8.9.RELEASE.jar!/:na]
      at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.afterPropertiesSet(JedisConnectionFactory.java:237) ~[spring-data-redis-1.8.9.RELEASE.jar!/:na]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
      ... 37 common frames omitted
      

1 个答案:

答案 0 :(得分:0)

当redis-sink应用程序无法连接到Redis群集时,会发生此错误。您似乎正在尝试连接到localhost

你可以,

  1. 下载水槽
  2. 在本地启动Redis
  3. 通过以下方式将其作为独立应用运行:java -jar redis-sink-kafka-10:1.3.1.RELEASE.jar
  4. 如果一切设置正确,默认情况下,此应用程序连接到localhost上的Redis实例。如果它在这种模式下工作,它也将在SCDF中。