建設(shè)銀行的社會招聘網(wǎng)站/網(wǎng)站seo課設(shè)
Redis.conf詳解
配置文件unit單位對大小寫不敏感
包含
網(wǎng)絡(luò)
bind 127.0.0.1 # 綁定的ip
protected-mode yes # 保護模式
port 6379 # 端口設(shè)置
通用 GENERAL
daemonize yes # 以守護進程的方式運行 默認(rèn)為no
pidfile /var/run/redis_6379.pid #如果以后臺的方式運行,則需要指定一個pid文件#日志
# specify the server verbosity leve1.# This can be one of:
# debug (a lot of information,usefu1 for development/testing)
# verbose (many rarely useful info,but not a mess like the debug leve1)
# notice (moderately verbose,what you want in production probably) 生產(chǎn)環(huán)境
# warning (only very important / critical messages are logged)
logleve1 noticelogfile "" # 日志的文件位置名database 16 # 數(shù)據(jù)庫的數(shù)量,默認(rèn)為16always-show-logo yes # 是否總是顯示logo
快照
持久化,在規(guī)定的時間內(nèi),執(zhí)行了多少次操作,則會持久化到文件.rdb . aof
redis是內(nèi)存數(shù)據(jù)庫,如果沒有持久化,那么斷電即失去
# 如果900秒內(nèi),如果至少有1個key進行了修改,就進行持久化操作
save 900 1
# 如果900秒內(nèi),如果超過10個key進行了修改,就進行持久化操作
save 300 10
# 如果60秒內(nèi),如果10000個key進行了修改,就進行持久化操作
save 60 10000stop-writes-on-bgsave-error yes # 持久化出錯是否還需要繼續(xù)工作rdbcompression yes # 是否壓縮rdb文件,需要消耗一些CPU資源rdbchecksum yes # 保存rdb文件的時候,進行錯誤的檢查校驗dir ./ # rdb文件保存的目錄
安全 SECURITY
可以設(shè)置redis密碼,默認(rèn)是沒有密碼的
限制 CLIENTS
maxclients 10000 # 設(shè)置連接client的最大數(shù)量
maxmemory <bytes> # redis 配置最大的內(nèi)存容量
maxmemory-policy nieviction # 內(nèi)存到達上限的處理策略
APPEND ONLY模式 aof配置
appendonly no # 默認(rèn)是不開啟aof模式的,默認(rèn)使用rdb方式持久化的,在大部分情況下,rdb夠用了
appendfilename "appendonly.aof" # 持久化的文件名字# appendfsync always#每次修改都會sync。消耗性能
appendfsync everysec#每秒執(zhí)行一次 sync,可能會丟失這1s的數(shù)據(jù)!#appendfsync no
#不執(zhí)行sync,這個時候操作系統(tǒng)自己同步數(shù)據(jù),速度最快!