Tentang berpindah dari Redis ke Redis-cluster



Datang ke produk yang telah berkembang selama lebih dari satu dekade, sama sekali tidak mengejutkan untuk menemukan teknologi yang ketinggalan jaman di dalamnya. Tetapi bagaimana jika setelah enam bulan Anda harus menahan beban 10 kali lebih tinggi, dan harga air terjun meningkat ratusan kali lipat? Dalam hal ini, Anda membutuhkan Insinyur Beban Tinggi yang keren. Tapi karena kekuranganpembantu , . , 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