Mac 安裝 Homebrew并配置 Redis

1.Homebrew的安裝與使用

(1)打開(kāi)終端 鍵入以下命令
xcode-select --install
(2)安裝完畢以上應(yīng)用繼續(xù)
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
(3)等待結(jié)束……h(huán)omebrew安裝完成

基本使用

安裝/卸載軟件

 brew install/uninstall softname

2.利用Homebrew安裝Redis

(1)安裝命令
 brew install redis 
(2)進(jìn)入安裝目錄
 cd /usr/local/Cellar/redis/4.0.6/bin
(3)啟動(dòng)、關(guān)閉redis

啟動(dòng)

redis-server

關(guān)閉

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

示例:

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

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

開(kāi)機(jī)啟動(dòng)redis命令

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

使用launchctl啟動(dòng)redis server

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

使用配置文件啟動(dòng)redis server

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

停止redis server的自啟動(dòng)

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

測(cè)試redis server是否啟動(dòng)

redis-cli ping
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容