在Windows Service上安装运行Redis

时间:2024-01-13 19:06:50

Windows中redis的下载及安装、设置

一、单机部署使用Redis

1、下载Redis,我选用的是当下的最新版本3.2.0 地址在这里https://github.com/MSOpenTech/redis/releases

下载好之后,直接解压到任意位置,我存放在了 D:\Program Files\Redis-x64-3.2.100

2、运行cmd命令启动Redis服务。

redis-server.exe redis.windows.conf

SDN下载RedisWatcher,运行InstallWatcher.msi默认安装在C:\Program Files (x86)\RedisWatcher,修改watcher.conf

 # required exepath and exename are combined to form full path
exepath D:\redis
exename redis-server.exe # optional fastfailMS is milliseconds after which failure is not failure to start (default 1000)
#fastfailMS 1000 # optional fastfailretries is number of times to retry if failure before fastfailMS (default 0)
#fastfailretries 0 # for each instance to run, put properties between '{' and '}' lines
# required workingdir is working directory for process - must be unique
# optional runmode may be 'console' or 'hidden'
# optional cmdparms is command line after exename (ex: cmdparms redis.conf)
# optional saveout is '1' or '0'. To save stdout to file use '1'.
{
workingdir D:\redis
runmode hidden
saveout 1
cmdparms D:\redis\redis.conf
}
#{
# workingdir c:\redis\inst2
#runmode hidden
#saveout 1
#cmdparms redis.conf
#}

watcher.conf

安装成功之后,可以在WindowsService中找到Redis服务,如下图:

在Windows Service上安装运行Redis

Redis命令参考:http://doc.redisfans.com/

Redis操作的封装类:http://blog.wx6.org/2013/349.htm