Windows下载安装 redis
Windows 64位操作系统
下载redis 文件
https://github.com/microsoftarchive/redis/releases
新建文件夹 redis
将内容cp到新建的文件夹里
测试运行
1 运行cmd命令 切换到redis这个文件夹下
运行 redis-server.exe redis.windows.conf
(备注:通过这个命令,会创建Redis临时服务,不会在window Service列表出现Redis服务名称和状态,此窗口关闭,服务会自动关闭。 测试完成后 可以使用 redis-server --service-start 手动启动)
报错
The Windows version of Redis allocates a memory mapped heap for sharing with the forked process used for persistence operations. In order to share this memory, Windows allocates from the system paging file a portion equal to the size of the Redis heap. At this time there is insufficient contiguous free space available in the system paging file for this operation (Windows error 0x5AF). To work around this you may either increase the size of the system paging file, or decrease the size of the Redis heap with the --maxheap flag.Sometimes a reboot will defragment the system paging file sufficiently for this operation to complete successfully.
Please see the documentation included with the binary distributions for more details on the --maxheap flag.
Redis can not continue. Exiting.
经查,是因为系统内存不足引起的,可以通过添加启动参数解决:
redis-server.exe redis.windows.conf --maxheap 1gb
maxheap参数可以带单位也可以不带单位,不带单位默认为字节。
2 开始一个新的cmd窗口 切换到redis这个文件夹下
运行 redis-cli.exe -h 127.0.0.1 -p 6379
测试运行
设置键值对 set myKey abc
取出键值对 get myKey
如下图 运行成功
这时候,windows环境下,redis的服务端和客户端都运行成功了。
redis 开机自启
redis-server --service-install redis.windows.conf --loglevel verbose
手动启动redis
redis-server --service-start
停止服务
redis-server --service-stop
卸载服务
redis-server --service-uninstall
php安装redis扩展可查看下面
https://blog.csdn.net/huangkang1995/article/details/109185299