![redis配置文件.conf的詳細(xì)說明_第1頁](http://file4.renrendoc.com/view/5ceb2aafe6afd47fa996a3fa9d43b350/5ceb2aafe6afd47fa996a3fa9d43b3501.gif)
![redis配置文件.conf的詳細(xì)說明_第2頁](http://file4.renrendoc.com/view/5ceb2aafe6afd47fa996a3fa9d43b350/5ceb2aafe6afd47fa996a3fa9d43b3502.gif)
![redis配置文件.conf的詳細(xì)說明_第3頁](http://file4.renrendoc.com/view/5ceb2aafe6afd47fa996a3fa9d43b350/5ceb2aafe6afd47fa996a3fa9d43b3503.gif)
![redis配置文件.conf的詳細(xì)說明_第4頁](http://file4.renrendoc.com/view/5ceb2aafe6afd47fa996a3fa9d43b350/5ceb2aafe6afd47fa996a3fa9d43b3504.gif)
![redis配置文件.conf的詳細(xì)說明_第5頁](http://file4.renrendoc.com/view/5ceb2aafe6afd47fa996a3fa9d43b350/5ceb2aafe6afd47fa996a3fa9d43b3505.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
redis配置文件redis.conf#BydefaultRedisdoesnotrunasadaemon.Use'yes'ifyouneedNotethatRediswillwriteapidfileinvar/run/redis.pidwhendaemonized.#Redisyes啟daemonize#Whenrunningdaemonized,Rediswritesapidfilein/var/run/redis.pidby#default.Youcanspecifyacustompidfilelocationhere.#Redis以守護(hù)進(jìn)程的方式運行的時候,Redispid/var/run/redis.pid,redis服務(wù)時,需要指定不同的pid文件和端口pidfileAcceptconnectionsonthespecifiedport,defaultis6379.Ifport0isspecifiedRediswillnotlistenonaTCPsocket.port#Ifyouwantyoucanbindasingleinterface,ifthebindoptionisnot#specifiedalltheinterfaceswilllistenfor ingconnections.#指定Redis可接收請求的IP地址,不設(shè)置將處理所有請求,置#bind#ClosetheconnectionafteraisidleforNseconds(0todisable)timeout#Specifythelogfilename.Also'stdout'canbeusedto#Redistologonthestandardoutput.Notethatifyouusestandard#outputforloggingbutdaemonize,logswillbesentto/dev/null#log文件地址,logfile#Setthenumberofdatabases.ThedefaultdatabaseisDB0,youcanselect#adifferentoneonaper-connectionbasisusingSELECT<dbid>where#dbidisanumberbetween0and'databases'-#設(shè)置數(shù)據(jù)庫的個數(shù),SELECTdbid>命令來切換數(shù)據(jù)庫。默認(rèn)使用的數(shù)據(jù)庫是0databases##SavetheDBon# save<seconds><changes> WillsavetheDBifboththegivennumberofsecondsandthegiven numberofwriteoperationsagainsttheDBoccurred.# Intheexamplebelowthebehaviourwillbetosave: after900sec(15min)ifatleast1keychanged after300sec(5min)ifatleast10keyschanged after60secifatleast10000keyschanged# Noteyoucandisablesavingatallcommentingallthe"save"lines.#設(shè)置Redis進(jìn)行數(shù)據(jù)庫鏡像的頻率。#9001個keys#3010個keys#6010000個keyssave900save300save60#CompressstringobjectsusingLZFwhendump.rdbdatabases?#Fordefaultthat'ssetto'yes'asit'salmostalwaysawin.#IfyouwanttosavesomeCPUinthesavingchildsetitto'no'thedatasetwilllikelybebiggerifyouhavecompressiblevaluesorkeys.pressionThefilenamewheretodumptheDBdbfilename#Theworkingdirectory.#TheDBwillbewritteninsidethisdirectory,withthefilenamespecified#aboveusingthe'dbfilename'configurationdirective.##AlsotheAppendOnlyFilewillbecreatedinsidethisdirectory.#Notethatyoumustspecifyadirectoryhere,notafileRedis在進(jìn)行備份時,先會將當(dāng)前數(shù)據(jù)庫的狀態(tài)寫入到一個臨時文件中,等備份完dir./#Master-Slavereplication.UseslaveoftomakeaRedisinstanceacopyof#anotherRedisserver.Notethattheconfigurationislocaltotheslave#soforexampleitispossibletoconfiguretheslavetosavetheDBwitha#differentinterval,ortolistentoanotherport,andsoon.#slaveof<masterip><masterport>#Ifthemasterispasswordprotected(usingthe"requirepass"configuration#directivebelow)itispossibletoltheslavetoauthenticatebefore#startingthereplicationsynchronizationprocess,otherwisethemasterwill#refusetheslaverequest.#masuth<master-#RequirestoissueAUTH<PASSWORD>beforeprocessinganyother#commands.Thismightbeusefulinenvironmentsinwhichyoudonottrust#otherswithaccesstothehostrunningredis-server.##Thisshouldstaycommentedoutforbackwardcompatibilityandbecause#peopledonotneedauth(e.g.theyruntheirownservers).#Warning:sinceRedisisprettyfastanoutsideusercantryup#150kpasswordspersecondagainstagoodbox.Thismeansthatyoushould#useaverystrongpasswordotherwiseitwillbeveryeasytobreak.警告:redis速度相當(dāng)快,一個外部的用戶可以在一秒鐘進(jìn)行150K次的嘗試,#requirepass#Setthemaxnumberofconnectedsatthesametime.Bydefaultthere#isnolimit,andit'suptothenumberoffiledescriptorstheRedisprocess#isabletoopen.Thespecialvalue'0'meansno#OncethelimitisreachedRediswillcloseallthenewconnectionssending#anerror'maxnumberofsreached'.#限制同時連接的客戶數(shù)量。當(dāng)連接數(shù)超過這個值時,redis將不再接收其他連接請求,客戶端嘗試連接時將收到error信息#maxs#Don'tusemorememorythanthespecifiedamountof#WhenthememorylimitisreachedRediswilltrytoremove#accordinglytotheevictionselected(seemaxmemmory-).#IfRediscan'tremovekeysaccordingtothe,oriftheis#setto'noeviction',Rediswillstarttoreplywitherrorstocommands#thatwouldusemorememory,likeSET,LPUSH,andsoon,andwill#toreplytoread-onlycommandslikeGET.#ThisoptionisusuallyusefulwhenusingRedisasanLRUcache,ortoset#anhardmemorylimitforaninstance(usingthe'noeviction').##WARNING:Ifyouhaveslavesattachedtoaninstancewithmaxmemoryon,#thesizeoftheoutputbuffersneededtofeedtheslavesaresubtracted#fromtheusedmemorycount,sothatnetworkproblems/resyncswill#nottriggeraloopwherekeysareevicted,andinturntheoutput#bufferofslavesisfullwithDELsofkeysevictedtriggeringthedeletion#ofmorekeys,andsoforthuntilthedatabaseiscompleyemptied.##Inshort…ifyouhaveslavesattacheditissuggestedthatyouseta#limitformaxmemorysothatthereissomeRAMonthesystemforslave#outputbuffers(butthisisnotneedediftheis'noeviction').#設(shè)置redis能夠使用的最大內(nèi)存。當(dāng)內(nèi)存滿了的時候,如果還接收到set令,redis將先嘗試剔除設(shè)置過expire信息的key,而不管該key的過期時間還沒#在刪除時,將按照過期時間進(jìn)行刪除,最早將要被過期的key將最先被刪除。如果帶有expire信息的key都刪光了,那么將返回錯誤。#這樣,redis將不再接收寫請求,只接收get請求。maxmemory的設(shè)置比較適合于把redis當(dāng)作于類似memcached的緩存來使用#maxmemory#BydefaultRedisasynchronouslydumpsthedatasetondisk.Ifyoucanlive#withtheideathatthelatestrecordswillbelostifsomethinglikeacrash#happensthisisthepreferredwaytorunRedis.Ifinsteadyoucarealot#aboutyourdataanddon'twanttothatasinglerecordcangetlostyou#enabletheappendonlymode:whenthismodeisenabledRediswillappend#everywriteoperationreceivedinthefileappendonly.aof.Thisfilewill#bereadonstartupinordertorebuildthefulldatasetinmemory.#Notethatyoucanhaveboththeasyncdumpsandtheappendonlyfileifyou#like(youhavetocommentthe"save"statementsabovetodisablethe#StillifappendonlymodeisenabledRediswillloadthedatafromthe#logfileatstartupignoringthedump.rdbfile.##IMPORTANT:ChecktheBGREWRITEAOFtocheckhowtorewritethe#logfileinbackgroundwhenitgetstoo#默認(rèn)情況下,redis會在異步的把數(shù)據(jù)庫鏡像備份到磁盤,但是該備份是非#所以redis提供了另外一種更加高效的數(shù)據(jù)庫備份及恢復(fù)方式#開啟appendonly模式之后,redis會把所接收到的每一次寫操作請求都追加到appendonly.aof文件中,當(dāng)redis重新啟動時,會從該文件恢復(fù)出之前的狀#appendonly.aof文件過大,所以redis還支持了BGREWRITEAOF指令,對appendonly.aof進(jìn)行重新整理appendonlyno#Thefsync()calllstheOperatingSystemtoactuallywritedataon#insteadtowaitformoredataintheoutputbuffer.SomeOSwillreallyflush#dataondisk,someotherOSwilljusttrytodoitASAP.##Redissupportsthreedifferent##no:don'tfsync,justlettheOSflushthedatawhenitwants.Faster.#always:fsyncaftereverywritetotheappendonlylog.Slow,Safest.#everysec:fsynconlyifonesecondpassedsincethelastfsync.Compromise.#Thedefaultis"everysec"that'susuallytherightcompromise#speedanddatasafety.It'suptoyoutounderstandifyoucanrelaxthisto#"no"thatwillwilllettheoperatingsystemflushtheoutputbufferwhen#itwants,forbetterperformances(butifyoucanlivewiththeideaof#somedatalossconsiderthedefaultpersistencemodethat'ssnapshotting),#oronthecontrary,use"always"that'sveryslowbutabitsaferthan#everysec.#Ifunsure,use#appendonly.aof文件進(jìn)行同步的頻率。always表示每次有寫操作都進(jìn)行同步,everysec表示對寫操作進(jìn)行累積,每秒同步一次。#appendfsyncalwaysappendfsynceverysec#appendfsyncno#VirtualMemoryallowsRedistoworkwithdatasetsbiggerthantheactual#amountofRAMneededtoholdthewholedatasetinmemory.#Inordertodosoveryusedkeysaretakeninmemorywhiletheotherkeys#areswappedintoaswapfile,similarlytowhatoperatingsystemsdo#withmemory##ToenableVMjustset'vm-enabled'toyes,andsetthefollowingthree#VMparametersaccordinglytoyourneeds.#redis是一個內(nèi)存數(shù)據(jù)庫,而且當(dāng)內(nèi)存滿的時候,無法接收新的寫請求,所以在redis2.0中,提供了虛擬內(nèi)存的支持。#但是需要注意的是,redis中,所有的key都會放在內(nèi)存中,在內(nèi)存不夠時,value把vm-max-memory設(shè)置到足夠來放下你的所有的keyvm-enabled#vm-enabled#ThisisthepathoftheRedisswapfile.Asyoucanguess,swap#can'tbesharedbydifferentRedisinstances,somakesuretouseaswap#fileforeveryredisprocessyouarerunning.Rediswillcominifthe#swapfileisalreadyinuse.#ThebestkindofstoragefortheRedisswapfile(that'saccessedatrandom)#isaSolidStateDisk(SSD).##***WARNING***ifyouareusingasharedhostingthedefaultofputting#theswapfileunder/tmpisnotsecure.CreateadirwithaccessgrantedonlytoRedisuserandconfigureRedistocreatetheswapfilethere.vm-swap-file#vm-max-memoryconfigurestheVMtouseatmaxthespecifiedamountof#RAM.Everythingthatdeosnotfitwillbeswappedondisk*if*possible,that#is,ifthereisstillenoughcontiguousspaceintheswapfile.##Withvm-max-memory0thesystemwillswapeverythingitcan.Notagood#default,justspecifythemaxamountofRAMyoucaninbytes,butit's#bettertoleavesomemargin.ForinstancespecifyanamountofRAM#that'smoreorlessbetween60and80%ofyourRAM.#這里設(shè)置開啟虛擬內(nèi)存之后,redis將使用的最大物理內(nèi)存的大小。默認(rèn)為0,redis將把他所有的能放到交換文件的都放到交換文件中,以盡量少的使用物理#在生產(chǎn)環(huán)境下,需要根據(jù)實際情況設(shè)置該值,最好不要使用默認(rèn)的vm-max-memory#Redisswapfilesissplitintopages.Anobjectcanbesavedusingmultiple#contiguouspages,butpagescan'tbesharedbetweendifferentobjects.#Soifyourpageistoobig,smallobjectsswappedoutondiskwillwaste#alotofspace.Ifyoupageistoosmall,thereislessspaceintheswap#file(assumingyouconfiguredthesamenumberoftotalswapfilepages).#Ifyouusealotofsmallobjects,useapagesizeof64or32bytes.#Ifyouusealotofbigobjects,useabiggerpagesize.#Ifunsure,usethe#設(shè)置虛擬內(nèi)存的頁大小,value值比較大,value中放vmsize#Numberoftotalmemorypagesintheswap#Giventhatthepagetable(abitmapof/usedpages)istakeninmemory,#every8pagesondiskwillconsume1byteofRAM.##Thetotalswapsizeisvmsize*vms#Withthedefaultof32-bytesmemorypagesand pagesRediswill#usea4GBswapfile,thatwilluse16MBofRAMforthepagetable.##It'sbettertousethesmallestacceptablevalueforyourapplication,#butthedefaultislargeinordertoworkinmostconditions.#page數(shù)量,需要注意的是,pagetable信息會放在物理內(nèi)存中,8個page就會占據(jù)RAM中的1個byte。#vmsize*vms#MaxnumberofVMI/Othreadsrunningatthesame#Thisthreadsareusedtoread/writedatafrom/toswapfile,since#alsoencodeanddecodeobjectsfromdisktomemoryorthereverse,abigger#numberofthreadscanhelpwithbigobjectseveniftheycan'thelpwith#I/Oitselfasthephysicaldevicemaynotbeabletocouplewithmany#reads/writesoperationsatthesametime.##Thespecialvalueof0turnoffthreadedI/Oandenablestheblocking#VirtualMemoryimplementation.#VMIOvm-max-threads#Hashesareencodedinaspecialway(muchmorememoryefficient)when#haveatmaxagivennumerofelements,andthebiggestelementdoesnot#exceedagiventhreshold.Youcanconfigurethislimitswiththefol
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年國內(nèi)旅游合作合同標(biāo)準(zhǔn)格式
- 2025年企業(yè)與股東資金互助協(xié)議
- 2025年保險賠付責(zé)任權(quán)益協(xié)議
- 2025年官方版復(fù)婚雙方解除婚姻策劃協(xié)議書
- 2025年人力資源與組織績效評估合同
- 2025年度人工智能策劃投資協(xié)議書
- 2025年古建筑保護(hù)工程進(jìn)度申請監(jiān)管協(xié)議
- 2025年二手房產(chǎn)一次性付款交易合同模板
- 2025年債券交易委托策劃協(xié)議書
- 2025年度店鋪租賃協(xié)議標(biāo)準(zhǔn)格式
- 中小學(xué)校崗位安全工作指南
- 數(shù)據(jù)中心運維方案
- 《愿望的實現(xiàn)》全文
- 病毒性腦炎教學(xué)查房及疑難病例討論
- Word操作練習(xí)題(解析和答案)
- 糖尿病足的多學(xué)科聯(lián)合治療
- 小龍蝦啤酒音樂節(jié)活動策劃方案課件
- 中藥貼敷課件
- 塔吊租賃(大型機械)-招標(biāo)文件模板(完整版)2021.5.13
- 客戶服務(wù)中心操作手冊
- 《戰(zhàn)國策》教學(xué)講解課件
評論
0/150
提交評論