我已从17.10升级到ubuntu 18.04。无法完全安装redis-server软件包。我查看了/ var / log / syslog,它说
==> /var/log/syslog <==
Jun 3 13:04:10 qaz-mko systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory
Jun 3 13:05:01 qaz-mko CRON[3429]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Jun 3 13:05:40 qaz-mko systemd[1]: redis-server.service: Start operation timed out. Terminating.
Jun 3 13:05:40 qaz-mko systemd[1]: redis-server.service: Failed with result 'timeout'.
Jun 3 13:05:40 qaz-mko systemd[1]: Failed to start Advanced key-value store.
Jun 3 13:05:40 qaz-mko systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
Jun 3 13:05:40 qaz-mko systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 13.
Jun 3 13:05:40 qaz-mko systemd[1]: Stopped Advanced key-value store.
Jun 3 13:05:40 qaz-mko systemd[1]: Starting Advanced key-value store...
Jun 3 13:05:40 qaz-mko systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory
==> /var/log/redis/redis-server.log <==
3416:C 03 Jun 13:02:39.637 # Configuration loaded
3417:M 03 Jun 13:02:39.639 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
3423:C 03 Jun 13:04:10.121 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3423:C 03 Jun 13:04:10.121 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=3423, just started
3423:C 03 Jun 13:04:10.122 # Configuration loaded
3424:M 03 Jun 13:04:10.124 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
3435:C 03 Jun 13:05:40.602 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3435:C 03 Jun 13:05:40.602 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=3435, just started
3435:C 03 Jun 13:05:40.602 # Configuration loaded
3436:M 03 Jun 13:05:40.604 # Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
然而它超时并没有启动redis deamon。配置文件是包附带的配置文件。
Do you want to continue? [Y/n] Y
Setting up redis-server (5:4.0.9-1) ...
Job for redis-server.service failed because a timeout was exceeded.
See "systemctl status redis-server.service" and "journalctl -xe" for details.
invoke-rc.d: initscript redis-server, action "start" failed.
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: timeout) since Sun 2018-06-03 12:47:34 EDT; 14ms ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Process: 2156 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
dpkg: error processing package redis-server (--configure):
installed redis-server package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of redis:
redis depends on redis-server (<< 5:4.0.9-1.1~); however:
Package redis-server is not configured yet.
redis depends on redis-server (>= 5:4.0.9-1); however:
Package redis-server is not configured yet.
dpkg: error processing package redis (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
redis-server
redis
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试手动创建pid文件并赋予它很多权限。但这似乎不起作用。
sudo touch /var/run/redis/redis-server.pid
# sudo chown redis:redis /var/run/redis/redis-server.pid
# sudo chmod 777 /var/run/redis/redis-server.pid
# sudo ls -alh /var/run/redis/
total 0
drwxr-sr-x 2 redis redis 60 Jun 3 12:54 .
drwxr-xr-x 33 root root 940 Jun 3 12:53 ..
-rwxrwxrwx 1 redis redis 0 Jun 3 12:54 redis-server.pid
答案 0 :(得分:15)
我找到了罪魁祸首。我暂时禁用了ipv6。我把它重新打开并且安装得很好并且启动正常。您可以更改redis.conf文件以强制它使用IPv4,如果它仅支持该模式,那么也许您可以在没有IPv6的情况下运行它。
答案 1 :(得分:8)
即使禁用了IPv6,也可以使redis服务器运行。
只需从::1
配置选项中删除bind
IPv6回送地址:
- bind 127.0.0.1 ::1
+ bind 127.0.0.1
现在redis将不再尝试使用IPv6网络。
答案 2 :(得分:0)
嗯,从Ubuntu 16.04升级到18.04只是一个类似的问题。上面的解决方案(禁用ipv6)在这里没有帮助。可能是我,但是我也不明白为什么这样做会有所帮助,因为错误的重要部分似乎是
# First we create an empty Byte-Pair Encoding model (i.e. not trained model)
tokenizer = Tokenizer(BPE())
tokenizer.normalizer = Sequence([
NFKC(),
Lowercase()
])
显然,创建文件本身并不一定能解决该问题。但是,有帮助的是创建目录并授予其必要的权限:
Jun 3 13:05:40 qaz-mko systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory
它不会在重启后持续存在。尽管我仍在努力寻找解决方案,但快速而肮脏的解决方法是将上述代码行放入rc.local