ruby on rails - Faraday::ConnectionFailed: connection refused while saving to mongo database -


hello ror + mongo(mongoid) application here

what immediate error msg?

faraday::connectionfailed: connection refused: localhost:9200 

when happen? when try save user instance in console

user.create!(email:"kevin@gmail.com",password:"helloworld123",password_confirmation:"helloworld123") 

i appreciate or input. have great day & reading. below details of related code

1) gemfile

source 'https://rubygems.org'  group :development, :test   gem 'rspec-rails', '~> 3.1.0'   gem 'factory_girl_rails', '~> 4.4.1'   gem 'spring', '~> 1.2.0' end  group :test   gem 'faker', '~> 1.4.3'   gem 'capybara', '~> 2.4.3'   gem 'database_cleaner', '~> 1.3.0'   gem 'launchy', '~> 2.4.2'   gem 'selenium-webdriver', '~> 2.43.0' end  gem 'geocoder', '~> 1.2.7' gem 'figaro', '1.0'  #for cloud uploads (amazon) gem 'fog', '~> 1.27.0' #gem 'will_paginate', '~> 3.0.6' gem "will_paginate_mongoid", '~> 2.0.1'  #for search gem 'searchkick', '~> 0.8.5'  # managing events gem 'sidekiq', '3.3.0' gem 'sinatra', '~> 1.4.5', require: false gem 'slim', '~> 3.0.1'  # frontend package management #source 'https://rails-assets.org' #  gem 'rails-assets-bs-typeahead' #end gem 'mechanize', '~> 2.7.3'  # user/privelege stuff gem 'devise', '~> 3.4.1' #gem 'therubyracer' v8 javascript interpreter gem 'omniauth', '~> 1.2.2' gem 'omniauth-facebook', '~> 2.0.0' gem 'omniauth-linkedin', '~> 0.2.0' gem 'pundit', '~> 0.3.0'  # db options gem "redis", "~> 3.0.1" gem 'mongoid', '~> 4', github: 'mongoid/mongoid' gem 'mongoid_userstamp', '~> 0.4.0' gem 'bson_ext', '~> 1.5.1' gem 'moped', '~> 2.0.3'  # display stuff gem 'haml', '~> 4.0.5' gem 'rename', '~> 1.0.2' gem 'bootstrap-sass' gem 'twitter-bootstrap-rails'  gem 'react-rails', '~> 1.0.0.pre', github: 'reactjs/react-rails' gem 'magnific-popup-rails', '~> 0.9.9.1'  # bundle edge rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.1.7' # use scss stylesheets gem 'sass-rails', '~> 4.0.3' # use uglifier compressor javascript assets gem 'uglifier', '>= 1.3.0' # use coffeescript .js.coffee assets , views gem 'coffee-rails', '~> 4.0.0' # see https://github.com/sstephenson/execjs#readme more supported runtimes # gem 'therubyracer',  platforms: :ruby  # use jquery javascript library gem 'jquery-rails', '~> 3.1.2' gem 'jquery-ui-rails', '~> 5.0.3' # turbolinks makes following links in web application faster. read more: https://github.com/rails/turbolinks #gem 'turbolinks' # build json apis ease. read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates api under doc/api. gem 'sdoc', '~> 0.4.0',          group: :doc  # use activemodel has_secure_password # gem 'bcrypt', '~> 3.1.7'  # use unicorn app server # gem 'unicorn'  # use capistrano deployment # gem 'capistrano-rails', group: :development  # use debugger gem 'debugger2', :git => "git://github.com/ko1/debugger2.git"  gem 'browserify-rails' 

user model

class user   include mongoid::document   include mongoid::timestamps   include mongoid::userstamp::user   include connectable, searchesascap, searchesbmi    #callbacks   after_create :populate_data   after_create :ensure_profile    #relationships   has_and_belongs_to_many :songs, dependent: :nullify   has_and_belongs_to_many :searches, dependent: :destroy   has_one :profile   has_one :writer    has_many :author_conversations, class_name: 'conversation', inverse_of: :author, dependent: :destroy   has_many :recipient_conversations, class_name: 'conversation', inverse_of: :recipient, dependent: :destroy   has_many :messages, dependent: :destroy    #validations   validates_presence_of :email, :encrypted_password    #search   searchkick word_start: [:firstname, :lastname, :display_name, :role, :genre],              locations: ["location"]    def search_data     attributes.merge(       firstname:          firstname,       lastname:           lastname,       society_id:         society_id,       display_name:       profile.try(:display_name),       role:               profile.try(:role),       city:               profile.try(:city),       state:              profile.try(:state_code),       genre:              profile.try(:genre),       daw:                profile.try(:daw),       location:           profile.try(:coordinates)     )   end    # include default devise modules. others available are:   # :confirmable, :lockable, :timeoutable , :omniauthable   devise :database_authenticatable, :registerable,          :recoverable, :rememberable, :trackable, :validatable,          :omniauthable, :omniauth_providers => [:facebook]    ## database authenticatable   field :firstname,             type: string, default: ""   field :lastname,              type: string, default: ""   field :email,                 type: string, default: ""   field :encrypted_password,    type: string, default: ""    ## recoverable   field :reset_password_token,   type: string   field :reset_password_sent_at, type: time    ## rememberable   field :remember_created_at, type: time    ## trackable   field :sign_in_count,      type: integer, default: 0   field :current_sign_in_at, type: time   field :last_sign_in_at,    type: time   field :current_sign_in_ip, type: string   field :last_sign_in_ip,    type: string   field :signed_up_on,       type: date, default: date.today    # songwriter information   field :society_id,         type: string, default: ""   field :ipi_id,             type: string, default: ""   field :society,            type: string, default: "ascap"    # omniauth   field :provider,           type: string, default: ""   field :uid,                type: string, default: ""   field :timezone,           type: string, default: ""   field :access_token,       type: string, default: ""   field :expires_at,         type: string, default: ""    ## confirmable   # field :confirmation_token,   type: string   # field :confirmed_at,         type: time   # field :confirmation_sent_at, type: time   # field :unconfirmed_email,    type: string # if using reconfirmable    ## lockable   # field :failed_attempts, type: integer, default: 0 # if lock strategy :failed_attempts   # field :unlock_token,    type: string # if unlock strategy :email or :both   # field :locked_at,       type: time    default_scope -> {order_by(:firstname.asc, :lastname.asc)}    # omniauth   def self.new_with_session(params, session)     super.tap |user|       if data = session["devise.facebook_data"] && session["devise.facebook_data"]["extra"]["raw_info"]         user.email = data["email"] if user.email.blank?         user.firstname = data["firstname"] if user.firstname.blank?         user.lastname = data["lastname"] if user.lastname.blank?      end     end   end    def self.from_omniauth(auth)      where(provider: auth.provider, uid: auth.uid).first_or_create |user|        user.password = devise.friendly_token[0,20]        user.provider = auth.provider        user.uid = auth.uid        user.email = auth.info.email        user.firstname = auth.info.first_name        user.lastname = auth.info.last_name        user.timezone = auth.extra.raw_info.timezone        user.access_token = auth.credentials.access_token        user.expires_at = auth.credentials.expires_at         profile.create(           user: user,           image: auth.info.image,           display_name: user.firstname + " " + user.lastname         )      end   end    def full_name     self.firstname + " " + self.lastname   end    def location     if self.profile.state_code       self.profile.city + ", " + self.profile.state_code     else       self.profile.city     end   end    ## scraping    def populate_data     discographyworker.perform_async(self.id.to_s)   end    def ensure_profile     if self.profile.nil?       self.profile = profile.new     end   end    def scrape_discography     # validate user has entered ascap_id or ipi_id     if self.society == 'ascap'       populate_ascap     elsif self.society == 'bmi'       populate_bmi     end   end end 

full error trace

faraday::connectionfailed: connection refused: localhost:9200     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:641:in `rescue in connection_for'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:589:in `connection_for'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:994:in `request'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/adapter/net_http_persistent.rb:26:in `perform_request'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:40:in `block in call'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/adapter/net_http_persistent.rb:22:in `with_net_http_connection'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:32:in `call'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/elasticsearch-transport-1.0.7/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/elasticsearch-transport-1.0.7/lib/elasticsearch/transport/transport/base.rb:187:in `call'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/elasticsearch-transport-1.0.7/lib/elasticsearch/transport/transport/base.rb:187:in `perform_request'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/elasticsearch-transport-1.0.7/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/elasticsearch-transport-1.0.7/lib/elasticsearch/transport/client.rb:115:in `perform_request'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/elasticsearch-api-1.0.7/lib/elasticsearch/api/actions/index.rb:99:in `index'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/searchkick-0.8.7/lib/searchkick/index.rb:44:in `store' ... 20 levels...     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/railties-4.1.7/lib/rails/commands/console.rb:9:in `start'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:69:in `console'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:40:in `run_command!'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/railties-4.1.7/lib/rails/commands.rb:17:in `<top (required)>'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'     /users/apprentice/documents/work/fourleafapp/bin/rails:8:in `<top (required)>'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `load'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `block in load'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'     /users/apprentice/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:241:in `load'     /users/apprentice/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'     /users/apprentice/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require' 

whenever user created updates indexes in elasticsearch elasticsearch error , not configuring port correctly


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -