Mac环境安装Redis

6 篇文章 0 订阅
2 篇文章 0 订阅

Mac环境安装Redis

本文主要是mac环境安装redis服务的一些步骤

1. Redis下载

redis安装文件下载

2. 编译与安装
第一步:找到下载的redis文件位置使用下面的命令切换到文件目录下,然后将下载的文件解压使用命令进行解压。:
XununandeMacBook-Pro:~ xununan$ cd Downloads/临时下载文件夹/
XununandeMacBook-Pro:临时下载文件夹 xununan$ tar -zxf redis-5.0.7.tar.gz
XununandeMacBook-Pro:临时下载文件夹 xununan$ ls
redis-5.0.7.tar.gz			redis-5.0.7
第二步:将解压后的文件移动到/usr/local/目录下
XununandeMacBook-Pro:临时下载文件夹 xununan$ mv redis-5.0.7 /usr/local/

一般情况下,会出现权限问题,如下:

mv: rename redis-5.0.7 to /usr/local/redis-5.0.7: Permission denied

不要激动,还有一种解决方式,打开访达使用command+shift+G跳转到/usr/local,如图:
/usr/local目录
然后将解压后到文件复制过去即可。

第三步:切换目录至/usr/local/
XununandeMacBook-Pro:临时下载文件夹 xununan$ cd /usr/local/redis-5.0.7/
第四步:编译测试与编译安装
XununandeMacBook-Pro:临时下载文件夹 xununan$ sudo make test
XununandeMacBook-Pro:临时下载文件夹 xununan$ sudo make install

好了,这样就安装完成!!!!

3. 测试
1. 启动redis服务
XununandeMacBook-Pro:redis-5.0.7 xununan$ redis-server
9343:C 31 Dec 2019 17:15:53.915 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
9343:C 31 Dec 2019 17:15:53.915 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=9343, just started
9343:C 31 Dec 2019 17:15:53.915 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
9343:M 31 Dec 2019 17:15:53.917 * Increased maximum number of open files to 10032 (it was originally set to 7168).
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 5.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 9343
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

9343:M 31 Dec 2019 17:15:53.918 # Server initialized
9343:M 31 Dec 2019 17:15:53.918 * Ready to accept connections
9343:M 31 Dec 2019 17:20:54.036 * 100 changes in 300 seconds. Saving...
9343:M 31 Dec 2019 17:20:54.036 * Background saving started by pid 9362
9362:C 31 Dec 2019 17:20:54.039 * DB saved on disk
9343:M 31 Dec 2019 17:20:54.141 * Background saving terminated with success
9343:M 31 Dec 2019 17:25:55.062 * 100 changes in 300 seconds. Saving...
9343:M 31 Dec 2019 17:25:55.063 * Background saving started by pid 9378
9378:C 31 Dec 2019 17:25:55.065 * DB saved on disk
9343:M 31 Dec 2019 17:25:55.166 * Background saving terminated with success
2. 创建终端窗口
XununandeMacBook-Pro:临时下载文件夹 xununan$ redis-cli
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379> set wxm 王小明
OK
127.0.0.1:6379> get wxm
"\xe7\x8e\x8b\xe5\xb0\x8f\xe6\x98\x8e"
127.0.0.1:6379> del wdg
(integer) 1
127.0.0.1:6379>

好了测试完成!!!

以上为个人总结的一些笔记,若有雷同纯属巧合,若有错误欢迎指出,谢谢!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值