服务端测试常常用到这样那样的工具, 测试环境还要自己维护, 自己动手学习总比等别人来帮你搞要快很多.今天讲讲redis在mac上安装, 非常简单, 跟我一起学习吧!
对应qq群号:616961231
1. brew install redis
louie-mac:~ louiezhou$ brew install redis
Warning: redis 5.0.1 is already installed and up-to-date
To reinstall 5.0.1, run `brew reinstall redis`
louie-mac:~ louiezhou$ cd /usr/local/Cellar/redis/
louie-mac:redis louiezhou$ ls
5.0.1
安装的目录
louie-mac:~ louiezhou$ cd /usr/local/Cellar/redis/
安装版本: 5.0.1
2. 启动redis server
louie-mac:redis louiezhou$ redis-server
11515:C 16 Nov 2018 12:43:39.214 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
11515:C 16 Nov 2018 12:43:39.214 # Redis version=5.0.1, bits=64, commit=00000000, modified=0, pid=11515, just started
11515:C 16 Nov 2018 12:43:39.214 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
11515:M 16 Nov 2018 12:43:39.215 * Increased maximum number of open files to 10032 (it was originally set to 256).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.1 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 11515
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
11515:M 16 Nov 2018 12:43:39.217 # Server initialized
11515:M 16 Nov 2018 12:43:39.217 * Ready to accept connections
看到上面信息,就说明redis 启动成功了
3. 使用redis 客户端:
louie-mac:redis louiezhou$ redis-cli
127.0.0.1:6379> get key
(nil)
127.0.0.1:6379>
4. 关闭客户端:
quit
5. 关闭客户端redis-cli和redis-server
shutdown
6. 查看redis的运行情况
7. 测试redis-server是否启动
louie-mac:redis louiezhou$ redis-cli
127.0.0.1:6379> ping pudong
"pudong"
8. redis-cli连接服务端:
redis-cli -h [ip地址] -p 6379 -a [用户名] subscribe [消费者id]
9. 卸载redis和其他文件
brew uninstall redis
10. 客户端管理工具
https://www.jianshu.com/p/214baa511f2e
brew cask install rdm 多试几次才成功
希望以上内容能够帮助到你, 解决实际问题, 如果文章对你有帮助请关注我的公众号并分享转发, 让更多的小伙伴一起学习成长.
更多精彩内容请关注微信公众号猛戳二维码了解更多哦
推荐阅读