iT邦幫忙

2021 iThome 鐵人賽

DAY 10
0
Software Development

Redis還在學系列 第 10

Day10 Redis組態檔設定-LUA SCRIPTING/REDIS CLUSTER/CLUSTER DOCKER/NAT support/SLOW LOG/LATENCY MONITOR

Redis.config

LUA SCRIPTING

  • lua-time-limit

執行lua script允許執行時間上限,超過則會被刪除.(毫秒)

https://ithelp.ithome.com.tw/upload/images/20210925/20111658Zmp0MQdlp0.png

# 預設
lua-time-limit 5000

REDIS CLUSTER

  • cluster-enabled

是否啟用Redis Server Cluster模式.

https://ithelp.ithome.com.tw/upload/images/20210925/201116588vT3jBCnFB.png

# 預設
# cluster-enabled yes
  • cluster-config-file

Redis Server Cluster 設定檔案名稱.

https://ithelp.ithome.com.tw/upload/images/20210925/20111658Sw1Anxcc6d.png

# 預設
# cluster-config-file nodes-6379.conf
  • cluster-node-timeout

設定Redis Server Cluster 節點連接逾時.(毫秒)

https://ithelp.ithome.com.tw/upload/images/20210925/20111658sA4oNX2i7M.png

# 預設
# cluster-node-timeout 15000
  • cluster-replica-validity-factor

如果設爲0,則一個Replica將總是嘗試故障轉移一個Master。如果設爲>0,則最大失去連接的時間是node timeout乘以這個factor。

https://ithelp.ithome.com.tw/upload/images/20210925/20111658bqW083OBbz.png

# 預設
# cluster-replica-validity-factor 10
  • cluster-migration-barrier

設定Master和Replica保持連接的最小數量(最少與多少個Replica保持連接),也就是說至少與其它多少Replica保持連接的Replica纔有資格成爲Master。

https://ithelp.ithome.com.tw/upload/images/20210925/20111658kmp4XcpbkW.png

# 預設
# cluster-migration-barrier 1
  • cluster-allow-replica-migration

設定是否允許自動切換Replica成為Master.

https://ithelp.ithome.com.tw/upload/images/20210925/201116583M7LljtvLX.png

# 預設
# cluster-allow-replica-migration yes
  • cluster-require-full-coverage

設定yes時,key space沒有達到百分之多少時停止接受寫請求。如果設置爲no,將仍然接受查詢請求,即使它只是請求部分key.

https://ithelp.ithome.com.tw/upload/images/20210925/20111658hXMK95AXXa.png

# 預設
# cluster-require-full-coverage yes
  • cluster-replica-no-failover

設定為yes時,可防止從設備嘗試對其進行故障轉移Master在主故障期間,除非強制執行手動故障轉移。

https://ithelp.ithome.com.tw/upload/images/20210925/20111658GKAr6P6KNh.png

# 預設
# cluster-replica-no-failover no
  • cluster-allow-reads-when-down

是否允許在Cluster機制停止時還可以讀取.

https://ithelp.ithome.com.tw/upload/images/20210925/20111658irp7CTmeEp.png

# 預設
# cluster-allow-reads-when-down no

CLUSTER DOCKER/NAT support

  • cluster-announce-ip

設定docker Cluster IP

  • cluster-announce-tls-port

設定docker Cluster TLS Port

  • cluster-announce-port

設定docker Cluster 對外 Port

  • cluster-announce-bus-port

設定docker Cluster Bus Port

https://ithelp.ithome.com.tw/upload/images/20210925/20111658YcbjMbFGGp.png

# cluster-announce-ip 10.1.1.5
# cluster-announce-tls-port 6379
# cluster-announce-port 0
# cluster-announce-bus-port 6380

SLOW LOG

  • slowlog-log-slower-than

設定執行操作超過多少時間時記錄起來.(百萬分之一秒)

https://ithelp.ithome.com.tw/upload/images/20210925/20111658wUZ6oH4PVW.png

# 預設
# 0.01 秒
slowlog-log-slower-than 10000
  • slowlog-max-len

設定記錄操作慢的日誌最多保存長度.

https://ithelp.ithome.com.tw/upload/images/20210925/20111658xdMAuXigHF.png

# 預設
slowlog-max-len 128

LATENCY MONITOR

  • latency-monitor-threshold

設定一個延時閾值來開啓延時監控,藉此收集資料確認Redis操作延遲問題。(毫秒)

https://ithelp.ithome.com.tw/upload/images/20210925/20111658cFnUu9mQqn.png

# 預設
latency-monitor-threshold 0

上一篇
Day9 Redis組態檔設定-LAZY FREEING/THREADED IO/KERNEL OOM CONTROL/APPEND ONLY MODE
下一篇
Day11 Redis組態檔設定-EVENT NOTIFICATION/GOPHER SERVER/ADVANCED CONFIG/ACTIVE DEFRAGMENTATION
系列文
Redis還在學30

尚未有邦友留言

立即登入留言