在运行redis服务器时,它会显示已经在使用的地址--这是堆栈跟踪:
45546:C 12 Jul 2019 10:04:41.888 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
45546:C 12 Jul 2019 10:04:41.888 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=45546, just started
45546:C 12 Jul 2019 10:04:41.888 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
45546:M 12 Jul 2019 10:04:41.889 * Increased maximum number of open files to 10032 (it was originally set to 256).
45546:M 12 Jul 2019 10:04:41.890 # Could not create server TCP listening socket *:6379: bind: Address already in use发布于 2019-07-12 09:21:28
该问题表明,端口已经被另一个进程使用,或者在另一个窗口中打开。
更改redis服务器的端口
redis-server --port 6360将启动一个侦听端口6360的Redis服务器。
redis-cli -p 6360 -现在使用这个让你的客户在这个端口监听。
希望这能帮你解决问题
发布于 2022-08-02 19:55:17
Rajan Sharma的回答很棒,而且效果很好,但是如果您想知道如何与进行合作,请在这里检查:redis-server-ubuntu。
您可以使用Rajan的答案,但是最好更改redis配置文件中的端口: /etc/redis/redis.conf,例如使用nano编辑器:
sudo nano /etc/redis/redis.conf找到这条线:
# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379并将端口号更改为您想要的,如上面的示例6360,并保存ti。然后重新启动redis服务:
sudo systemctl restart redis.service最后,检查redis服务是否活动:
sudo systemctl status redis发布于 2019-07-12 15:59:53
@Ranjan的解决方案会奏效,
如果您想进一步调试并查看哪个进程正在使用该端口,可以在下面完成
netstat -antp | grep 6379https://stackoverflow.com/questions/57003900
复制相似问题