话语服务器无法启动与redis相关的错误

时间:2018-01-17 10:11:12

标签: ruby-on-rails redis ruby-on-rails-5 unicorn discourse

Rails服务器无法在开发或生产中的Discourse项目中启动。以下是尝试以开发模式启动服务器时的日志。该应用程序已安装并一直在运行,它已在生产模式下部署在AWS上,并且重新启动unicorn会加载应用程序一段时间,并且url会停止响应并显示错误消息。

来自$ rails s的开发日志

/var/www/discourse/lib/demon/base.rb:109:in `ensure_running'
            /var/www/discourse/lib/demon/base.rb:34:in `block in ensure_running'
            /var/www/discourse/lib/demon/base.rb:33:in `each'
            /var/www/discourse/lib/demon/base.rb:33:in `ensure_running'
            config/unicorn.conf.rb:145:in `master_sleep'
            /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:284:in `join'
            /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
            /var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:23:in `load'
            /var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:23:in `<main>'
            E, [2018-01-04T08:43:37.949928 #60] ERROR -- : reaped #<Process::Status: pid 5870 exit 1> worker=unknown
            Detected dead worker 5870, restarting...
            Loading Sidekiq in process id 5883
            Failed to report error: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. 4 Redis::CommandError (MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.)
            /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:121:in `call' web-exception

**生产日志**

   47:M 17 Jan 09:38:01.070 # Can't save in background: fork: Cannot allocate memory
   47:M 17 Jan 09:38:07.087 * 10000 changes in 60 seconds. Saving...

Redis记录

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    print("section: \(indexPath.section)")
    print("row: \(indexPath.row)")
}  

1 个答案:

答案 0 :(得分:0)

问题已修复,编辑此文件

/etc/sysctl.conf并在最后添加了该行

   vm.overcommit_memory=1 

重启后的sysctl。

  $ sudo sysctl -p /etc/sysctl.conf

Redis不需要操作系统认为的内存量,状态1意味着总是过度使用,从不检查。 有关详细信息,请参阅Redis Docs