Redis—苹果Mac电脑os系统安装Redis步骤


关注微信公众号:CodingTechWork,一起学习进步。

引言

  本文主要介绍macOS系统如何使用Homebrew安装和启动redis服务。

安装

前置条件

首先需要保证你的mac电脑安装了Homebrew,我们可以通过以下命令进行校验

$ brew --version

显示结果

hugh@xxx brew --version
Homebrew 3.4.9-33-g3088bbf
Homebrew/homebrew-core (git revision ca10e12c01f; last commit 2022-05-01)
Homebrew/homebrew-cask (git revision c712bf4e66; last commit 2022-05-01)

若显示报错,则需要安装Homebrew

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

安装Redis

$ brew install redis

操作

启动

$ redis-server

或者

$ brew services start redis
hugh@bogon ~ % brew services start redis
==> Successfully started `redis` (label: homebrew.mxcl.redis)
hugh@bogon ~ % lsof -i:6379
COMMAND     PID       USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
redis-ser 70279 liaojianya    6u  IPv4 0xd856625383e21061      0t0  TCP localhost:6379 (LISTEN)
redis-ser 70279 liaojianya    7u  IPv6 0xd85662537c5bfa31      0t0  TCP localhost:6379 (LISTEN)

验证

  1. 通过brew services info redis命令查看redis信息
hugh@bogon ~ % brew services info redis
redis (homebrew.mxcl.redis)
Running: ✔
Loaded: ✔
Schedulable: ✘
User: hugh
PID: 69410
  1. 通过命令行redis-cli校验
hugh@bogon ~ % redis-cli
127.0.0.1:6379> set key01 hello-world
OK
127.0.0.1:6379> get key01
"hello-world"

停止

通过brew services stop redis命令停止redis

hugh@bogon ~ % brew services stop redis
Stopping `redis`... (might take a while)
==> Successfully stopped `redis` (label: homebrew.mxcl.redis)

通过brew services info redis命令查看redis

hugh@bogon ~ % brew services info redis
redis (homebrew.mxcl.redis)
Running: ✘
Loaded: ✘
Schedulable: ✘
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值