Redis windows 测试redis持久化功能Word文件下载.docx
- 文档编号:20582963
- 上传时间:2023-01-24
- 格式:DOCX
- 页数:12
- 大小:21.21KB
Redis windows 测试redis持久化功能Word文件下载.docx
《Redis windows 测试redis持久化功能Word文件下载.docx》由会员分享,可在线阅读,更多相关《Redis windows 测试redis持久化功能Word文件下载.docx(12页珍藏版)》请在冰豆网上搜索。
25.#notice(moderatelyverbose,whatyouwantinproductionprobably)
26.#warning(onlyveryimportant/criticalmessagesarelogged)
27.logleveldebug
28.
29.#Specifythelogfilename.Also'
stdout'
canbeusedtoforce
30.#thedemontologonthestandardoutput.Notethatifyouusestandard
31.#outputforloggingbutdaemonize,logswillbesentto/dev/null
32.logfilestdout
33.
34.#Setthenumberofdatabases.ThedefaultdatabaseisDB0,youcanselect
35.#adifferentoneonaper-connectionbasisusingSELECT<
dbid>
where
36.#dbidisanumberbetween0and'
databases'
-1
37.databases16
38.
39.################################SNAPSHOTTING#################################
40.#
41.#SavetheDBondisk:
42.#
43.#save<
seconds>
<
changes>
44.#
45.#WillsavetheDBifboththegivennumberofsecondsandthegiven
46.#numberofwriteoperationsagainsttheDBoccurred.
47.#
48.#Intheexamplebelowthebehaviourwillbetosave:
49.#after900sec(15min)ifatleast1keychanged
50.#after300sec(5min)ifatleast10keyschanged
51.#after60secifatleast10000keyschanged
52.save9001
53.save30010
54.save6010000
55.
56.#CompressstringobjectsusingLZFwhendump.rdbdatabases?
57.#Fordefaultthat'
ssetto'
asit'
salmostalwaysawin.
58.#IfyouwanttosavesomeCPUinthesavingchildsetitto'
no'
but
59.#thedatasetwilllikelybebiggerifyouhavecompressiblevaluesorkeys.
60.rdbcompressionyes
61.
62.#ThefilenamewheretodumptheDB
63.dbfilenamedump.rdb
64.
65.#Fordefaultsave/loadDBin/fromtheworkingdirectory
66.#Notethatyoumustspecifyadirectorynotafilename.
67.dir./
68.
69.#################################REPLICATION#################################
70.
71.#Master-Slavereplication.UseslaveoftomakeaRedisinstanceacopyof
72.#anotherRedisserver.Notethattheconfigurationislocaltotheslave
73.#soforexampleitispossibletoconfiguretheslavetosavetheDBwitha
74.#differentinterval,ortolistentoanotherport,andsoon.
75.#
76.#slaveof<
masterip>
masterport>
77.
78.#Ifthemasterispasswordprotected(usingthe"
requirepass"
configuration
79.#directivebelow)itispossibletotelltheslavetoauthenticatebefore
80.#startingthereplicationsynchronizationprocess,otherwisethemasterwill
81.#refusetheslaverequest.
82.#
83.#masterauth<
master-password>
84.
85.##################################SECURITY###################################
86.
87.#RequireclientstoissueAUTH<
PASSWORD>
beforeprocessinganyother
88.#commands.Thismightbeusefulinenvironmentsinwhichyoudonottrust
89.#otherswithaccesstothehostrunningredis-server.
90.#
91.#Thisshouldstaycommentedoutforbackwardcompatibilityandbecausemost
92.#peopledonotneedauth(e.g.theyruntheirownservers).
93.#
94.#requirepassfoobared
95.
96.###################################LIMITS####################################
97.
98.#Setthemaxnumberofconnectedclientsatthesametime.Bydefaultthere
99.#isnolimit,andit'
suptothenumberoffiledescriptorstheRedisprocess
100.#isabletoopen.Thespecialvalue'
0'
meansnolimts.
101.#OncethelimitisreachedRediswillcloseallthenewconnectionssending
102.#anerror'
maxnumberofclientsreached'
.
103.#
104.#maxclients128
105.
106.#Don'
tusemorememorythanthespecifiedamountofbytes.
107.#WhenthememorylimitisreachedRediswilltrytoremovekeyswithan
108.#EXPIREset.Itwilltrytostartfreeingkeysthataregoingtoexpire
109.#inlittletimeandpreservekeyswithalongertimetolive.
110.#Rediswillalsotrytoremoveobjectsfromfreelistsifpossible.
111.#
112.#Ifallthisfails,Rediswillstarttoreplywitherrorstocommands
113.#thatwillusemorememory,likeSET,LPUSH,andsoon,andwillcontinue
114.#toreplytomostread-onlycommandslikeGET.
115.#
116.#WARNING:
maxmemorycanbeagoodideamainlyifyouwanttouseRedisasa
117.#'
state'
serverorcache,notasarealDB.WhenRedisisusedasareal
118.#databasethememoryusagewillgrowovertheweeks,itwillbeobviousif
119.#itisgoingtousetoomuchmemoryinthelongrun,andyou'
llhavethetime
120.#toupgrade.Withmaxmemoryafterthelimitisreachedyou'
llstarttoget
121.#errorsforwriteoperations,andthismayevenleadtoDBinconsistency.
122.#
123.#maxmemory<
bytes>
124.
125.##############################APPENDONLYMODE###############################
126.
127.#BydefaultRedisasynchronouslydumpsthedatasetondisk.Ifyoucanlive
128.#withtheideathatthelatestrecordswillbelostifsomethinglikeacrash
129.#happensthisisthepreferredwaytorunRedis.Ifinsteadyoucarealot
130.#aboutyourdataanddon'
twanttothatasinglerecordcangetlostyoushould
131.#enabletheappendonlymode:
whenthismodeisenabledRediswillappend
132.#everywriteoperationreceivedinthefileappendonly.log.Thisfilewill
133.#bereadonstartupinordertorebuildthefulldatasetinmemory.
134.#
135.#Notethatyoucanhaveboththeasyncdumpsandtheappendonlyfileifyou
136.#like(youhavetocommentthe"
save"
statementsabovetodisablethedumps).
137.#StillifappendonlymodeisenabledRediswillloadthedatafromthe
138.#logfileatstartupignoringthedump.rdbfile.
139.#
140.#Thenameoftheappendonlyfileis"
appendonly.log"
141.#
142.#IMPORTANT:
ChecktheBGREWRITEAOFtocheckhowtorewritetheappend
143.#logfileinbackgroundwhenitgetstoobig.
144.
145.appendonlyyes
146.
147.#Thefsync()calltellstheOperatingSystemtoactuallywritedataondisk
148.#insteadtowaitformoredataintheoutputbuffer.SomeOSwillreallyflush
149.#dataondisk,someotherOSwilljusttrytodoitASAP.
150.#
151.#Redissupportsthreedifferentmodes:
152.#
153.#no:
don'
tfsync,justlettheOSflushthedatawhenitwants.Faster.
154.#always:
fsyncaftereverywritetotheappendonlylog.Slow,Safest.
155.#everysec:
fsynconlyifonesecondpassedsincethelastfsync.Compromise.
156.#
157.#Thedefaultis"
always"
that'
sthesaferoftheoptions.It'
suptoyouto
158.#understandifyoucanrelaxthisto"
everysec"
thatwillfsynceverysecond
159.#orto"
no"
thatwilllettheoperatingsystemflushtheoutputbufferwhen
160.#itwant,forbetterperformances(butifyoucanlivewiththeideaof
161.#somedatalossconsiderthedefaultpersistencemodethat'
ssnapshotting).
162.
163.appendfsyncalways
164.#appendfsynceverysec
165.#appendfsyncno
166.
167.###############################ADVANCEDCONFIG###############################
168.
169.#Gluesmalloutputbufferstogetherinordertosendsmallrepliesina
170.#singleTCPpacket.UsesabitmoreCPUbutmostofthetimesitisawin
171.#intermsofnumberofqueriespersecond.Use'
ifunsure.
172.glueoutputbufyes
173.
174.#Useobjectsharing.Cansavealotofmemoryifyouhavemanycommon
175.#stringinyourdataset,butperformslookupsagainstthesharedobjects
176.#poolsoitusesmoreCPUandcanbeabitslower.Usuallyit'
sagood
177.#idea.
178.#
179.#Whenobjectsharingisenabled(shareobjectsyes)youcanuse
180.#shareobjectspoolsizetocontrolthesizeofthepoolusedinordertotry
181.#objectsharing.Abiggerpoolsizewillleadtobettersharingcapabilities.
182.#Ingeneralyouwantthisvaluetobeatleastthedoubleofthenumberof
183.#verycommonstringsyouhaveinyourdataset.
184.#
185.#WARNING:
objectsharingisexperimental,don'
tenablethisfeature
186.#inproductionbeforeofRedis1.0-stable.Stillpleasetrythisfeaturein
187.#yourdevelopmentenvironmentsothatwecantestitbetter.
188.#shareobjectsno
189.#shareobjectspoolsize1024
启动redis
打开运行窗口
F:
\>
cdredis-2.0.2
\redis-2.0.2>
redis-server.exeredis.conf
[2944]15Jun22:
44:
29*Serverstarted,Redisversion2.0.2
29*DBloadedfromappendonlyfile:
0seconds
29*Theserverisnowreadytoacceptconnectionsonport
379
30-DB0:
1keys(0volatile)in4slotsHT.
30-0clientsconnected(0slaves),450888bytesinuse
在打开一个窗口运行客户端
redis-cli.exe
redis>
设置值:
setajunajun
Reconnecting...OK
OK
取值:
getajun
"
ajun"
停止redis服务
shutdown
如果需要redis持久化数据需要配置redis日志开启
在每次更新操作后进行日志记录,如果不开启,可能会在断电时导致一段时间内的数据丢失。
因为redis本身同步数据文件是按上面save条件来同步的,所以有的数据会在一段时间内只存在于内存中。
默认值为no
此时要在redis.conf中修改或者添加
appendonlyyes
更新日志文件名,默认值为appendonly.aof
#更新日志条件,共有3个可选值。
no表示等操作系统进行数据缓存同步到磁盘,always表示每次更新操作后手动调用fsync()将数据写到磁盘,everysec表示每秒同步一次(默认值)。
#appendfsyncalways
appendfsynceverysec
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Redis windows 测试redis持久化功能 测试 持久 功能