4

I am using the osx and trying to install redis through brew

brew install redis
==> Downloading http://download.redis.io/releases/redis-2.8.17.tar.gz
Already downloaded: /Library/Caches/Homebrew/redis-2.8.17.tar.gz
==> make -C /private/tmp/redis-WEL8AT/redis-2.8.17/src CC=clang
==> Caveats
To have 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
==> Summary

At last I have installed redis, but when I run it in the way of

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

there is error message,

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 54
>>> 'tcp-backlog 511'
Bad directive or wrong number of arguments

I learned from Redis tcp-backlog to uncomment the redis.conf in that line. but still more errors on other lines come again. How do I solve it ?

Community
  • 1
  • 1
user824624
  • 7,077
  • 27
  • 106
  • 183
  • 1
    Just use a configuration file which corresponds to the actual redis version. Check the redis-server you launch does correspond to the version you think you have installed. – Didier Spezia Feb 09 '15 at 17:37
  • the current redis config is automatically generated after the installation of redis from brew. so normally it should correspond to the right version of redis, isn't it – user824624 Feb 09 '15 at 23:35

2 Answers2

15

Check if you have installed redis twice. I my case I had another redis installation from anaconda with version 2.6.9:

$ which redis-server
/Users/<username>/anaconda/bin/redis-server
$ redis-server -v
Redis server v=2.6.9 sha=00000000:0 malloc=libc bits=64

Homebrew instead will install the redis-server to a different place:

$ /usr/local/bin/redis-server -v
Redis server v=3.0.1 sha=00000000:0 malloc=libc bits=64 build=bf58331b4c8133f5

So to start the homebrew version with the homebrew config file do

$ /usr/local/bin/redis-server /usr/local/etc/redis.conf
asmaier
  • 11,132
  • 11
  • 76
  • 103
0

I had similar problem due to a config file left over from previous redis versions. Uninstalling all redis versions and reinstalling the latest worked (also, don't forget to update brew before installing redis):

brew uninstall redis --force
brew update
brew install redis

You should now be able to start it.

Sbbs
  • 1,610
  • 3
  • 22
  • 34
  • Thanks,SBBS. I still got the issue saying: *** FATAL CONFIG FILE ERROR *** Reading the configuration file, at line 90 >>> 'tcp-keepalive 0' Bad directive or wrong number of arguments – user824624 Apr 27 '15 at 08:55
  • @user824624, uninstalling redis using `brew uninstall redis --force` should remove the config file. If it doesn't, them remove it manually after uninstalling by running `$ rm /usr/local/etc/redis.conf`. Then install redis and it should work. And don't forget to update brew prior installing redis. – Sbbs May 03 '15 at 23:13