首页 > 数据库 >Install Redis on macOS

Install Redis on macOS

时间:2023-10-16 16:22:36浏览次数:36  
标签:macOS Install Redis redis running install Homebrew

 

Use Homebrew to install and start Redis on macOS

This guide shows you how to install Redis on macOS using Homebrew. Homebrew is the easiest way to install Redis on macOS. If you'd prefer to build Redis from the source files on macOS, see Installing Redis from Source.

Prerequisites

First, make sure you have Homebrew installed. From the terminal, run:

brew --version

If this command fails, you'll need to follow the Homebrew installation instructions.

Installation

From the terminal, run:

brew install redis

This will install Redis on your system.

Starting and stopping Redis in the foreground

To test your Redis installation, you can run the redis-server executable from the command line:

redis-server

If successful, you'll see the startup logs for Redis, and Redis will be running in the foreground.

To stop Redis, enter Ctrl-C.

Starting and stopping Redis using launchd

As an alternative to running Redis in the foreground, you can also use launchd to start the process in the background:

brew services start redis

This launches Redis and restarts it at login. You can check the status of a launchd managed Redis by running the following:

brew services info redis

If the service is running, you'll see output like the following:

redis (homebrew.mxcl.redis)
Running: ✔
Loaded: ✔
User: miranda
PID: 67975

To stop the service, run:

brew services stop redis

Connect to Redis

Once Redis is running, you can test it by running redis-cli:

redis-cli

This will open the Redis REPL. Try running some commands:

127.0.0.1:6379> lpush demos redis-macOS-demo
OK
127.0.0.1:6379> rpop demos
"redis-macOS-demo"

Next steps

Once you have a running Redis instance, you may want to:

  • Try the Redis CLI tutorial
  • Connect using one of the Redis clients

https://redis.io/docs/getting-started/installation/install-redis-on-mac-os/

 

标签:macOS,Install,Redis,redis,running,install,Homebrew
From: https://www.cnblogs.com/softidea/p/17767613.html

相关文章

  • 使用Redis的好处
    性能极高——redis能支持超过100K+每秒的读写频率丰富的数据类型——Redis支持二进制案例的Strings,Lists,Hashes,Sets及OrderedSets数据类型操作原子——Redis的所有操作都是原子性的,同时Redis还支持对几个操作全并后的原子性执行丰富的特性——Redis还支持p......
  • redis集群的简单应用
    1、创建集群#创建redis示例dockerrun-d--nameredis-node-1--nethost--privileged=true-v/data/redis/share/redis-node-1:/dataredis:6.0.8--cluster-enabledyes--appendonlyyes--port6381dockerrun-d--nameredis-node-2--nethost--privileged=tru......
  • redis在linux下自启命令
    redis在linux下自启命令[Unit]Description=redis-serverAfter=network.target[Service]Type=forkingExecStart=/usr/local/bin/redis-server/software/redis-4.0.9/redis.confExecStop=/usr/local/bin/redis-clishutdownPrivateTmp=true[Install]WantedBy=multi-u......
  • 轻松掌握组件启动之Redis集群扩展秘籍:轻松扩容与缩容,释放高性能潜能
    扩展集群操作扩容在我们原始的集群基础上,我们决定增加一台主节点(8007)和一台从节点(8008),这样新增的节点将会在下图中以虚线框的形式显示在集群中。1:首先,在/usr/local/redis-cluster目录下创建两个文件夹,分别命名为8007和8008。接下来,将8001文件夹下的redis.conf文......
  • Redis安装及开机自启
    Redis6.2安装位置/data/redis访问端口6379配置文件地址/data/redis/bin/makePREFIX=/data/redisinstallcpredis.conf/data/redis/bin/cd/data/redis/bin/./redis-server/data/redis/bin/redis.conf配置redis跟随系统启动自动启动将redis_init_......
  • Redis持久化深度解析
    本文已收录至GitHub,推荐阅读......
  • 轻松掌握组件启动之Redis单机、主从、哨兵、集群配置
    单机配置启动Redis安装下载地址:http://redis.io/download安装步骤:1:安装gcc编译器:yuminstallgcc2:将下载好的redis‐5.0.3.tar.gz文件放置在/usr/local文件夹下,并解压redis‐5.0.3.tar.gz文件wgethttp://download.redis.io/releases/redis‐5.0.3.tar.gztarxzfredis......
  • redis在添加键值时报错"(error) MOVED...."
    问题描述:redis在添加键值时报错"(error)MOVED....",如下所示:数据库:redis6.2.5架构:三主三从1、异常重现192.168.133.97:6001>setk1v1(error)MOVED12706192.168.133.99:6001--集群信息192.168.133.97:6001>clusternodesb98cc2012f531244c29e2633f3d40ffc0c8bb2711......
  • 轻松掌握组件启动之Redis集群扩展秘籍:轻松扩容与缩容,释放高性能潜能
    扩展集群操作扩容在我们原始的集群基础上,我们决定增加一台主节点(8007)和一台从节点(8008),这样新增的节点将会在下图中以虚线框的形式显示在集群中。1:首先,在/usr/local/redis-cluster目录下创建两个文件夹,分别命名为8007和8008。接下来,将8001文件夹下的redis.conf......
  • Redis缓存系统常见问题及解决方案
    首先了解以下Redis缓存机制Redis缓存基于内存,查询时先进入Redis缓存,如若查询不到,则进入MySQL数据库查询信息。数据库取到则更新缓存并返回结果,否则返回空。   缓存穿透问题什么是缓存穿透当用户在Redis缓存系统执行一条无效查询时,这条无效查询将穿透Redis缓存系......