1. Redis Stand Alone Ayarları
Burada Redis stand alone modda kullanılıyorÖrnek
Şöyle yaparız. Burada Redis, Spring Cache olarak kullanılmıyor. Sadece RedisTemplate ile okuma yazma için kullanılıyor.
spring:redis:port: 6161host: localhost
Örnek - pool
Şöyle yaparız.
Örnek - lettuce ayarları
Şöyle yaparız.
Burada Redis Sentinel modda kullanılıyor. Sentinel için LettuceConnectionFactory bean'i elle yaratmak gerekiyor.Şöyle yaparız.
spring.cache.type = redis
spring.redis.host = localhost
spring.redis.port = 6379
spring.redis.pool.max-active = 10000
spring.redis.pool.max-idle = 9000
spring.redis.pool.min-idle = 9000Örnek - password
Şöyle yaparız
spring:cache:type: redisredis:ssl: truehost: spring-on-azure.redis.cache.windows.netport: 6380password: Y27iYghxMcY1qoRVyjQkZExS8RaHdln4QfLsqHRNsHE=
Örnek - jedis ayarları
Şöyle yaparız
redis:jedis:pool:max-idle: 150min-idle: 50timeout: 60000 #connection timeout in milli seconds
Şöyle yaparız.
spring:
  cache:
    type: redis
  redis:
    port: 6666
    password: 123pwd
    sentinel:
      master: masterredis
      nodes:
        - 10.0.0.16
        - 10.0.0.17
        - 10.0.0.18
    lettuce:
      shutdown-timeout: 200ms Örnek
Şöyle yaparız
spring.data.redis.port=26379 spring.data.redis.password=spring.data.redis.sentinel.master=mymaster spring.data.redis.sentinel.nodes=localhostspring.cache.type=redis spring.cache.redis.cache-null-values=false spring.cache.redis.time-to-live=300000 spring.data.redis.timeout=600ms
Örnek
Şöyle yaparız. Docker Compose sayesinde aynı bilgisayarda 3 tane Redis çalışıyor. 
server:
  port: 2000
  
spring:
  application:
    name: spring-redis-sentinel
  data:
    redis:
      password: redispassword
      sentinel:
        master: mymaster
        nodes:
          - 127.0.0.1:26379
          - 127.0.0.1:26380
          - 127.0.0.1:26381
      lettuce:
        shutdown-timeout: 200ms
Örnek
Şöyle yaparız. Docker Compose sayesinde aynı bilgisayarda 3 tane Redis çalışıyor. Portları da 26379,26380,26381. Sentinel portları sentinel.conf dosyasında belirtilir.
Redis Cluster Ayarlarısspring: redis:sentinel: master: redismaster nodes : 26379,26380,26381lettuce: shutdown-timeout: 2000ms password: redisauth port: 26379 url: 127.0.0.1
Şöyle yaparız
spring:
  redis:
    cluster:
      nodes: redis-host-address
    timeout: 3000
    socket-timeout: 1500 
Hiç yorum yok:
Yorum Gönder