Redis服务器端口已在使用中

Jac*_*ack 35 redis

我正在使用Redis 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
Run Code Online (Sandbox Code Playgroud)

所以我按照上面的说明试试

redis-server $HOME/redis/redis.conf
Run Code Online (Sandbox Code Playgroud)

这给了我以下错误:

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

该文件有以下注释:

# 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.
Run Code Online (Sandbox Code Playgroud)

解决了

Ant*_*rts 95

我有同样的问题,但我忘记了redis仍然存在.如果出现此错误,请尝试以下命令:

redis-cli ping
Run Code Online (Sandbox Code Playgroud)

如果您将PONG作为响应,那么Redis正在运行,并且正在使用该端口.


dtt*_*101 56

在运行redis-cli ping并获得积极响应后,只需运行即可redis-cli shutdown


Jac*_*ack 10

我的机器上必须安装另一个版本的redis服务器,我使用以下命令运行它:

$HOME/redis/src/redis-server $HOME/redis/redis.conf
Run Code Online (Sandbox Code Playgroud)

一切似乎都在起作用.


小智 8

尝试在您的机器上搜索 redis 文件夹,就我而言,我在另一个应用程序中运行了 redis-server。切换到该目录并运行:

redis-cli ping
Run Code Online (Sandbox Code Playgroud)

如果它返回 PONG,请运行:

redis-cli shutdown
Run Code Online (Sandbox Code Playgroud)

这应该关闭 redis,现在转到您的项目并尝试运行:

redis-server
Run Code Online (Sandbox Code Playgroud)