zhengfc / redis-cluster-monitor Goto Github PK
View Code? Open in Web Editor NEWRedis Cluster Monitor
Redis Cluster Monitor
Hi zheng,
非常感谢你提供了java版的直接获取redis服务器的信息demo.
当我down我在本地跑的时候,cluster connection已经连接上了,但当我调用
@RequestMapping(value = "/cluster/info", method = RequestMethod.GET) 获取info信息的时候,
报如下错误,
org.springframework.data.redis.ClusterStateFailureException: Could not retrieve cluster information. CLUSTER NODES returned with error.
- 10.132.97.102:7005 failed: Hostname must not be empty or null.
- xx.xx.xx.102:7003 failed: Hostname must not be empty or null.
- xx.xx.xx.102:7004 failed: Hostname must not be empty or null.
- xx.xx.xx.102:7001 failed: Hostname must not be empty or null.
- xx.xx.xx.102:7002 failed: Hostname must not be empty or null.
- xx.xx.xx.102:7000 failed: Hostname must not be empty or null.
我在redis.properties中已经替换了redis IP和端口
spring.redis.cluster.nodes=xx.xx.xx.102:7000,xx.xx.xx.102:7001,xx.xx.xx.102:7002,xx.xx.xx.102:7003,xx.xx.xx.102:7004,xx.xx.xx.102:7005
测试环境同一台服务器集群如下:
root 10452 0.0 0.2 115856 10620 ? Ssl Sep26 1:44 /opt/redis-3.0.0-rc1/src/redis-server *:7000 [cluster]
testuser 21834 0.0 0.0 61192 728 pts/0 R+ 10:55 0:00 grep redis
root 30436 0.0 0.2 103568 12072 ? Ssl Jun08 5:03 /opt/redis-3.0.0-rc1/src/redis-server *:7001 [cluster]
root 30446 0.0 0.3 107664 12176 ? Ssl Jun08 4:25 /opt/redis-3.0.0-rc1/src/redis-server *:7002 [cluster]
root 30451 0.0 0.3 119952 12320 ? Ssl Jun08 5:32 /opt/redis-3.0.0-rc1/src/redis-server *:7003 [cluster]
root 30458 0.0 0.2 103568 10744 ? Ssl Jun08 3:38 /opt/redis-3.0.0-rc1/src/redis-server *:7004 [cluster]
root 30465 0.0 0.2 103568 10756 ? Ssl Jun08 3:26 /opt/redis-3.0.0-rc1/src/redis-server *:7005 [cluster
请帮忙看看什么原因造成的?
非常感谢!
where is the dependency in you pom,no that version [1.7.0.DATAREDIS-315-SNAPSHOT]
<dependency><!-- spring -->
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.7.0.DATAREDIS-315-SNAPSHOT</version>
</dependency>
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clusterController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.redis.cluster.monitor.service.cluster.ClusterService com.redis.cluster.monitor.controller.ClusterController.clusterService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clusterServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.data.redis.connection.jedis.JedisClusterConnection com.redis.cluster.monitor.service.cluster.ClusterServiceImpl.clusterConnection; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getJedisClusterConnection' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisClusterConnection]: Factory method 'getJedisClusterConnection' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getConnectionFactory' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR This instance has cluster support disabled at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.redis.cluster.monitor.service.cluster.ClusterService com.redis.cluster.monitor.controller.ClusterController.clusterService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clusterServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.data.redis.connection.jedis.JedisClusterConnection com.redis.cluster.monitor.service.cluster.ClusterServiceImpl.clusterConnection; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getJedisClusterConnection' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisClusterConnection]: Factory method 'getJedisClusterConnection' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getConnectionFactory' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR This instance has cluster support disabled at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ... 22 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clusterServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.data.redis.connection.jedis.JedisClusterConnection com.redis.cluster.monitor.service.cluster.ClusterServiceImpl.clusterConnection; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getJedisClusterConnection' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisClusterConnection]: Factory method 'getJedisClusterConnection' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getConnectionFactory' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR This instance has cluster support disabled at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ... 24 more Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.data.redis.connection.jedis.JedisClusterConnection com.redis.cluster.monitor.service.cluster.ClusterServiceImpl.clusterConnection; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getJedisClusterConnection' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisClusterConnection]: Factory method 'getJedisClusterConnection' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getConnectionFactory' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR This instance has cluster support disabled at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ... 35 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getJedisClusterConnection' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisClusterConnection]: Factory method 'getJedisClusterConnection' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getConnectionFactory' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR This instance has cluster support disabled at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ... 37 more Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisClusterConnection]: Factory method 'getJedisClusterConnection' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getConnectionFactory' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR This instance has cluster support disabled at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ... 49 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getConnectionFactory' defined in class path resource [com/redis/cluster/support/config/MonitorConfig.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR This instance has cluster support disabled at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:381) at com.redis.cluster.support.config.MonitorConfig$$EnhancerBySpringCGLIB$$b7842fa.getConnectionFactory(<generated>) at com.redis.cluster.support.config.MonitorConfig.getJedisClusterConnection(MonitorConfig.java:47) at com.redis.cluster.support.config.MonitorConfig$$EnhancerBySpringCGLIB$$b7842fa.CGLIB$getJedisClusterConnection$0(<generated>) at com.redis.cluster.support.config.MonitorConfig$$EnhancerBySpringCGLIB$$b7842fa$$FastClassBySpringCGLIB$$713dcc66.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) at com.redis.cluster.support.config.MonitorConfig$$EnhancerBySpringCGLIB$$b7842fa.getJedisClusterConnection(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ... 50 more Caused by: 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:3203) at redis.clients.jedis.JedisClusterInfoCache.discoverClusterNodesAndSlots(JedisClusterInfoCache.java:48) at redis.clients.jedis.JedisClusterConnectionHandler.initializeSlotsCache(JedisClusterConnectionHandler.java:39) at redis.clients.jedis.JedisClusterConnectionHandler.<init>(JedisClusterConnectionHandler.java:28) at redis.clients.jedis.JedisSlotBasedConnectionHandler.<init>(JedisSlotBasedConnectionHandler.java:21) at redis.clients.jedis.JedisSlotBasedConnectionHandler.<init>(JedisSlotBasedConnectionHandler.java:16) at redis.clients.jedis.BinaryJedisCluster.<init>(BinaryJedisCluster.java:39) at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:45) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.createCluster(JedisConnectionFactory.java:303) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.createCluster(JedisConnectionFactory.java:273) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.afterPropertiesSet(JedisConnectionFactory.java:235) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ... 69 more
这个我redis.conf中已经将集群模式打开了,但还是报集集群不可用啊:ERR This instance has cluster support disabled
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.