注册为本地服务
cmd进入到对应的redis文件夹下并执行一下命令
redis-server.exe --service-install redis.windows.conf
从图中看到已成功授权并且注册成功,接下来,我们到windows服务(右键单击windows菜单-》计算机管理-》服务和应用程序-》服务)中去看一下是否有redis服务:
开启Redis服务
方法一:选中Redis项右击-》启动
方法二:redis-server --service-start
开启成功后,可以看到Redis项状态变为 正在运行,如下图:
到这里,我们就可以用 redis-cli 成功连接redis服务了。
命令规整
注册服务 redis-server --service-install redis.windows.conf
删除服务 redis-server --service-uninstall
开启服务 redis-server --service-start
停止服务 redis-server --service-stop
创建多个Redis实例
step1: 复制一份redis.windows.conf 配置文件,改名为 redis.windows10001.conf
step2:更改 redis.windows10001.conf 配置文件的信息
端口号 port 为 10001
其他先不作说明
step3:注册为windows服务
redis-server.exe --service-install redis.windows10001.conf --service-name redis10001 --port 10001
从windows服务中可以看到,有两个redis服务,刚才注册的是redis10001,服务还未开启,如下图所示: