0x001:mac上安裝mac
上安裝使用homebrew便可,安裝中有許多重要的信息,因此這裏不作省略,並在如下的輸出中作一些註釋。redis
# 輸入 $ brew install redis # 輸出 Updating Homebrew... ==> Downloading https://homebrew.bintray.com/bottles/redis-4.0.9.high_sierra.bot ######################################################################## 100.0% ==> Pouring redis-4.0.9.high_sierra.bottle.tar.gz Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/redis-benchmark Target /usr/local/bin/redis-benchmark already exists. You may want to remove it: rm '/usr/local/bin/redis-benchmark' To force the link and overwrite all conflicting files: brew link --overwrite redis To list all files that would be deleted: brew link --overwrite --dry-run redis Possible conflicting files are: # 這裏是一些工具的位置,又須要能夠直接從下面路徑找到相應工具 /usr/local/bin/redis-benchmark /usr/local/bin/redis-check-aof /usr/local/bin/redis-check-rdb /usr/local/bin/redis-cli /usr/local/bin/redis-sentinel -> /usr/local/bin/redis-server /usr/local/bin/redis-server ==> Caveats To have launchd start redis now and restart at login: brew services start redis Or, if you don't want/need a background service you can just run: # 這裏是啓動服務端的方法,其中包含了默認配置文件的位置 redis-server /usr/local/etc/redis.conf ==> Summary 🍺 /usr/local/Cellar/redis/4.0.9: 13 files, 2.8MB
0x002:啓動服務端
看到如下redis
圖標圖案說明啓動成功,而且能夠從輸出中看出啓動的進程號和端口號工具
# 輸入 $ redis-server # 輸出 ... # 省略部分輸出 ... _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 4.0.8 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 # 端口 | `-._ `._ / _.-' | PID: 72438 # 進程 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' ... ...
# 輸出 $ redis-cli # 輸出,進入`redis`交互界面 127.0.0.1:6379>
# 輸入 127.0.0.1:6379> PING # 輸出 PONG
以上測試都是基於基本配置,不涉及更改配置和遠程鏈接的狀況。測試