Download, unzip, rename, and compile and install Redis
~ wget http://download.redis.io/releases/redis-3.2.9.tar.gz
~ Tar xzf redis-3.2.9.tar.gz
~ MV redis-3.2.9 Redis
~ CD Redis
~ Make
~ Make Test
~ Make Install
Configuration file redis.conf
The Redis unzip directory has a profile redis.conf, edit this configuration file, find dir./this line [247]. Redis writes the In-memory data to a file, and this configuration is the path to the specified data file save.
The directory I specified on this machine:
Dir./
Revision changed to
dir/users/houxiurong/software/redis_data/
After editing, move the configuration file to the/USR/LOCAL/ETC directory
~ sudo mv redis.conf/usr/local/etc/
Start Redis
Terminal input:
~/usr/local/bin/redis-server/usr/local/etc/redis.conf
Service Start Success Screen:
HOUXIURONG-MACBOOK-PRO:SRC houxiurong$/usr/local/bin/redis-server/usr/local/etc/redis.conf
6508:m 18:21:33.662 * Increased maximum number of open files to 10032 (it is originally set to 256).
_._
_.-' __ '-._
_.-`` `. `_. "-._ Redis 3.2.9 (00000000/0)
.-`` .-```. ' \ \ _.,_ '-._
(',.-' | ',) Running in standalone mode
| '-._ '-...-' __...-. '-._| ' ' _.-' | port:6379
| '-._ '. _/_.-' | pid:6508
'-._ '-._ '-./_.-' _.-'
| '-._ '-._ '-.__.-' _.-' _.-' |
| '-._ '-._ _.-' _.-' | Http://redis.io
'-._ '-._ '-.__.-' _.-' _.-'
| '-._ '-._ '-.__.-' _.-' _.-' |
| '-._ '-._ _.-' _.-' |
'-._ '-._ '-.__.-' _.-' _.-'
'-._ '-.__.-' _.-'
'-._ _.-'
'-.__.-'
6508:m Jul 18:21:33.664 # Server started, Redis version 3.2.9
6508:m Jul 18:21:33.664 * DB loaded from disk:0.000 seconds
6508:m 18:21:33.664 * The server is now a ready-to-accept connections on port 6379
Test connectivity
~ Cd/usr/local/bin
~./redis-cli
127.0.0.1:6379> set Me Houxiurong
Ok
127.0.0.1:6379> Get Me
"Houxiurong"
Set boot automatically start Redis server
New Plist file
~ sudo vi/library/launchdaemons/io.redis.redis-server.plist
The file contents are as follows
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE plist Public "-//apple computer//dtd plist 1.0//en" "Http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version= "1.0" >
<dict>
<key>Label</key>
<string>io.redis.redis-server</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/redis-server</string>
<string>/usr/local/etc/redis.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Use Launchctl to set up boot automatically
~ sudo launchctl load/library/launchdaemons/io.redis.redis-server.plist
Starting Redis server with Launchctl
~ sudo launchctl start io.redis.redis-server
Using LAUNCHCTL to stop Redis server
~ Sudo launchctl stop io.redis.redis-server
Mac OS X Install redis-3.2.9