轉(zhuǎn):https://blog.csdn.net/pucao_cug/article/details/68951860
?redis有windows版和linux版的,本文講的是windows版相關(guān)的一些問題。
1、問題
使用命令redis-server.exe ? --service-install ? redis.windows.conf命令將redis注冊為服務(wù),啟動(dòng)服務(wù)時(shí)報(bào)錯(cuò):
本地計(jì)算機(jī)上的Redis服務(wù)啟動(dòng)后停止。某些服務(wù)在未由其他服務(wù)或程序使用時(shí)將自動(dòng)停止。
使用命令redis-server.exe ??redis.windows.conf臨時(shí)安裝redis,結(jié)果報(bào)錯(cuò):
The Windows version of Redis allocates a memory mapped heap forsharing with
the forked process used for persistenceoperations. In order to share this
memory, Windows allocates from the systempaging file a portion equal to the
size of the Redis heap. At this time thereis insufficient contiguous free
space available in the system paging filefor this operation (Windows error
0x5AF). To work around this you may eitherincrease the size of the system
paging file, or decrease the size of theRedis heap with the --maxheap flag.
Sometimes a reboot will defragment thesystem paging file sufficiently for
this operation to complete successfully.
?
Please see the documentation included withthe binary distributions for more
details on the --maxheap flag.
?
Redis can not continue. Exiting.
如圖:
2、原因
由于沒有指定maxheap導(dǎo)致的,當(dāng)然了不指定該參數(shù)不一定報(bào)錯(cuò),但是出現(xiàn)上述原因,通常是這個(gè)原因?qū)е碌摹?/p>
3、解決
3.1、如果需要臨時(shí)啟動(dòng)Redis
使用命令:redis-server.exe? ?redis.windows.conf? ?--maxheap?200m
? ? ? ? 說明:200m是指定最大堆內(nèi)存是200m,當(dāng)然你也可以修改得在大一些
3.2、如果需要將Redis注冊為服務(wù)
? ? ? ? 如果已經(jīng)注冊為了服務(wù),先卸載掉,卸載方法是,用cmd進(jìn)入到你的redis文件的目錄,然后執(zhí)行命令:
redis-server ? ? --service-uninstall?
? ? ? ?卸載完成后,重新安裝服務(wù),執(zhí)行命令:
redis-server.exe ? --service-install ??redis.windows.conf ? ?--maxheap ?200m
說明:200m是指定最大堆內(nèi)存是200m,當(dāng)然你也可以修改得在大一些
4、其他說明
可以到github上下載最新版的redis
地址是:
https://github.com/MSOpenTech/redis/releases
windows系統(tǒng)的話,可以下載msi版直接安裝,我這里下載的是zip版,自己執(zhí)行命令來安裝
如圖:
?