복붙노트

[REDIS] 레디 스 센티넬과 올바른 @EnableRedisHttpSession 구성

REDIS

레디 스 센티넬과 올바른 @EnableRedisHttpSession 구성

나는 여러 백엔드 봄 부팅 서버와 봄 클라우드 기반 응용 프로그램이 있습니다. 서버는 모든 @EnableRedisHttpSession를 통해 레디 스 서버와 자신의 세션을 공유하고 있습니다.

나는 마스터 - 슬레이브 구성 및 레디 스 센티넬와 응용 프로그램을 구성하기 위해 노력하고있어. 내 설정은 1 개 주인이 노예, 3 센티넬입니다.

나는 환경과 점점 문제를 계속. 처음에는 READONLY 나의 노예를 말하는 오류가 발생했습니다. 그래서 나는 READWRITE 모든 노예를 설정했다. 다음, 나는 여전히 오류가 발생했습니다. 슬레이브가 마스터로 승격되었을 때, 이전 마스터가 기본 읽기 전용 설정으로, 노예가되었습니다 것으로 밝혀졌습니다. 그래서 내가 아니라 READWRITE에 마스터를 설정했다. 다음은 (는이 단계에서 테스트 목적의 나는 그것이 동일한 시스템을 사용하는 말도 안돼 알고)가 레디 스 서버를 부팅 내 명령입니다 :

부팅 마스터 :

redis-server --slave-read-only no --port 6379

부팅 노예 :

redis-server --slaveof 127.0.0.1 6379 --slave-read-only no --port 6380
redis-server --slaveof 127.0.0.1 6379 --slave-read-only no --port 6381

세션에 참여 스프링 부트 서버 당 application.properties/yml 설정 :

#Redis config
spring.redis.sentinel.master: mymaster
spring.redis.sentinel.nodes: localhost:5000,localhost:5001,localhost:5002

레디 스 감시 설정 :

redis-sentinel sentinel-0.conf
redis-sentinel sentinel-1.conf
redis-sentinel sentinel-2.conf

conf의 파일은 다음과 같습니다

port 5000
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
sentinel config-epoch mymaster 6

다른 두 센티넬의 경우는 포트 5001 및 5002의

이제 한 모든 것이 정상이며 문제가 없는지 등 모든 것이 잘 작동합니다.

나는 마스터 레디 스 서버를 죽일 그러나 일단 상황이 작동을 중지. 첫째, 나는 다음과 같은 오류가 발생합니다 :

There was an unexpected error (type=Internal Server Error, status=500).
Cannot get Jedis connection; nested exception is     redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

내 응용 프로그램을 다시 시작할 때 더 나쁜 것은, 상황이 아니라 작업을 중지합니다. 이 말에 따라 실제 오류는 없지만, 응용 프로그램은 단순히 작동하지 않습니다. 예를 들어, 대신 나 콘텐츠 제공, 나는 그냥 텍스트 (NO 자바 스크립트 / CSS / 이미지)와 페이지를 얻을. 이것은 그것을 사용하는 데 필요한 세션 ID를 찾을 수 없다는 일반적으로 나타냅니다. 그리고 이것은 심지어 로그 아웃 한 후 발생합니다.

나는 마스터 서버를 죽일 때, 감시 내 설정 파일을 다시 작성 레디 스 것으로 나타났습니다. 예를 들어, 마스터 레디 스 서버를 죽인 후 sentinel.conf 지금과 같이 나타납니다 :

port 5000
sentinel monitor mymaster 127.0.0.1 6381 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
sentinel config-epoch mymaster 6
# Generated by CONFIG REWRITE
dir "/user/odedia/.jenkins/workspace/boot_redis_sentinel_0"
sentinel leader-epoch mymaster 6
sentinel known-slave mymaster 127.0.0.1 6380
sentinel known-slave mymaster 127.0.0.1 6379
sentinel known-sentinel mymaster 127.0.0.1 5002 28d5fdf14fcc023045f00b00fcdbd4d4f4554611
sentinel known-sentinel mymaster 127.0.0.1 5001 a492f1f0e270fa67c22e057fbd12e981811a79fe
sentinel current-epoch 6

이제 이러한 설정도 모든 서버를 다시 시작한 후 / 노드 레디 스대로 남아있다. 난 단지 수동으로 설정 파일을 수정하여 다시 응용 프로그램 작업을 얻을 수 있습니다.

분명히 나는 ​​현재이 솔루션을 사용할 수 없습니다. 어떤 도움을 크게 감상 할 수있다.

여기에 전체 스택 트레이스는 다음과 같습니다

2016-02-29 12:11:12.640 ERROR 32389 --- [enerContainer-1] o.s.d.r.l.RedisMessageListenerContainer  : Connection failure occurred. Restarting subscription task after 5000 ms
2016-02-29 12:11:16.134 ERROR 32389 --- [nio-9090-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception

org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
    at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:162) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:251) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:58) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:128) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:91) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:78) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:178) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:153) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:86) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.core.DefaultHashOperations.entries(DefaultHashOperations.java:220) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.data.redis.core.DefaultBoundHashOperations.entries(DefaultBoundHashOperations.java:101) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.getSession(RedisOperationsSessionRepository.java:233) ~[spring-session-1.0.2.RELEASE.jar!/:na]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.getSession(RedisOperationsSessionRepository.java:220) ~[spring-session-1.0.2.RELEASE.jar!/:na]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.getSession(RedisOperationsSessionRepository.java:141) ~[spring-session-1.0.2.RELEASE.jar!/:na]
    at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.getSession(SessionRepositoryFilter.java:276) ~[spring-session-1.0.2.RELEASE.jar!/:na]
    at org.springframework.web.context.request.ServletRequestAttributes.updateAccessedSessionAttributes(ServletRequestAttributes.java:255) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.context.request.AbstractRequestAttributes.requestCompleted(AbstractRequestAttributes.java:48) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:106) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:125) ~[spring-session-1.0.2.RELEASE.jar!/:na]
    at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:65) ~[spring-session-1.0.2.RELEASE.jar!/:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103) ~[spring-boot-actuator-1.3.0.RELEASE.jar!/:1.3.0.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.3.RELEASE.jar!/:4.2.3.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) ~[tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_65]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_65]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.28.jar!/:8.0.28]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65]
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
    at redis.clients.util.Pool.getResource(Pool.java:50) ~[jedis-2.7.3.jar!/:na]
    at redis.clients.jedis.JedisPool.getResource(JedisPool.java:99) ~[jedis-2.7.3.jar!/:na]
    at redis.clients.jedis.JedisPool.getResource(JedisPool.java:12) ~[jedis-2.7.3.jar!/:na]
    at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:155) ~[spring-data-redis-1.6.1.RELEASE.jar!/:1.6.1.RELEASE]
    ... 55 common frames omitted
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused
    at redis.clients.jedis.Connection.connect(Connection.java:164) ~[jedis-2.7.3.jar!/:na]
    at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:82) ~[jedis-2.7.3.jar!/:na]
    at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1641) ~[jedis-2.7.3.jar!/:na]
    at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:85) ~[jedis-2.7.3.jar!/:na]
    at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868) ~[commons-pool2-2.4.2.jar!/:2.4.2]
    at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435) ~[commons-pool2-2.4.2.jar!/:2.4.2]
    at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363) ~[commons-pool2-2.4.2.jar!/:2.4.2]
    at redis.clients.util.Pool.getResource(Pool.java:48) ~[jedis-2.7.3.jar!/:na]
    ... 58 common frames omitted
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_65]
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_65]
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_65]
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_65]
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_65]
    at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_65]
    at redis.clients.jedis.Connection.connect(Connection.java:158) ~[jedis-2.7.3.jar!/:na]
    ... 65 common frames omitted

또한, 여기 센티넬 로그 중 하나의 출력은 다음과 같습니다

           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.6 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in sentinel mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 5001
 |    `-._   `._    /     _.-'    |     PID: 30337
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

30337:X 29 Feb 12:43:42.898 # Sentinel runid is b2146318c65fb869a5933d6812b41de89cd0131a
30337:X 29 Feb 12:43:42.898 # +monitor master mymaster 127.0.0.1 6379 quorum 2
30337:X 29 Feb 12:43:45.015 * -dup-sentinel master mymaster 127.0.0.1 6379 #duplicate of 127.0.0.1:5000 or 719b5af91a18190a4d07059243bb664b95047f0f
30337:X 29 Feb 12:43:45.015 * +sentinel sentinel 127.0.0.1:5000 127.0.0.1 5000 @ mymaster 127.0.0.1 6379
30337:X 29 Feb 12:43:45.095 * -dup-sentinel master mymaster 127.0.0.1 6379 #duplicate of 127.0.0.1:5002 or b375d206c4833c1196911073f63a13f9ee19b5b1
30337:X 29 Feb 12:43:45.095 * +sentinel sentinel 127.0.0.1:5002 127.0.0.1 5002 @ mymaster 127.0.0.1 6379
30337:X 29 Feb 12:44:07.928 # +sdown master mymaster 127.0.0.1 6379
30337:X 29 Feb 12:44:08.502 # +new-epoch 66
30337:X 29 Feb 12:44:08.630 # +vote-for-leader 719b5af91a18190a4d07059243bb664b95047f0f 66
30337:X 29 Feb 12:44:09.094 # +odown master mymaster 127.0.0.1 6379 #quorum 3/2
30337:X 29 Feb 12:44:09.094 # Next failover delay: I will not start a failover before Mon Feb 29 12:46:08 2016
30337:X 29 Feb 12:46:08.143 # +new-epoch 67
30337:X 29 Feb 12:46:08.144 # +vote-for-leader b375d206c4833c1196911073f63a13f9ee19b5b1 67
30337:X 29 Feb 12:46:08.150 # Next failover delay: I will not start a failover before Mon Feb 29 12:48:08 2016
30337:X 29 Feb 12:48:08.309 # +new-epoch 68
30337:X 29 Feb 12:48:08.310 # +try-failover master mymaster 127.0.0.1 6379
30337:X 29 Feb 12:48:08.313 # +vote-for-leader b2146318c65fb869a5933d6812b41de89cd0131a 68
30337:X 29 Feb 12:48:08.318 # 127.0.0.1:5002 voted for b2146318c65fb869a5933d6812b41de89cd0131a 68
30337:X 29 Feb 12:48:08.318 # 127.0.0.1:5000 voted for b2146318c65fb869a5933d6812b41de89cd0131a 68
30337:X 29 Feb 12:48:08.403 # +elected-leader master mymaster 127.0.0.1 6379
30337:X 29 Feb 12:48:08.404 # +failover-state-select-slave master mymaster 127.0.0.1 6379
30337:X 29 Feb 12:48:08.466 # -failover-abort-no-good-slave master mymaster 127.0.0.1 6379
30337:X 29 Feb 12:48:08.525 # Next failover delay: I will not start a failover before Mon Feb 29 12:50:08 2016

여기서합니다 (SIGTERM 통지 포함) 레디 스 마스터의 로그이다 :

                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.6 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 30316
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

30316:S 29 Feb 12:43:42.883 # Server started, Redis version 3.0.6
30316:S 29 Feb 12:43:42.883 * DB loaded from disk: 0.000 seconds
30316:S 29 Feb 12:43:42.883 * The server is now ready to accept connections on port 6379
30316:S 29 Feb 12:43:42.883 * Connecting to MASTER 127.0.0.1:6380
30316:S 29 Feb 12:43:42.883 * MASTER <-> SLAVE sync started
30316:S 29 Feb 12:43:42.883 # Error condition on socket for SYNC: Connection refused
30316:S 29 Feb 12:43:43.896 * Connecting to MASTER 127.0.0.1:6380
30316:S 29 Feb 12:43:43.896 * MASTER <-> SLAVE sync started
30316:S 29 Feb 12:43:43.896 * Non blocking connect for SYNC fired the event.
30316:S 29 Feb 12:43:43.896 * Master replied to PING, replication can continue...
30316:S 29 Feb 12:43:43.896 * Partial resynchronization not possible (no cached master)
30316:S 29 Feb 12:43:43.897 * Full resync from master: 04f525038fe60c44a75fac73285485fa534bf24c:1
30316:S 29 Feb 12:43:43.996 * MASTER <-> SLAVE sync: receiving 18 bytes from master
30316:S 29 Feb 12:43:43.996 * MASTER <-> SLAVE sync: Flushing old data
30316:S 29 Feb 12:43:43.996 * MASTER <-> SLAVE sync: Loading DB in memory
30316:S 29 Feb 12:43:43.996 * MASTER <-> SLAVE sync: Finished with success
30316:signal-handler (1456742796) Received SIGTERM scheduling shutdown...

그리고 여기에 두 레디 스 노예의 로그입니다 :

                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.6 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6380
 |    `-._   `._    /     _.-'    |     PID: 30319
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

30319:M 29 Feb 12:43:42.884 # Server started, Redis version 3.0.6
30319:M 29 Feb 12:43:42.884 * DB loaded from disk: 0.000 seconds
30319:M 29 Feb 12:43:42.884 * The server is now ready to accept connections on port 6380
30319:M 29 Feb 12:43:42.891 * Slave 127.0.0.1:6381 asks for synchronization
30319:M 29 Feb 12:43:42.891 * Full resync requested by slave 127.0.0.1:6381
30319:M 29 Feb 12:43:42.891 * Starting BGSAVE for SYNC with target: disk
30319:M 29 Feb 12:43:42.891 * Background saving started by pid 30333
30333:C 29 Feb 12:43:42.901 * DB saved on disk
30333:C 29 Feb 12:43:42.901 * RDB: 0 MB of memory used by copy-on-write
30319:M 29 Feb 12:43:42.984 * Background saving terminated with success
30319:M 29 Feb 12:43:42.984 * Synchronization with slave 127.0.0.1:6381 succeeded
30319:M 29 Feb 12:43:43.896 * Slave 127.0.0.1:6379 asks for synchronization
30319:M 29 Feb 12:43:43.896 * Full resync requested by slave 127.0.0.1:6379
30319:M 29 Feb 12:43:43.896 * Starting BGSAVE for SYNC with target: disk
30319:M 29 Feb 12:43:43.897 * Background saving started by pid 30368
30368:C 29 Feb 12:43:43.903 * DB saved on disk
30368:C 29 Feb 12:43:43.903 * RDB: 0 MB of memory used by copy-on-write

둘째:

                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.6 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6381
 |    `-._   `._    /     _.-'    |     PID: 30325
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

30325:S 29 Feb 12:43:42.889 # Server started, Redis version 3.0.6
30325:S 29 Feb 12:43:42.889 * DB loaded from disk: 0.000 seconds
30325:S 29 Feb 12:43:42.889 * The server is now ready to accept connections on port 6381
30325:S 29 Feb 12:43:42.889 * Connecting to MASTER 127.0.0.1:6380
30325:S 29 Feb 12:43:42.889 * MASTER <-> SLAVE sync started
30325:S 29 Feb 12:43:42.889 * Non blocking connect for SYNC fired the event.
30325:S 29 Feb 12:43:42.890 * Master replied to PING, replication can continue...
30325:S 29 Feb 12:43:42.891 * Partial resynchronization not possible (no cached master)
30325:S 29 Feb 12:43:42.892 * Full resync from master: 04f525038fe60c44a75fac73285485fa534bf24c:1
30325:S 29 Feb 12:43:42.984 * MASTER <-> SLAVE sync: receiving 18 bytes from master
30325:S 29 Feb 12:43:42.984 * MASTER <-> SLAVE sync: Flushing old data
30325:S 29 Feb 12:43:42.984 * MASTER <-> SLAVE sync: Loading DB in memory
30325:S 29 Feb 12:43:42.984 * MASTER <-> SLAVE sync: Finished with success

감사.

해결법

  1. ==============================

    1.나는 마침내 해결책을 발견했다. 그것은 나를 앞으로 충분히 생각하지 않은 개발자 인이었다 ...

    나는 마침내 해결책을 발견했다. 그것은 나를 앞으로 충분히 생각하지 않은 개발자 인이었다 ...

    이 jedisConnectionFactory 콩을 찾을 수 있다고 말해 (이 세션 관리에있어 중요한 하나입니다 게이트웨이) 서버 중 하나를 부팅 할 때 아주 먼 과거의 어느 시점에서 나는 예외를 얻었다. 내가 하나를 썼다 그래서, 포트 6379에서 로컬 호스트를 가리키는 ... 메인 클래스에서, 하드 코딩 :). 의심 할 여지가 감시 구성은 무시되었습니다.

    @Bean 제거두고, 모든 것이 완벽하게 작동한다.

    방법은 나는 다른 사람에 대한 참조의 좋은 포인트가 될 수 발견했다. 처음에 나는 봄이 application.properties 내 항목을 무시났습니다.

    그래서, 난 내 자신의 sentinelConfig @Bean 내 자신의 jedisConnectionFactory @Bean과 함께, 내 자신의 @Configuration 클래스를 썼다. 봄은 내 sentinelConfig을 집어하지만 완전히 내 jedisConnectionFactory (간단한 디버그 문제가 있음을 확인) 무시했다.

    그래서, customJedisConnectionFactory 같은에 빈 이름을 변경 한 다음 나는 RedisConnectionFactory을 구현하는 두 콩를하는 것에 대한 오류 메시지를 받았습니다. 거기에서 내 소스 코드의 다른 @Bean을 찾을 빨랐다.

    감사.

  2. from https://stackoverflow.com/questions/35686670/correct-enableredishttpsession-configuration-with-redis-sentinel by cc-by-sa and MIT license