Installing and configuring Redis under Mac

Source: Internet
Author: User
Tags install redis redis server

Installing Redis with homebrew can reduce the amount of installation and configuration effort.

    • Detects if the homebrew is installed

Brew-v

    • Installation commands

Brew Install Redis

    • Message after installation is complete

To has launchd start Redis at login:
Ln-sfv/usr/local/opt/redis/*.plist ~/library/launchagents
Then-to-load Redis now:
Launchctl Load ~/library/launchagents/homebrew.mxcl.redis.plist
Or, if you don ' t want/need launchctl, you can just run:
Redis-server/usr/local/etc/redis.conf

    • Boot up Redis command

$ ln-sfv/usr/local/opt/redis/*.plist ~/library/launchagents

    • Starting Redis server with Launchctl

$ launchctl Load ~/library/launchagents/homebrew.mxcl.redis.plist

    • To start Redis server using a configuration file

$ redis-server/usr/local/etc/redis.conf

    • Redis commands are used to perform operations on the Redis service.

      A Redis client is required to execute commands on the Redis service. The Redis client is in the Redis installation package that we downloaded earlier.

      • To start the Redis client:
        • $redis-127.0.  0.1:6379>127.0.  0.1:6379> pingpong           

In the above example we connect to the local Redis service and perform a PING command that detects whether the Redis service is started.
    • Execute command on remote service
      • syntax:
        $ redis -cli -h host -p Port Span class= "pun" >-a password          
      •  example:  
 $redis -cli -h 127.0. 0.1 -p 6379-a  "mypass"  Redis 127.0 0.1:6379> Redis Span class= "lit" >127.0. 0.1:6379> PING PONG    
============

View all Keys

127.0.0.1:6379> Keys ' * * '

(empty list or set)

Assigns a value to a string named key in the database

127.0.0.1:6379> Set name Yihua

Ok

Returns the value of a string named key in the database

127.0.0.1:6379> Get Name

"Yihua"

127.0.0.1:6379>

============

    • Stop the Redis server from booting

$ launchctl Unload ~/library/launchagents/homebrew.mxcl.redis.plist

    • Location of Redis configuration files

/usr/local/etc/redis.conf

    • Turn off Redis

REDIS-CLI shutdown

    • Uninstalling Redis and its files

$ brew Uninstall Redis

$ RM ~/library/launchagents/homebrew.mxcl.redis.plist

    • Test if Redis server is started

$ redis-cli Ping

Installing and configuring Redis under Mac

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.