redis設定檔詳解,redis設定檔

來源:互聯網
上載者:User

redis設定檔詳解,redis設定檔
#是否以後台進程運行,預設為no
daemonize yes
#如以後台進程運行,則需指定一個pid,預設為/var/run/redis.pid
pidfile d:/redis/var/redis.pid
#監聽連接埠,預設為6379
port 6379
#綁定主機IP,預設值為127.0.0.1(注釋)
# bind 127.0.0.1
#逾時時間,預設為300(秒)(0 to disable)
timeout 300
#日誌記錄等級,有4個可選值,debug,verbose(預設值),notice,warning
loglevel verbose
#日誌記錄方式,預設值為stdout
logfile stdout
#可用資料庫數,預設值為16,預設資料庫為0
databases 16


################################ SNAPSHOTTING #################################
#
# Save the DB on disk:
#指出在多長時間內,有多少次更新操作,就將資料同步到資料檔案。這個可以多個條件配合,比如預設設定檔中的設定,就設定了三個條件。
#900秒(15分鐘)內至少有1個key被改變
save 900 1
#300秒(5分鐘)內至少有10個key被改變
save 300 10
#60秒內至少有10000個key被改變
save 60 10000
#儲存至本機資料庫時是否壓縮資料,預設為yes
rdbcompression yes
#本機資料庫檔案名稱,預設值為dump.rdb
dbfilename dump.rdb
#本機資料庫存放路徑,預設值為 ./
dir d:/redis/var
##當snapshot時出現錯誤無法繼續時,是否阻塞用戶端“變更操作”,“錯誤”可能因為磁碟已滿/磁碟故障/OS層級異常等  
stop-writes-on-bgsave-error yes  


################################# REPLICATION #################################


#當本機為從服務時,設定主服務的IP及連接埠(注釋)
# slaveof <masterip> <masterport>
#當本機為從服務時,設定主服務的串連密碼(注釋)
# masterauth <master-password>


################################## SECURITY ###################################


# 串連密碼(注釋)
requirepass 123


################################### LIMITS ####################################


# 最大用戶端串連數,預設不限制(注釋)'0' means no limits.
# maxclients 128
# 設定最大記憶體,達到最大記憶體設定後,Redis會先嘗試清除已到期或即將到期的Key,當此方法處理後,任到達最大記憶體設定,將無法再進行寫入操作。(注釋)
# maxmemory <bytes>


############################## APPEND ONLY MODE ###############################


# 是否在每次更新操作後進行日誌記錄,如果不開啟,可能會在斷電時導致一段時間內的資料丟失。因為redis本身同步資料檔案是按上面save條件來同步的,所以有的資料會在一段時間內只存在於記憶體中。預設值為no
appendonly yes


# 更新記錄檔名,預設值為appendonly.aof(注釋)
appendfilename d:/redis/var/appendonly.aof
# If unsure, use "everysec".
# 更新日誌條件,共有3個可選值。no表示等作業系統進行資料緩衝同步到磁碟,always表示每次更新操作後手動調用fsync()將資料寫到磁碟,everysec表示每秒同步一次(預設值)。
appendfsync always
# appendfsync everysec
# appendfsync no


################################ VIRTUAL MEMORY ###############################


# 是否使用虛擬記憶體,預設值為no


#vm-enabled no
# vm-enabled yes
# 虛擬記憶體檔案路徑,預設值為/tmp/redis.swap,不可多個Redis執行個體共用
#vm-swap-file d:/redis/redis.swap


# 將所有大於vm-max-memory的資料存入虛擬記憶體,無論vm-max-memory設定多小,所有索引資料都是記憶體儲存的(Redis的索引資料就是keys),也就是說,當vm-max-memory設定為0的時候,其實是所有value都存在於磁碟。預設值為0。
#vm-max-memory 0
#vm-page-size 32
#vm-pages 134217728


# 可以設定訪問swap檔案的線程數,設定最好不要超過機器的核心數,如果設定為0,那麼所有對swap檔案的操作都是串列的.可能會造成比較長時間的延遲,但是對資料完整性有很好的保證.
#vm-max-threads 0


############################### ADVANCED CONFIG ###############################


#glueoutputbuf yes


#hash-max-zipmap-entries 64
#hash-max-zipmap-value 512
#activerehashing yes


################################## INCLUDES ###################################


# Include one or more other config files here. This is useful if you
# have a standard template that goes to all redis server but also need
# to customize a few per-server settings. Include files can include
# other files, so use this wisely.
#
# include /path/to/local.conf
# include /path/to/other.conf

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.