美文网首页
Mac Redis 6.0.10 安装(Homebrew 安装)

Mac Redis 6.0.10 安装(Homebrew 安装)

作者: 夸克星 | 来源:发表于2021-02-28 22:22 被阅读0次

2021年2月28日记录

1. 安装方法

# 推荐先更新brew
brew update -v
# 安装或升级到最新稳定版
brew install redis
or 
brew upgrade redis

查看安装及配置文件位置

安装路径 /usr/local/Cellar/redis/6.0.10

➜  6.0.10 redis-cli -v
redis-cli 6.0.10
➜  6.0.10 redis-server -v
Redis server v=6.0.10 sha=00000000:0 malloc=libc bits=64 build=f02b37c7397e0d7f
➜  6.0.10

配置文件 : /usr/local/etc/redis.conf

brew services start redis
or 
redis-server /usr/local/etc/redis.conf

2. 启动方法

redis默认是前台启动,如果我们想以守护进程的方式运行(后台运行),可以在redis.conf中将
daemonize 默认值no,修改成yes即可。

设置为守护进程, 默认后台启动, 重启机器生效:

# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /usr/local/var/run/redis.pid when daemonized.
daemonize no
➜  6.0.10 brew services start redis
==> Successfully started `redis` (label: homebrew.mxcl.redis)
➜  6.0.10 ps aux|grep redis
ming             74212   0.0  0.0  4268040    772 s003  R+    9:13下午   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn redis
ming             74201   0.0  0.0  4304624   3488   ??  S     9:12下午   0:00.02 /usr/local/opt/redis/bin/redis-server 127.0.0.1:6379
➜  6.0.10

直接前台启动:

➜ redis-server

73535:C 28 Feb 2021 20:52:41.999 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
73535:C 28 Feb 2021 20:52:41.999 # Redis version=6.0.10, bits=64, commit=00000000, modified=0, pid=73535, just started
73535:C 28 Feb 2021 20:52:41.999 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
73535:M 28 Feb 2021 20:52:42.001 * Increased maximum number of open files to 10032 (it was originally set to 256).
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.0.10 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 73535
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

73535:M 28 Feb 2021 20:52:42.003 # Server initialized
73535:M 28 Feb 2021 20:52:42.004 * Ready to accept connections

3. 检测状态:

ps aux|grep redis

➜   ps aux|grep redis
             73591   0.0  0.0  4287496    844 s000  S+    8:55下午   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn redis
             73535   0.0  0.0  4312816   3328 s003  S+    8:52下午   0:00.15 redis-server *:6379
➜ 

默认无密码, 端口6379

 redis-cli
127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>exit

3.关闭方法

在前台终端正确关闭: ctrl + c

^C73985:signal-handler (1614517889) Received SIGINT scheduling shutdown...
73985:M 28 Feb 2021 21:11:29.101 # User requested shutdown...
73985:M 28 Feb 2021 21:11:29.101 * Saving the final RDB snapshot before exiting.
73985:M 28 Feb 2021 21:11:29.103 * DB saved on disk
73985:M 28 Feb 2021 21:11:29.103 # Redis is now ready to exit, bye bye...

正确停止Redis的方式应该是向Redis发送SHUTDOWN命令

brew  services stop redis
or
redis-cli shutdown

强行终止redis

sudo pkill redis-server

相关文章

  • Mac Redis 6.0.10 安装(Homebrew 安装)

    2021年2月28日记录 1. 安装方法 查看安装及配置文件位置 安装路径 /usr/local/Cellar/r...

  • Mac 软件安装

    mac安装homebrew Mac通过homebrew下载过慢问题 Mac使用homebrew安装redis 使用...

  • Mac使用Docker搭建Redis-Cluster

    Mac下Docker的安装可参考Mac homebrew安装DockerSpringBoot连接使用Redis可参...

  • 【redis安装配置】

    1.Mac上redis的安装 mac上用homebrew安装 brew install redis,一个命令很简...

  • Mac brew 安装Redis

    现在我们尝试在mac上通过homeBrew安装redis 安装 redis 版本 brew install red...

  • node + redis使用系列(一)

    一、安装redis(for Mac):利用homebrew 1. 命令:$ brew install redis ...

  • Mac环境下安装Redis

    Mac环境下安装Redis的两种方式: 一、 官网下载redis,手动安装: 安装方式二、Homebrew安装,本...

  • Redis环境搭建(一)

    安装 1. 官网下载最新版 2.通过Homebrew安装: Mac环境下推荐使用Homebrew安装Redis可以...

  • redis安装配置

    1,安装 mac环境下,通过homebrew 安装。 指令:brew install redis linux环境下...

  • Mac 使用 SVN

    一、安装 如果未安装homebrew,需先安装homebrew,安装方法请参照:《MAC 安装 homebrew》...

网友评论

      本文标题:Mac Redis 6.0.10 安装(Homebrew 安装)

      本文链接:https://www.haomeiwen.com/subject/tihnfltx.html