开发者

Redis server port already in use

开发者 https://www.devze.com 2023-04-04 15:52 出处:网络
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 \'red

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 ma开发者_高级运维ster in progress" to all the kind of commands
#    but to INFO and SLAVEOF.

How can I resolve this issue?


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.


And after running redis-cli ping and getting a positive response, simply run redis-cli shutdown


Try searching for redis folder on your machine, in my case, I had redis-server running in another application. Switch to that directory and run:

redis-cli ping

If it returns PONG, run:

redis-cli shutdown

This should shut down the redis, and now go to your project and try running:

redis-server


There must be another version of redis server installed on my machine, I ran it using the following command:

$HOME/redis/src/redis-server $HOME/redis/redis.conf

Everything seems to be working.


try use another port and set it daemonize ./redis-server --port 6379 --daemonize yes

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号