使用以下命令下载,提取和编译 Redis 6.0:
$ wget http://download.redis.io/releases/redis-6.0.1.tar.gz $ tar xzf redis-6.0.1.tar.gz $ cd redis-6.0.1 $ make
在 src 目录中,现在提供了已编译的二进制文件 。使用以下命令运行 Redis:
$ src/redis-server
$ src/redis-cli redis> set command notfound OK redis> get command "notfound"
微软 Github 维护地址:https://github.com/MicrosoftArchive/redis/releases,注意:不建议用在生产环境!启动 redis-server.exe
,将默认加载 redis.windows.conf
。
Admin@DESKTOP-CommandNotFound E:\Redis $ redis-server.exe [23644] 08 May 12:03:41.311 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server.exe /path/to/redis.conf _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.2.100 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 23644 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [23644] 08 May 12:03:41.319 # Server started, Redis version 3.2.100 [23644] 08 May 12:03:41.320 * DB loaded from disk: 0.000 seconds [23644] 08 May 12:03:41.320 * The server is now ready to accept connections on port 6379 [23644] 08 May 12:07:00.110 # User requested shutdown... [23644] 08 May 12:07:00.110 * Saving the final RDB snapshot before exiting. [23644] 08 May 12:07:00.147 * DB saved on disk
如果平时希望以 Windows Services 的方式运行 Redis,则输入命令:redis-server --service-install redis.windows.conf
,默认端口 6379,如需更改,请在 redis.windows.conf
查找。
Admin@DESKTOP-CommandNotFound E:\Redis $ redis-server --service-install redis.windows.conf [26120] 08 May 12:07:05.627 # Granting read/write access to 'NT AUTHORITY\NetworkService' on: "E:\Redis" "E:\Redis\" [26120] 08 May 12:07:05.629 # Redis successfully installed as a service.
安装后的启动服务命令:redis-server --service-start
(如果被告知启动失败!因为未关闭第一个窗口,以下错误为未关闭第一个窗口)
redis-server --service-uninstall #卸载服务 redis-server --service-start #开启服务 redis-server --service-stop #停止服务