Created
June 19, 2018 17:58
-
-
Save hoitomt/b865d3048c3b020183e695c85b9f6fc1 to your computer and use it in GitHub Desktop.
Revisions
-
hoitomt created this gist
Jun 19, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ # OSX: Run two instances of Redis ## Copy and update redis.conf The redis configuration file is likely located at /usr/local/etc/redis.conf cp /usr/local/etc/redis.conf /usr/local/etc/redis2.conf Change the port number from 6379 to something else. I used 6380 # Accept connections on the specified port, default is 6379. # If port 0 is specified Redis will not listen on a TCP socket. port 6380 ## Create a Launch Agent The LaunchAgent makes it easy to start the second redis instance cp ~/Library/LaunchAgents/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/homebrew.mxcl.redis2.plist Edit the LaunchAgent and change the following: From: <string>homebrew.mxcl.redis</string> To: <string>homebrew.mxcl.redis2</string> From: <string>/usr/local/etc/redis.conf</string> To: <string>/usr/local/etc/redis2.conf</string> From: <string>/usr/local/var/log/redis.log</string> To: <string>/usr/local/var/log/redis2.log</string> From: <string>/usr/local/var/log/redis.log</string> To: <string>/usr/local/var/log/redis2.log</string> ## Load the service launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis2.plist ## Start the service launchctl start -w ~/Library/LaunchAgents/homebrew.mxcl.redis2.plist ## Verify Verify that the service is running (Note the port number) [2.2.10] (develop) cip-private-feeds $ ps aux | grep redis mhoitomt 1032 0.0 0.0 4346164 1064 ?? S 4Jun18 6:33.68 /usr/local/opt/redis/bin/redis-server 127.0.0.1:6379 mhoitomt 25137 0.0 0.0 4267768 900 s000 S+ 12:57PM 0:00.00 grep redis mhoitomt 21990 0.0 0.0 4313396 2356 ?? S 12:45PM 0:00.29 /usr/local/opt/redis/bin/redis-server 127.0.0.1:6380 ## Helpful Hints 1. redis-cli will default to port 6379. Add the port parameter to use redis-cli with the new database `redis-cli -p 6380`