About moving from Redis to Redis-cluster



Coming to a product that has been developing for more than a decade, it is not at all surprising to find outdated technologies in it. But what if after six months you have to keep the load 10 times higher, and the price of the falls increases hundreds of times? In this case, you need a cool Highload Engineer. But for lack ofmaid , . , Redis Redis-cluster, , .





Redis (standalone redis) 1 N ? ?



, Redis … , .


  • -, Redis . VIP- , . , . , , , , .



  • -, . «1 N », , , .





?



  • — Redis-Enterprise. . , , .
  • Redis-cluster. . . , .
  • Tarantool, Memcache, Aerospike . . . . Memcache Tarantool , , , , .




, Redis’ :



  • 2GIS | Golang

    GET SET MGET MSET "SELECT DB"

  • MYSQL | PHP

    GET SET MGET MSET SCAN "KEY BY PATTERN" "SELECT DB"

  • | Golang

    GET SET MGET MSET "SELECT DB" "ADD GEO KEY" "GET GEO KEY" SCAN



, . ? .



Redis-cluster
GET SET /
MGET MSET / . Multi- MGET pipeline N GET
SELECT DB , .
SCAN , HSCAN .
GEO
KEY BY PATTERN , . , SCAN-


Redis vs Redis-cluster



?



  • : .

    • , .
    • « », SCAN, DBSIZE, CLEAR DB ..
    • Multi- , .
  • :

    • .
    • Redis.
    • .
    • .


, , , . . , ,





:



  • . 5 .
  • . - . .
  • . , , Redis.




, :



  • . Prometheus Grafana , , , GET, SET, AUTH ..
  • . , . , , , . — . — . 25, , . «».
  • . , . , (, -). - Redis.




:



  • , . G go-redis . Multi- pipeline-, . PHP , php-redis. , .
  • . . .
  • dry-mode. ( , ), , , ( NewRelic). , , production .
  • dry-, . , , , . ? , , . , , .
  • dry-mode . , . ? . , , - , dry-mode.
  • dry-mode .




.



, Redis — key-value . . , . , .

— (SLOTS). 16 383 . - . , 16 383 .



, N -. Redis, . - . -. . - , . - . , , Redis, , ( , ). , - , - .



, , -, - -. «-» . C .



, .



Redis-CLI. Redis , . .



  • , : cluster nodes. , , , .. cluster info cluster slots.
  • . cluster meet cluster forget. , cluster forget , , . cluster meet . , , . ( ). , , ( ). , , . , , , .
  • , cluster failover. , , . , , . , .
  • . cluster reshard. , . , , . , , . . -, . , . -, - , , . , . , , . , / . , .
  • , , - ? , , , cluster fix. - . , . , . .
  • — monitor. , . , grep , .


. , , , , . , -, Redis . . : , , , . , , . , , (, ), . , -, . , , , , .





, — , ., , . , . - . :



  • timeout 0

    , ( ). 0 —

    . , . , , , . , persist-.
  • Save x y & appendonly yes

    RDB-.

    RDB/AOF .
  • stop-writes-on-bgsave-error no & slave-serve-stale-data yes

    , RDB- . , (yes). (no)

    , Redis .
  • repl-ping-slave-period 5

    , failover’a.

    failover’. 5 .
  • repl-backlog-size 1024mb & epl-backlog-ttl 0

    . , .

    , . , , . , , , , .
  • maxclients 10000

    .

    , . Redis 10 . . , .
  • maxmemory-policy volatile-ttl

    , .

    , , . Redis .


RDB AOF



Redis , . , :



  • RDB-snapshot — . SAVE X Y « X , Y ».
  • Append-only file — . Y .
  • RDB and AOF — .


, , , , .



-, RDB- FORK. , Redis . , , : Redis 8 , 16.



-, . AOF . , . .



, , . , « ». , , ( ). , , «».





, redis-cluster- , , - , .

, , .




All Articles