अद्यतन 9 वीं जून 2012: https://gist.github.com/2900804Heroku mongohq और mongoid मोंगो :: ConnectionFailure
अद्यतन 22 वें जनवरी 2011::
उरी
Heroku पर mongoid 3.0.0.rc के साथ सेटअप, इस सार को देखने के अब mongoid.yml में पूर्वता लेता है
https://github.com/mongoid/mongoid/issues/issue/266
अद्यतन 12 वीं Aug 2010: हालांकि मैं एक स्वीकृत जवाब 6 मिल गया हो सकता है जैकस क्रॉकर से, इस मुद्दे के पहलू हैं जो गड़बड़ करना आसान बनाता है! यह मेरे साथ फिर से हुआ और मैंने मोंगोइड स्रोत कोड का शोध करने का फैसला किया। तो, यहाँ यह जाता है:
वर्तमान में, मेजबान: पोर्ट: नाम/डेटाबेस: सेटिंग्स प्राथमिकता दी जाती है uri से अधिक: सेटिंग। flame.local.mongohq.com:xxxx
यह टूट जाएगा करने के लिए xxxx और नहीं: इसलिए, बहुत uninformative त्रुटि संदेश के कारण एक अनुरोध के स्थानीय होस्ट करने के लिए हो रहा है! चूक में, और/या हटाने के < <:
defaults: &defaults
host: localhost <- THIS 'OVERWRITES' host in the uri!
production:
<<: *defaults <- BE CAREFUL WITH WHAT YOU BRING IN. THE host: FROM DEFAULTS WILL BE THE ONE APPLIED, not your uri host.
uri: <%= ENV['MONGOHQ_URL'] %>
या तो हटाने के मेजबान के साथ यह ठीक * चूक
मूल प्रश्न:
मैं जोड़ लिया है mongoHQ 0/के लिए उसकेोकू में एडन।
connect_to_master': failed to connect to any given host:port (Mongo::ConnectionFailure)
विवरण ऑनलाइन (heroku mongohq) अधिक mongomapper की ओर निर्देशित कर रहे हैं, के रूप में मैं इसे देखना: यह साथ दुर्घटनाओं। मैं रूबी 1.9.1 चला रहा हूं और mongoid के साथ रेल 3-बीटा चला रहा हूं।
मेरी भावना कहती है कि ENV['MONGOHQ_URL']
के साथ कुछ है, जो यह कहता है कि मोंगोएचक्यू एडन सेट है, लेकिन मैंने अपने ऐप में कहीं भी MONGOHQ_URL
सेट नहीं किया है। मुझे लगता है कि समस्या मेरे mongoid.yml में है?
defaults: &defaults
host: localhost
development:
<<: *defaults
database: aliado_development
test:
<<: *defaults
database: aliado_test
# set these environment variables on your prod server
production:
<<: *defaults
host: <%= ENV['MONGOID_HOST'] %>
port: <%= ENV['MONGOID_PORT'] %>
username: <%= ENV['MONGOID_USERNAME'] %>
password: <%= ENV['MONGOID_PASSWORD'] %>
database: <%= ENV['MONGOID_DATABASE'] %>
यह स्थानीय स्तर पर ठीक काम करता है, लेकिन Heroku में विफल रहता है, अधिक स्टैक ट्रेस:
==> crashlog.log <==
Cannot write to outdated .bundle/environment.rb to update it
/disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/rack-1.1.0/lib/rack.rb:14: warning: already initialized constant VERSION
/disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongo-0.20.1/lib/mongo/connection.rb:435:in `connect_to_master': failed to connect to any given host:port (Mongo::ConnectionFailure)
from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongo-0.20.1/lib/mongo/connection.rb:112:in `initialize'
from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongoid-2.0.0.beta4
/lib/mongoid/railtie.rb:32:in `new'
from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongoid-2.0.0.beta4/lib/mongoid/railtie.rb:32:in `block (2 levels) in <class:Railtie>'
from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongoid-2.0.0.beta4/lib/mongoid.rb:110:in `configure'
from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongoid-2.0.0.beta4/lib/mongoid/railtie.rb:21:in `block in <class:Railtie>'
from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/railties-3.0.0.beta3/lib/rails/initializable.rb:25:in `instance_exec'
.....
यह सब स्थानीय स्तर पर काम करता है, दोनों परीक्षण और अनुप्रयोग। मैं विचारों से बाहर हूं ... कोई सुझाव?
पीएस: उच्च repu दिमाग वाला कोई व्यक्ति टैग 'mongohq' बनाते हैं?
uri का समाधान नहीं होता:
यहाँ mongoid के config.rb से स्निपेट है अभी तक काम करने लगते हैं। मुझे github.com/durran/mongoid पर टिकट/अंक मिला और इसका स्रोत http://ragingonrails.com/post/566548996/using-mongoid-on-heroku-with-mongohq मिला। मैंने यह वही किया, बंदरगाह, मेजबान और इतने पर एनएनवी में हेरफेर करना। वह काम किया! – oma
यह उत्तर एक सही चिह्नित किया गया है। दूसरों के अनुभव के लिए, ध्यान दें कि मुझे कुछ खुद को ट्विक करना था। यह भी होना चाहिए: git => git: // github.com/durran/mongoid.git' – oma
अब 'उत्पादन> सत्र> डिफ़ॉल्ट> uri' का उपयोग करने की आवश्यकता है - मिलान के उत्तर को अपडेट किया गया है। – chrismdp