Yosemite上的多个Redis实例

时间:2015-03-08 19:04:43

标签: macos redis osx-yosemite

我正在尝试在osx 10.10.2 Yosemite中安装多个Redis服务。我试图手动避免酿造

首先我安装了redis

$ cd ~
$ wget http://redis.googlecode.com/files/redis-2.4.19.tar.gz
$ tar xzf redis-2.4.17.tar.gz
$ cd redis-2.4.17
$ make
$ sudo make install

然后我复制了两个配置文件

$ cat redis.conf > /usr/local/etc/redis-6379.conf
$ cat redis.conf > /usr/local/etc/redis-6380.conf

我编辑了这些文件,使用对应编号

更改以下行

for redis-6379.conf

daemonize yes
pidfile /usr/local/var/run/redis-6379.pid
port 6379
logfile "/usr/local/var/log/redis-6379.log"
dbfilename dump-6379.rdb

for redis-6380.conf

daemonize yes
pidfile /usr/local/var/run/redis-6380.pid
port 6380
logfile "/usr/local/var/log/redis-6380.log"
dbfilename dump-6380.rdb

然后我编辑了两个实例的服务

$ sudo vi /Library/LaunchDaemons/io.redis.redis-server-6379.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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-6379</string>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/bin/redis-server</string>
      <string>/usr/local/etc/redis-6379.conf</string>
    </array>
  </dict>
</plist>

$ sudo vi /Library/LaunchDaemons/io.redis.redis-server-6380.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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-6380</string>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/bin/redis-server</string>
      <string>/usr/local/etc/redis-6380.conf</string>
    </array>
  </dict>
</plist>

然后我注册了两项服务

$ sudo launchctl load /Library/LaunchDaemons/io.redis.redis-server-6379.plist
$ sudo launchctl load /Library/LaunchDaemons/io.redis.redis-server-6380.plist

最后我尝试重新启动它们

$ sudo launchctl start io.redis.redis-server-6379
$ sudo launchctl start io.redis.redis-server-6380

但两者都没有奏效。我想也许我必须手动创建一些文件和文件夹才能使其工作。但是我应该授予这些文件和文件夹哪些权限?

或许是另一个错误

谢谢

0 个答案:

没有答案