安装redis mac

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/liuyanlinglanq/article/details/79118949

在MAC上安装redis,命令如下

brew search redis:查找brew下是否有redis可以安装;

~:$ brew search redis
hiredis                           redis                             redis-leveldb                     [email protected]                         [email protected]                         [email protected]
homebrew/php/php53-redis                           homebrew/php/php55-redis                           homebrew/php/php70-redis                           homebrew/php/php72-redis
homebrew/php/php54-redis                           homebrew/php/php56-redis                           homebrew/php/php71-redis                           caskroom/cask/redis-app

If you meant "redis" specifically:
It was migrated from caskroom/cask to homebrew/core.

brew install redis:根据结果有redis,安装redis;为redis-4.0.1版本;

^C由于homebrew更新时间比较长,用^C停止更新homebrew,直接开始安装redis;

~:$ brew install redis
Updating Homebrew...
^C==> Downloading http://download.redis.io/releases/redis-4.0.1.tar.gz
######################################################################## 100.0%
==> make install PREFIX=/usr/local/Cellar/redis/4.0.1 CC=clang
==> 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.1: 11 files, 2.7MB, built in 38 seconds

服务启动

~:$ redis-server
32149:C 21 Jan 11:42:00.073 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
32149:C 21 Jan 11:42:00.074 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=32149, just started
32149:C 21 Jan 11:42:00.074 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
32149:M 21 Jan 11:42:00.075 * Increased maximum number of open files to 10032 (it was originally set to 256).
32149:M 21 Jan 11:42:00.076 # Creating Server TCP listening socket *:6379: bind: Address already in use
python安装

   mac其实自带python,不用安装;

   python为2.7.10版本,使用exit()或者^D可以退出;

~:$ python
Python 2.7.10 (default, Jul 15 2017, 17:16:57) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.  
>>> ^D
使用pip为pythone安装redis客户端库

~:$ pip3 install redis
Collecting redis
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/3b/f6/7a76333cf0b9251ecf49efff635015171843d9b977e4ffcf59f9c4428052/redis-2.10.6-py2.py3-none-any.whl (64kB)
    100% |████████████████████████████████| 71kB 1.1MB/s 
Installing collected packages: redis
Successfully installed redis-2.10.6
安装hiredis,这是一个C 库,可以提高Python的redis客户端库的速度。

~:$ brew search hiredis
hiredis 
~:$ brew install hiredis
Updating Homebrew...
^C==> Downloading https://github.com/redis/hiredis/archive/v0.13.3.tar.gz
==> Downloading from https://codeload.github.com/redis/hiredis/tar.gz/v0.13.3
######################################################################## 100.0%
==> make install PREFIX=/usr/local/Cellar/hiredis/0.13.3
?  /usr/local/Cellar/hiredis/0.13.3: 31 files, 189.6KB, built in 18 seconds

猜你喜欢

转载自blog.csdn.net/liuyanlinglanq/article/details/79118949