Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis server port already in use

Tags:

redis

I'm using Redis version 2.2.13

jack@ubuntu:~/redis$ src/redis-server [23900] 14 Sep 14:28:52 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf' [23900] 14 Sep 14:28:52 # Opening port: bind: Address already in use 

So I follow the above instructions and try

redis-server $HOME/redis/redis.conf 

Which gives me the following error:

*** FATAL CONFIG FILE ERROR *** Reading the configuration file, at line 135 >>> 'slave-serve-stale-data yes' Bad directive or wrong number of arguments 

The file has the following comments:

# When a slave lost the connection with the master, or when the replication # is still in progress, the slave can act in two different ways: # # 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will #    still reply to client requests, possibly with out of data data, or the #    data set may just be empty if this is the first synchronization. # # 2) if slave-serve-stale data is set to 'no' the slave will reply with #    an error "SYNC with master in progress" to all the kind of commands #    but to INFO and SLAVEOF. 

How can I resolve this issue?

like image 540
Jack Avatar asked Sep 14 '11 13:09

Jack


People also ask

What port does Redis use?

Configure Server and Ports By default, the Redis server runs on TCP Port 6379.

How do I start Redis on a different port?

You can edit the Redis server configuration file and specify the startup port to make the changes permanent. Locate the entry as shown below and change the value to your desired port. Once you set your desired port, save and close the file. Next, restart the Redis service to apply the changes.


1 Answers

I had this same problem, but I forgot that redis persists. If you get this error, try this command:

redis-cli ping 

if you get PONG as a response, then Redis is running, and the port is in use, by Redis.

like image 113
Anthony Roberts Avatar answered Oct 16 '22 17:10

Anthony Roberts