Exception connecting to Redis

Edit on GitHub


You can get the following exception from Redis:

Exception: stream_socket_client(): unable to connect to tcp://......:10009 (Connection refused)


This exception means that Redis encountered a corrupted AOF file. The following error will also be logged in Redis logs located in the following folder: /data/logs/development/redis:

Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix [filename];


To fix the exception:

  1. Run

    sudo redis-check-aof --fix /data/shop/development/shared/redis/appendonly.aof

    You should get:

    Successfully truncated AOF
  2. Start Redis server

    sudo service redis-server-development start
  3. Make sure Redis can write log files under: /data/logs/development/redis/

    sudo chown redis:redis /data/logs/development/redis/ -R