在mac上部署redis服务

Tags: mac 

目录

说明

在mac上做开发,还是将一些常用的服务部署在mac上比较方便

使用brew安装

使用brew搜索、安装redis:

brew search redis
brew install [email protected]

安装成功后,brew提示:

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile


To have launchd start [email protected] now and restart at login:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  redis-server /usr/local/etc/redis.conf

按照提示设置环境变量:

echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
srouce ~/.bash_profile

启动redis:

  brew services start [email protected]

通过brew services list查看服务的状态:

$ brew services list
Name       Status  User   Plist
dbus       stopped
dnsmasq    started root   /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
mysql      started lijiao /Users/lijiao/Library/LaunchAgents/homebrew.mxcl.mysql.plist
openvpn    stopped
[email protected]  started lijiao /Users/lijiao/Library/LaunchAgents/[email protected]
supervisor stopped

连接到本地的redis:

lijiaos-MacBook-Pro:Desktop lijiao$ redis-cli -h 127.0.0.1
127.0.0.1:6379> set  a 1
OK
127.0.0.1:6379> get a
"1"
127.0.0.1:6379> set key value [EX seconds] [PX milliseconds] [NX|XX]
lijiaos-MacBook-Pro:Desktop lijiao$ redis-cli -h 127.0.0.1
127.0.0.1:6379> set a 1
OK
127.0.0.1:6379> get a
"1"
127.0.0.1:6379> set key value [EX seconds] [PX milliseconds] [NX|XX]

mac上的reids-cli会自动给出提示。

参考

  1. 百度经验:怎样在mac上部署redis服务

推荐阅读

Copyright @2011-2019 All rights reserved. 转载请添加原文连接,合作请加微信lijiaocn或者发送邮件: [email protected],备注网站合作

友情链接:  系统软件  程序语言  运营经验  水库文集  网络课程  微信网文  发现知识星球