在mac上部署redis服务

 技巧  mac 

作者: 李佶澳   转载保留:原文地址   更新时间:2017/11/06 11:27:11

说明

在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服务

本文原创首发于网站:www.lijiaocn.com

 技巧  mac 

QQ交流群

区块链实践互助QQ群:576555864

Kubernetes实践互助QQ群:947371129

Prometheus实践互助QQ群:952461804

Kong/Envoy实践互助QQ群:952503851

Ansible实践互助QQ群:955105412

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