redis不会启动:无法创建服务器tcp侦听套接字127.0.0.1:6379:绑定:地址已在使用中

am46iovg  于 2021-06-08  发布在  Redis
关注(0)|答案(0)|浏览(811)

我已安装 redis 在我的aws服务器上。我遵循这一点:https://www.digitalocean.com/community/tutorials/how-to-install-secure-redis-centos-7

$ systemctl start redis.service
$ systemctl enable redis
  -> Created symlink /etc/systemd/system/multi-user.target.wants/redis.service → /usr/lib/systemd/system/redis.service.
$ systemctl status redis.service
● redis.service - Redis persistent key-value database
   Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/redis.service.d
           └─limit.conf
   Active: failed (Result: exit-code) since Wed 2020-08-26 02:28:25 UTC; 10s ago
 Main PID: 5012 (code=exited, status=1/FAILURE)

Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: Starting Redis persistent key-value database...
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: Started Redis persistent key-value database.
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: redis.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: redis.service: Failed with result 'exit-code'.

当我检查 /var/log/redis/redis.log 我看到的是:

5012:C 26 Aug 2020 02:28:25.574 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5012:C 26 Aug 2020 02:28:25.574 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=5012, just started
5012:C 26 Aug 2020 02:28:25.574 # Configuration loaded
5012:C 26 Aug 2020 02:28:25.574 * supervised by systemd, will signal readiness
5012:M 26 Aug 2020 02:28:25.575 # Could not create server TCP listening socket 127.0.0.1:6379: bind: Address already in use

检查端口后:

$ netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      2812/redis-server *
tcp6       0      0 :::6379                 :::*                    LISTEN      2812/redis-server *

这是港口 6379 实际上是被 redis-server .
那为什么不能从那时开始呢?
我需要在aws中添加任何入站/出站规则吗?请帮忙。
更新 ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd 终端返回命令 bash: /etc/redis.conf: Permission denied . 看来我们需要给予适当的许可 /etc/redis.conf 文件。

$ ls -l /etc/redis.conf
-rw-r-----. 1 redis redis 62189 Aug 26 03:04 /etc/redis.conf

那我需要给你什么许可?谁应该拥有这个文件?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题