Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use homeBrew to install Redis in MAC

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces how to use homeBrew to install Redis in MAC, the content is very detailed, interested friends can refer to, hope to be helpful to you.

The operation commands for homeBrew are as follows:

Brew search * * / find a software package brew list / list the packages that have been installed brew install * * / install a software package, by default, install a stable version of brew uninstall * * / / uninstall a software package brew upgrade * / / update a software package brew info * / / check the instructions of the specified software package brew cache clean / / clear the cache

Now we try to install redis through homeBrew on mac

Brew search redis / / appears as follows = > Searching local taps...hiredis redis redis-leveldb redis@2.8 redis@3.2== > Searching taps on GitHub...homebrew/cask/redis-app== > Searching blacklisted, migrated and deleted formulae...

Install the redis3.2 version

Brew install redis@3.2

The installation completion prompts are as follows

/ / configure the environment variables of redis to .zshrc If you need to have redis@3.2 first in your PATH run: echo 'export PATH= "/ usr/local/opt/redis@3.2/bin:$PATH"' > > ~ /. ZshrcTo have launchd start redis@3.2 now and restart at login:// uses launchctl brew to start brew services start redis@3.2 # start Or with configuration file 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@3.2/3.2.12: 13 files, 1.7MB

/ usr/local/etc modify redis.config to find

Change daemonize no to yes to start as a daemon

Configure the environment variable echo 'export PATH= "/ usr/local/opt/redis@3.2/bin:$PATH" > ~ / .zshrc

Launch: brew services start redis@3.2

Or use the

Redis-server / usr/local/etc/redis.conf startup

View the process

Ps axu | grep redis

Isole 84721 0.0 4267768 900 s000S+ 10:08 0purl 00.00 grep redisisole 84501 0.0 4309180 1568? Ss 10:06 0bureau 00.07 redis-server 127.0.0.1 purl 6379

Connect to the client:

Redis-cli-h 127.0.0.1-p 6379

It is as follows:

127.0.1 6379 > get ("123")

Close

Redis-cli shutdown

Kill

Sudo pkill redis-server

Description of the redis.conf configuration file

Redis starts in the foreground by default, not as a daemon: daemonize no, change this to yes, and you can start redis as a daemon.

When redis is run as a daemon, pid is written to the / var/run/reids.pid file by default, which can be specified through pidfile / var/run/redis.pid.

The port number is specified. Needless to say, the default is 6379, which can be modified as needed.

If the client is connected all the time, it will close the connection automatically, which is set by timeout 100. if set to 0, it will not close automatically.

Set the number of redis databases. Databases 16 defaults to 16.

Since redis is a database, it means that if you need to connect, you may need to configure a password, which is not required by default. Requirepass foobared, the client needs to provide a password through the AUTH command when linking.

There are many more, here only a few commands, directly modify the redis.conf is one way, but there is another way is through the command line to modify.

Redis 127.0.0.1 6379 > CONFIG GET CONFIG_SETTING_NAME view a configuration

For example: we need to check the daemonize direct input

Redis 127.0.0.1 6379 > CONFIG GET daemonize

If you modify it, you can directly:

Redis 127.0.0.1 redis 6379 > CONFIG SET daemonize yes will be fine.

On how to use homeBrew in MAC to install Redis is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report