Mac 安裝 Homebrew并配置 Redis

1.Homebrew的安裝與使用

(1)打開終端 鍵入以下命令
xcode-select --install
(2)安裝完畢以上應用繼續
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
(3)等待結束……homebrew安裝完成

基本使用

安裝/卸載軟件

 brew install/uninstall softname

2.利用Homebrew安裝Redis

(1)安裝命令
 brew install redis 
(2)進入安裝目錄
 cd /usr/local/Cellar/redis/4.0.6/bin
(3)啟動、關閉redis

啟動

redis-server

關閉

redis-cli shutdown
(4)連接redis服務
 redis-cli -h  127.0.0.1(ip) -p 1234(端口號)

示例:

 redis-cli -h  127.0.0.1 -p 1234
(5)鍵入授權登錄密碼
127.0.0.1:6379> AUTH 123456(密碼)
(6)退出本次會話
127.0.0.1:6379> quit

3.Redis其他常用命令及配置

開機啟動redis命令

ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

使用launchctl啟動redis server

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

使用配置文件啟動redis server

 redis-server /usr/local/etc/redis.conf

停止redis server的自啟動

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

redis 配置文件的位置
/usr/local/etc/redis.conf

卸載redis和它的文件

brew uninstall redis rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

測試redis server是否啟動

redis-cli ping
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。