远程启动Redis,报错不能配置键空间通知(keyspace notifications)

来源:互联网 发布:php获取html内容 编辑:程序博客网 时间:2024/06/05 00:59

启动服务器上面的redis,报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException:Unable to configure Redis to keyspace notifications. See http://docs.spring.io/spring-session/docs/current/reference/html5/#api-redisoperationssessionrepository-sessiondestroyedevent

在网上找了好久的原因

1.redis.conf文件中修改  bind为0.0.0.0,

2.

 1、修改reids配置文件(redis.conf)        redis默认不会开启keyspace notifications,因为开启后会对cpu有消耗        备注:            E:keyevent事件,事件以__keyevent@<db>__为前缀进行发布;            x:过期事件,当某个键过期并删除时会产生该事件;        配置如下:            notify-keyspace-events "Ex"

3.sentinel.conf中加入    protected-mode no

然而都不管用 ,依然报之前的错

最后在启动redis的时候用命令  redis-server ../redis.conf   即在原来的命令后面加上配置文件,然后可以了!!

  1. pro
  2. tected-mode no  
原创粉丝点击