Redis安装(Windows & macOS)

Redis

官方网站:https://redis.io/

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

Windows

Releases · tporadowski/redis (github.com)

点击进入 Redis for Windows

下载 msi 或者 zip

(建议下载zip,msi安装后可能遇到闪退等问题)

下载后解压

双击 redis-server.exe 即可启动

Redis自定义windows服务安装

1.进入Redis安装包目录,安装服务:redis-server.exe --service-install redis.windows.conf --service-name redisserver1 --loglevel verbose

win+r -> services.msc,可以看到服务安装成功

安装服务:redis-server.exe --service-install redis.windows.conf --service-name redisserver1 --loglevel verbose

启动服务:redis-server.exe  --service-start --service-name redisserver1

停止服务:redis-server.exe  --service-stop --service-name redisserver1

卸载服务:redis-server.exe  --service-uninstall--service-name redisserver1

macOS

方式一

进入官网下载

https://redis.io/download

下载 Stable(稳定版)

解压文件

tar zxvf redis-6.2.6.tar.gz

把下载后的 redis-6.2.6.tar.gz 放到 /usr/local/

sudo mv redis-6.2.6 /usr/local/

切换目录

cd /usr/local/redis-6.2.6/

编译

sudo make

提示:Hint: It's a good idea to run 'make test' 😉

那就根据提示运行

sudo make test

提示:\o/ All tests passed without errors!

安装

sudo make install

启动服务

redis-server

方式二

brew安装

brew search redis

安装 redis@4.0

brew install redis@4.0
brew会自动完成编译链接等等

后台启动

brew services start redis@4.0
连接客户端

redis-cli -h 127.0.0.1

非后台启动

/usr/local/opt/redis@4.0/bin/redis-server /usr/local/etc/redis.conf

posted @ 2021-10-14 15:59  fortuneju  阅读(193)  评论(0编辑  收藏  举报