Could not connect to Redis at 127.0.0.1:6379: Connection refused with homebrew

前端 未结 12 1555
灰色年华
灰色年华 2020-12-22 22:10

Using homebrew to install Redis but when I try to ping Redis it shows this error:

Could not connect to Redis at 127.0.0.1:6379: Connection refused

12条回答
  •  时光取名叫无心
    2020-12-22 23:01

    Just like Aaron, in my case brew services list claimed redis was running, but it wasn't. I found the following information in my log file at /usr/local/var/log/redis.log:

    4469:C 28 Feb 09:03:56.197 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    4469:C 28 Feb 09:03:56.197 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=4469, just started
    4469:C 28 Feb 09:03:56.197 # Configuration loaded
    4469:M 28 Feb 09:03:56.198 * Increased maximum number of open files to 10032 (it was originally set to 256).
    4469:M 28 Feb 09:03:56.199 # Creating Server TCP listening socket 192.168.161.1:6379: bind: Can't assign requested address
    

    That turns out to be caused by the following configuration:

    bind 127.0.0.1 ::1 192.168.161.1
    

    which was necessary to give my VMWare Fusion virtual machine access to the redis server on macOS, the host. However, if the virtual machine wasn't started, this binding failure caused redis not to start up at all. So starting the virtual machine solved the problem.

提交回复
热议问题