在Vagrant中“找不到RubyGem puppet”(“Could not find RubyGem puppet” in Vagrant)
我可以手动运行
bundle install
并获得恢复正常的东西,但是当我让Puppet提供一个Vagrant框时,这是第二次(第一次我获得成功输出)。[default] Running provisioner: Vagrant::Provisioners::Puppet... [default] Running Puppet with /tmp/vagrant-puppet/manifests/default.pp... stdin: is not a tty /opt/vagrant_ruby/lib/ruby/site_ruby/1.8/rubygems.rb:900:in `report_activate_error': Could not find RubyGem puppet (>= 0) (Gem::LoadError) from /opt/vagrant_ruby/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate' from /opt/vagrant_ruby/lib/ruby/site_ruby/1.8/rubygems.rb:1276:in `gem' from /opt/vagrant_ruby/bin/puppet:18 The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!
我不是在任何地方请求puppet gem,它不在我的Gemfile中,我的清单也不需要它。 为什么要查找puppet gem,我该如何摆脱这个错误?
I can manually run
bundle install
and get something sane back, but when I let Puppet provision a Vagrant box, this happens the second time (the first I get successful output).[default] Running provisioner: Vagrant::Provisioners::Puppet... [default] Running Puppet with /tmp/vagrant-puppet/manifests/default.pp... stdin: is not a tty /opt/vagrant_ruby/lib/ruby/site_ruby/1.8/rubygems.rb:900:in `report_activate_error': Could not find RubyGem puppet (>= 0) (Gem::LoadError) from /opt/vagrant_ruby/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate' from /opt/vagrant_ruby/lib/ruby/site_ruby/1.8/rubygems.rb:1276:in `gem' from /opt/vagrant_ruby/bin/puppet:18 The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!
I am not requesting the puppet gem anywhere, it's not in my Gemfile and my manifest does not require it either. Why is the puppet gem being looked for, and how do I get rid of this error?
原文:https://stackoverflow.com/questions/12052106
最满意答案
任何群集工作者都可以使用mongodb或mongoose轻松访问MongoDB以获取所需数据。 它也可以将数据作为缓存存储在本地。
一旦socket.io客户端连接,它将绑定到一个worker,并且在执行期间不会交换worker。
为了共享会话,您需要为socket.io创建会话中间件,该中间件将从其中一个工作人员请求来自MongoDB的会话详细信息。 查看此答案, 该答案解释了如何从共享会话详细信息访问socket.io中的会话数据。 并且为了使其成为集群,使用connect-mongo而不是MemoryStorage,它允许在mongo中存储会话数据,并且它将使工作人员共享会话详细信息。Any of clustered worker can easily access MongoDB using mongodb or mongoose in order to get required data. As well it can store that data locally as a cache.
Once socket.io client is connected it will be bound to one of workers and will not swap workers during execution.
In order to share sessions you need to create session middleware for socket.io that will ask for session details from MongoDB from one of the workers. Check this answer which explains how to access session data in socket.io from shared session details. And in order to make it clustered, instead of MemoryStorage use connect-mongo that allows to store session data within mongo and it will make session details shared over workers.
相关问答
更多-
将Socket.IO扩展到使用集群的多个Node.js进程(Scaling Socket.IO to multiple Node.js processes using cluster)[2023-06-10]
编辑:在Socket.IO 1.0+中,而不是设置具有多个Redis客户端的存储,现在可以使用更简单的Redis适配器模块。 var io = require('socket.io')(3000); var redis = require('socket.io-redis'); io.adapter(redis({ host: 'localhost', port: 6379 })); 下面显示的例子会更像这样: var cluster = require('cluster'); var os = requ ... -
您不使用io.on()侦听来自服务器上给定连接的消息。 相反,您可以在侦听给定套接字连接的情况下执行此操作,然后将事件处理程序添加到该特定套接字,并且当您要发送回该套接字时,还可以使用该socket对象发送回。 这允许您发送回刚向您发送消息的同一个套接字: io.on('connection', function (socket) { socket.on('log-in', function (data) { User.findOne({'username': data.userna ...
-
也许你最好使用像RabbitMQ这样的消息队列解决方案? 这样,您就可以将消息从一个进程发送到另一个进程,并自动通知它。 我已经使用Node.js,socket.io和RabbitMQ在应用程序中实现了通知(如果它在您感兴趣的区域附近)。 这是一个开源项目,如果你愿意,我会分享它(它在GitHub上,但是还没有合并)。 在任何情况下,在这种情况下,事件总是比轮询更好(如果可能的话)。 Here is what I have accomplished rather than using the setInte ...
-
对于那些可能面临类似问题的人,事实证明我有两次以下的行 var io = require('socket.io')(server); 删除一个,解决了问题。 For those who may face similar issue, it turned out that I have the following line twice var io = require('socket.io')(server); Removing one, solved the issue.
-
似乎问题可能与Socket.IO安装的节点模块有关。 当我安装redis( npm install hiredis redis )并使用redis模块为RedisStore创建客户端时,一切都突然完美。 我已经运行了超过一个小时,有大约500个并发连接,没有看到一个错误,并且正在使用每个节点进程。 hiredis@0.1.14 redis@0.7.2 在端口6379上运行Redis 2.6rc3。 更新:在Node.s 0.8中,看起来集群库应该更加成熟,因此上述代码/问题可能会过时: http : //n ...
-
正如robertklep在评论中指出的那样,使用粘性会话解决了这个问题。 但是,我用于此目的的包是socketio-sticky-session 。 我的最终cluster.js代码如下所示: var sticky = require('socketio-sticky-session') var cluster = require('cluster'); var os = require('os'); var options = { proxy: false, num: require('o ...
-
在您的客户端代码中,您尝试连接到端口8080,这与您的服务器正在侦听的端口不一致。 In your client code you're trying to connect to port 8080, which is inconsistent with the port your server is listening on.
-
Redis商店与Socket.io(Redis Store with Socket.io)[2023-07-09]
我可以使用MongoDB作为Socket.io的内存存储 是的,你可以尝试mong.socket.io 用Redis替换MongoDB作为数据库吗? Redis和MongoDB是不同类型的数据库,而mongodb是面向文档的redis是面向键/值的(我们甚至可以说redis是一个数据结构服务器)。 什么能够更有效地构建实时Web应用程序并提供最大并发连接? Redis肯定会比mongo更快,它支持pub / sub开箱即用(而mong.socket.io使用集合来模拟pub / sub)但你必须知道存储在r ... -
任何群集工作者都可以使用mongodb或mongoose轻松访问MongoDB以获取所需数据。 它也可以将数据作为缓存存储在本地。 一旦socket.io客户端连接,它将绑定到一个worker,并且在执行期间不会交换worker。 为了共享会话,您需要为socket.io创建会话中间件,该中间件将从其中一个工作人员请求来自MongoDB的会话详细信息。 查看此答案, 该答案解释了如何从共享会话详细信息访问socket.io中的会话数据。 并且为了使其成为集群,使用connect-mongo而不是Memory ...
-
首先,请不要将用户置于全局变量中,最好将其放在模块中,并在需要时在其他地方使用它。 你可以这样做: users.js var users = { _list : {} }; users.create = function(data){ this._list[data.id] = data; } users.get = function(user_id){ return this._list[user_id]; }; users.getAll = function(){ re ...