折腾:
期间,需要去mac中安装和运行redis
mac中直接:
brew install redis
就好了?
还是去找找是否有要注意的
mac install redis
好像的确是的
去安装:➜ server brew install redis
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/redis-4.0.9.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring redis-4.0.9.high_sierra.bottle.tar.gz
==> Caveats
To have launchd start redis now and restart at login:
brew services start redis
Or, if you don't want/need a background service you can just run:
redis-server /usr/local/etc/redis.conf
==> Summary
🍺 /usr/local/Cellar/redis/4.0.9: 13 files, 2.8MB
➜ server which redis
redis not found
➜ server which redis-cli
/usr/local/bin/redis-cli
➜ server which redis-server
/usr/local/bin/redis-server
➜ server redis-server --version
Redis server v=4.0.9 sha=00000000:0 malloc=libc bits=64 build=e0c8d37381c486c6
➜ server redis-cli --version
redis-cli 4.0.9
➜ server
然后直接去运行redis的server:➜ ~ redis-server
40538:C 11 May 17:49:50.859 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
40538:C 11 May 17:49:50.860 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=40538, just started
40538:C 11 May 17:49:50.860 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
40538:M 11 May 17:49:50.862 * Increased maximum number of open files to 10032 (it was originally set to 4864).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.9 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 40538
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
40538:M 11 May 17:49:50.864 # Server initialized
40538:M 11 May 17:49:50.864 * Ready to accept connections
再去看看redis的shell的效果:➜ ~ redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> KEYS
(error) ERR wrong number of arguments for 'keys' command
127.0.0.1:6379> KEYS *
1) "unacked_mutex"
2) "_kombu.binding.celery"
3) "_kombu.binding.celery.pidbox"
4) "_kombu.binding.celeryev"
127.0.0.1:6379> set tempId abc
OK
127.0.0.1:6379> get tempId
"abc"
127.0.0.1:6379>
是正常的。
【总结】
Mac中安装redisbrew install redis
然后运行redis服务:redis-server
新开终端中去试试效果:redis-cli