CentOS   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了为什么systemctl不在CentOS 7上启动redis-server?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我在新的CentOS 7机器上安装了redis,但无法使用systemctl启动它. 它是这样安装的: rpm -i http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm yum install redis 试图像这样启动它似乎默默地失败(没有输出): systemctl start red
@H_@R_675_11287@_7@
@H_772_14@ 我在新的CentOS 7机器上安装了redis,但无法使用systemctl启动它.

它是这样安装的:

rpm -i http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
yum install redis

试图像这样启动它似乎地失败(没有输出):

systemctl start redis-server # also tried redis-server.service

以下是尝试连接时发生的情况:

redis-cli
Could not connect to redis at 127.0.0.1:6379: Connection refused
not connected>

但手动启动它:

[root@redis ~]# redis-server /etc/redis.conf
[root@redis ~]# redis-cli
127.0.0.1:6379>

任何人都知道出了什么问题,或者如何调试这个?

更新:/var/log/redis/redis.log的输出如下.顺便说一下,这是一个512mb RAM VPs.

[1972] 29 Jul 18:52:16.258 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
[1972] 29 Jul 18:52:16.258 # redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
[1972] 29 Jul 18:52:16.258 # Current maximum open files is 1024. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           redis 2.8.13 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    ',.-`  | `,)     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1972
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[1972] 29 Jul 18:52:16.259 # Server started,redis version 2.8.13
[1972] 29 Jul 18:52:16.259 # WARNING overcommit_memory is set to 0! BACkground save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
[1972] 29 Jul 18:52:16.260 * DB loaded from disk: 0.001 seconds
[1972] 29 Jul 18:52:16.260 * The server is Now ready to accept connections on port 6379
[1972] 29 Jul 18:52:16.265 # User requested shutdown...
[1972] 29 Jul 18:52:16.265 * Saving the final RDB snapshot before exiTing.
[1972] 29 Jul 18:52:16.267 * DB saved on disk
[1972] 29 Jul 18:52:16.267 * Removing the pid file.
[1972] 29 Jul 18:52:16.267 # redis is Now ready to exit,bye bye...

和状态:

[root@redis ~]# systemctl status redis-server
redis-server.service - redis persistent key-value database
   Loaded: loaded (/usr/lib/systemd/system/redis-server.service; disabled)
   Active: inactive (dead)

Jul 29 18:52:16 redis systemd[1]: StarTing redis persistent key-value database...
Jul 29 18:52:16 redis systemd[1]: Started redis persistent key-value database.
@H_301_30@ 最后,修好了. Systemd要求redis运行非daemonised,因此需要更改配置:
# /etc/redis.conf
daemonize yes # << comment this out

大佬总结

以上是大佬教程为你收集整理的为什么systemctl不在CentOS 7上启动redis-server?全部内容,希望文章能够帮你解决为什么systemctl不在CentOS 7上启动redis-server?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。