1.Homebrew的安裝與使用
(1)打開終端 鍵入以下命令
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)啟動、關(guān)閉redis
啟動
redis-server
關(guān)閉
redis-cli shutdown
(4)連接redis服務(wù)
redis-cli -h 127.0.0.1(ip) -p 1234(端口號)
示例:
redis-cli -h 127.0.0.1 -p 1234
(5)鍵入授權(quán)登錄密碼
127.0.0.1:6379> AUTH 123456(密碼)
(6)退出本次會話
127.0.0.1:6379> quit
3.Redis其他常用命令及配置
開機(jī)啟動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