为什么systemctl不在CentOS 7上启动redis-server?

前端之家收集整理的这篇文章主要介绍了为什么systemctl不在CentOS 7上启动redis-server?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在新的CentOS 7机器上安装了redis,但无法使用systemctl启动它.

它是这样安装的:

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

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

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

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

  1. redis-cli
  2. Could not connect to Redis at 127.0.0.1:6379: Connection refused
  3. not connected>

但手动启动它:

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

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

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

  1. [1972] 29 Jul 18:52:16.258 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
  2. [1972] 29 Jul 18:52:16.258 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
  3. [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'.
  4. _._
  5. _.-``__ ''-._
  6. _.-`` `. `_. ''-._ Redis 2.8.13 (00000000/0) 64 bit
  7. .-`` .-```. ```\/ _.,_ ''-._
  8. ( ',.-` | `,) Running in stand alone mode
  9. |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
  10. | `-._ `._ / _.-' | PID: 1972
  11. `-._ `-._ `-./ _.-' _.-'
  12. |`-._`-._ `-.__.-' _.-'_.-'|
  13. | `-._`-._ _.-'_.-' | http://redis.io
  14. `-._ `-._`-.__.-'_.-' _.-'
  15. |`-._`-._ `-.__.-' _.-'_.-'|
  16. | `-._`-._ _.-'_.-' |
  17. `-._ `-._`-.__.-'_.-' _.-'
  18. `-._ `-.__.-' _.-'
  19. `-._ _.-'
  20. `-.__.-'
  21.  
  22. [1972] 29 Jul 18:52:16.259 # Server started,Redis version 2.8.13
  23. [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.
  24. [1972] 29 Jul 18:52:16.260 * DB loaded from disk: 0.001 seconds
  25. [1972] 29 Jul 18:52:16.260 * The server is now ready to accept connections on port 6379
  26. [1972] 29 Jul 18:52:16.265 # User requested shutdown...
  27. [1972] 29 Jul 18:52:16.265 * Saving the final RDB snapshot before exiting.
  28. [1972] 29 Jul 18:52:16.267 * DB saved on disk
  29. [1972] 29 Jul 18:52:16.267 * Removing the pid file.
  30. [1972] 29 Jul 18:52:16.267 # Redis is now ready to exit,bye bye...

和状态:

  1. [root@redis ~]# systemctl status redis-server
  2. redis-server.service - Redis persistent key-value database
  3. Loaded: loaded (/usr/lib/systemd/system/redis-server.service; disabled)
  4. Active: inactive (dead)
  5.  
  6. Jul 29 18:52:16 redis systemd[1]: Starting Redis persistent key-value database...
  7. Jul 29 18:52:16 redis systemd[1]: Started Redis persistent key-value database.
最后,修好了. Systemd要求redis运行非daemonised,因此需要更改配置:
  1. # /etc/redis.conf
  2. daemonize yes # << comment this out

猜你在找的CentOS相关文章