无法连接盆景和弹性搜索和搜索踢上heroku

时间:2016-03-12 04:36:34

标签: ruby-on-rails heroku elasticsearch elasticsearch-plugin bonsai-elasticsearch

尝试使用盆景进行弹性搜索并在heroku上搜索。它说它正在开始,但我不断得到Faraday::ConnectionFailed (Connection refused - connect(2)):

我几乎肯定盆景网址设置正确。

任何想法如何解决?我一直试图深入研究这个但是我被困住了。

user.rb

require 'elasticsearch/model'

    class User < ActiveRecord::Base
      Elasticsearch::Model.client = Elasticsearch::Client.new url: ENV['BONSAI_URL'], log: true

       include Elasticsearch::Model
      include Elasticsearch::Model::Callbacks
          search kick autocomplete: ['name']

宝石文件

 gem 'elasticsearch-model'
        gem 'elasticsearch-rails'
        gem 'searchkick'
 group :production do
          gem 'pg',             '0.17.1'
          gem 'rails_12factor', '0.0.2'
          gem 'puma',           '2.11.1'
          gem 'bonsai-elasticsearch-rails', '~> 0.0.4'
    end

完整日志

 2016-03-12T04:24:03.741737+00:00 heroku[run.2718]: State changed from starting to up
    2016-03-12T04:23:16.495563+00:00 app[web.1]: Starting up a new ElasticSearch client with https://xxxxxxx.us-east-1.bonsai.io
    2016-03-12T04:23:17.157002+00:00 app[web.1]:   [1m[36mUser Load (1.8ms)[0m  [1mSELECT  "users".* FROM "users"  ORDER BY "users"."id" ASC LIMIT 1000[0m
    2016-03-12T04:23:17.246641+00:00 app[web.1]: [3] Use Ctrl-C to stop
    2016-03-12T04:23:17.250874+00:00 app[web.1]: [3] - Worker 0 (pid: 6) booted, phase: 0
    2016-03-12T04:23:17.252056+00:00 app[web.1]: [3] - Worker 1 (pid: 10) booted, phase: 0
    2016-03-12T04:23:17.600616+00:00 heroku[web.1]: State changed from starting to up
    2016-03-12T04:23:56.953781+00:00 heroku[api]: Starting process with command `bash` by testtest@me.com
    2016-03-12T04:24:03.284922+00:00 heroku[run.2718]: Starting process with command `bash`
    2016-03-12T04:24:03.741737+00:00 heroku[run.2718]: State changed from starting to up
    2016-03-12T04:27:46.959226+00:00 heroku[slug-compiler]: Slug compilation started
    2016-03-12T04:23:17.246505+00:00 app[web.1]: [3] * Listening on tcp://0.0.0.0:3243
    2016-03-12T04:23:17.246641+00:00 app[web.1]: [3] Use Ctrl-C to stop
    2016-03-12T04:23:17.250874+00:00 app[web.1]: [3] - Worker 0 (pid: 6) booted, phase: 0
    2016-03-12T04:23:17.600616+00:00 heroku[web.1]: State changed from starting to up
    2016-03-12T04:24:03.264844+00:00 heroku[run.2718]: Awaiting client
    2016-03-12T04:24:03.284922+00:00 heroku[run.2718]: Starting process with command `bash`
    2016-03-12T04:24:03.741737+00:00 heroku[run.2718]: State changed from starting to up
    2016-03-12T04:27:46.959233+00:00 heroku[slug-compiler]: Slug compilation failed: unrecognized error 3e521316-8b6b-44bd-b313-e8b62d9f15b1
    2016-03-12T04:29:39.843924+00:00 heroku[api]: Deploy 5c0b4bd by testtest@me.com
    2016-03-12T04:29:39.843924+00:00 heroku[api]: Release v35 created by testtest@me.com
    2016-03-12T04:29:39.972973+00:00 heroku[slug-compiler]: Slug compilation started
    2016-03-12T04:29:40.048027+00:00 heroku[web.1]: Restarting
    2016-03-12T04:29:40.049299+00:00 heroku[web.1]: State changed from up to starting
    2016-03-12T04:29:42.417672+00:00 heroku[web.1]: Stopping all processes with SIGTERM
    2016-03-12T04:29:43.086852+00:00 app[web.1]: [3] - Gracefully shutting down workers...
    2016-03-12T04:29:43.176481+00:00 app[web.1]: [3] === puma shutdown: 2016-03-12 04:29:43 +0000 ===
    2016-03-12T04:29:43.176488+00:00 app[web.1]: [3] - Goodbye!
    2016-03-12T04:29:43.816757+00:00 heroku[web.1]: Process exited with status 0
    2016-03-12T04:29:46.716295+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
    2016-03-12T04:29:49.157324+00:00 app[web.1]: [3] Puma starting in cluster mode...
    2016-03-12T04:29:49.157437+00:00 app[web.1]: [3] * Version 2.11.1 (ruby 2.0.0-p648), codename: Intrepid Squirrel
    2016-03-12T04:29:49.157472+00:00 app[web.1]: [3] * Environment: production
    2016-03-12T04:29:49.157473+00:00 app[web.1]: [3] * Process workers: 2
    2016-03-12T04:29:49.157474+00:00 app[web.1]: [3] * Preloading application
    2016-03-12T04:29:50.759011+00:00 app[web.1]: Starting up a new ElasticSearch client with https://xxxxxx.us-east-1.bonsai.io
    2016-03-12T04:29:51.430834+00:00 app[web.1]: 2016-03-12 04:29:51 +0000: HEAD https://xxxxxx.bonsai.io:443/users [status:200, request:0.017s, query:n/a]
    2016-03-12T04:29:51.516765+00:00 app[web.1]: 2016-03-12 04:29:51 +0000: POST https://xxxxxxx.bonsai.io:443/users/user/_bulk [status:200, request:0.016s, query:0.005s]
    2016-03-12T04:29:51.516810+00:00 app[web.1]: 2016-03-12 04:29:51 +0000: > {"index":{"_id":1}}
    2016-03-12T04:29:51.516811+00:00 app[web.1]: {"id":1,"name":"Example User","email":"example@railstutorial.org","created_at":"2016-03-10T03:09:45.898Z","updated_at":"2016-03-10T03:09:45.898Z","password_digest":"$2a$10$/VQEZljtG.nQRuB20.UG1uSIQjtgk9KfzoXdUL4kGETwbZm/XPOma","remember_digest":null,"admin":true,"activation_digest":"$2a$10$jZpCLV4k2H5nuMCPVuZt7OzlUQjykQ0e7uwADb9AJ0vbrzHDw55La","activated":true,"activated_at":"2016-03-10T03:09:45.691Z","reset_digest":null,"reset_sent_at":null,"location":"New York","discipline":"Actor","slack":null,"experiences":null,"portfolio":null,"card_token":null}
    2016-03-12T04:29:51.516812+00:00 app[web.1]: {"index":{"_id":2}}
    2016-03-12T04:29:51.516813+00:00 app[web.1]: {"id":2,"name":"test","email":"testtest@me.com","created_at":"2016-03-10T03:13:19.990Z","updated_at":"2016-03-10T03:13:19.990Z","password_digest":"$2a$10$LWDYy6Ek1zR925kLvHHP.uRSnL7hAFOiYcdPkHCdBdiHGjuC8fDTC","remember_digest":null,"admin":false,"activation_digest":"$2a$10$k1jFVFe4lZlI5ktt7RcJx.hxdjwGEQIEnsMnwCnxLS1lpBaXbsFUu","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
    2016-03-12T04:29:51.516813+00:00 app[web.1]: {"index":{"_id":3}}
    2016-03-12T04:29:51.516814+00:00 app[web.1]: {"id":3,"name":"test","email":"testtest@icloud.com","created_at":"2016-03-10T22:55:37.757Z","updated_at":"2016-03-10T22:55:37.757Z","password_digest":"$2a$10$06QP.eB.Srx2TvejUscyyOIuOnzGmEPewAvfxwE4pS9mm/jtpeyZ.","remember_digest":null,"admin":false,"activation_digest":"$2a$10$JdaYMdl8VQlFg7bkN2nClec/ZN49w5cno78LTj.vupqKN9.JOoSaa","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
    2016-03-12T04:29:51.516814+00:00 app[web.1]: {"index":{"_id":4}}
    2016-03-12T04:29:51.516815+00:00 app[web.1]: {"id":4,"name":"test","email":"test.test@gmail.com","created_at":"2016-03-11T17:38:17.019Z","updated_at":"2016-03-11T17:38:17.019Z","password_digest":"$2a$10$3EGEVSC1PmX03YMH7bBt7erWXu7ssVT0KdcVfD99.mwJ7oAdax7MS","remember_digest":null,"admin":false,"activation_digest":"$2a$10$MtJkJQMQ25tH6PIuZEjka.mtPitSbODwjJ8qkorAwrWhfdbGl5ZQ.","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
    2016-03-12T04:29:51.516815+00:00 app[web.1]: {"index":{"_id":5}}
    2016-03-12T04:29:51.516816+00:00 app[web.1]: {"id":5,"name":"test","email":"test@gioventunyc.com","created_at":"2016-03-11T17:41:22.759Z","updated_at":"2016-03-11T17:41:22.759Z","password_digest":"$2a$10$pj2f6Sw7Lk5Q/J6alKT.4.0XPIgqEV8BMAgars6WQbfXNqBPRBEZ2","remember_digest":null,"admin":false,"activation_digest":"$2a$10$dxECrTuI0/R7cZe69TVWSuvjrz7phhLQh22ZBfg7l9OG9yUm4QJGy","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
    2016-03-12T04:29:51.516816+00:00 app[web.1]: {"index":{"_id":6}}
    2016-03-12T04:29:51.516817+00:00 app[web.1]: {"id":6,"name":"test","email":"test@gioventu.nyc","created_at":"2016-03-11T17:45:29.749Z","updated_at":"2016-03-11T17:45:29.749Z","password_digest":"$2a$10$gZM6tMEnO1K2JU.J7Nlm9.Vl5JH4RE6px1F5N5KcbGB7GsoRXhSXG","remember_digest":null,"admin":false,"activation_digest":"$2a$10$Erg4aoSYbKaC9HB78O1yXO1Dw0K11sQ4IHYIp595etw2eMBIsiliq","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
    2016-03-12T04:29:51.516817+00:00 app[web.1]: {"index":{"_id":7}}
    2016-03-12T04:29:51.516818+00:00 app[web.1]: {"id":7,"name":"test","email":"rs@rrrr.nyc","created_at":"2016-03-12T04:06:14.603Z","updated_at":"2016-03-12T04:06:14.603Z","password_digest":"$2a$10$lKwxQS5Ff9eOti.YauPn8.y2JjHocgwWpJk8sWjtwJFtRxnjhEr1C","remember_digest":null,"admin":false,"activation_digest":"$2a$10$Z78l8dtLU5tJgbv70cdgU.dWvfR7zd1riskj59anTePdnBv7H/4IW","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
    2016-03-12T04:29:51.516819+00:00 app[web.1]: {"index":{"_id":8}}
    2016-03-12T04:29:51.516821+00:00 app[web.1]: {"id":8,"name":"test","email":"rrrr@nyu.edu","created_at":"2016-03-12T04:19:22.961Z","updated_at":"2016-03-12T04:19:22.961Z","password_digest":"$2a$10$eXku5S8nLGXkxYnfeMARgesXNG76qMnIsrmLrTdIngT4t8L.uqQy.","remember_digest":null,"admin":false,"activation_digest":"$2a$10$7m4IKtrQ4WDfXmElvI9./OfeqpJS1guGK.X31mM0DPoRCcfscbrwK","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
    2016-03-12T04:29:51.516903+00:00 app[web.1]: 2016-03-12 04:29:51 +0000: < {"took":5,"errors":false,"items":[{"index":{"_index":"users","_type":"user","_id":"1","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"2","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"3","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"4","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"5","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"6","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"7","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"8","_version":3,"status":200}}]}
    2016-03-12T04:29:51.554058+00:00 app[web.1]: [3] * Listening on tcp://0.0.0.0:56115
    2016-03-12T04:29:51.815153+00:00 heroku[web.1]: State changed from starting to up
    2016-03-12T04:30:09.854889+00:00 app[web.1]: Started POST "/users" for 71.125.40.81 at 2016-03-12 04:30:09 +0000
    2016-03-12T04:30:09.891335+00:00 app[web.1]: Processing by UsersController#create as HTML
    2016-03-12T04:30:09.981602+00:00 app[web.1]:   [1m[36mUser Exists (1.6ms)[0m  [1mSELECT  1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('testtest@me.com') LIMIT 1[0m
    2016-03-12T04:30:10.384702+00:00 heroku[router]: at=info method=POST path="/users" host=xxxx.herokuapp.com request_id=c95e17ca-3eb3-4dfb-9337-b393ad6826b4 fwd="71.125.40.81" dyno=web.1 connect=0ms service=526ms status=200 bytes=5915
    2016-03-12T04:30:10.354983+00:00 app[web.1]:   [1m[35m (0.9ms)[0m  ROLLBACK
    2016-03-12T04:30:10.360982+00:00 app[web.1]:   Rendered shared/_error_messages.html.erb (1.1ms)
    2016-03-12T04:30:10.363072+00:00 app[web.1]:   Rendered users/new.html.erb within layouts/application (5.1ms)
    2016-03-12T04:30:10.365694+00:00 app[web.1]:   Rendered layouts/_shim.html.erb (0.3ms)
    2016-03-12T04:30:10.369943+00:00 app[web.1]:   Rendered layouts/_header.html.erb (3.7ms)
    2016-03-12T04:30:10.370911+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.3ms)
    2016-03-12T04:30:10.371340+00:00 app[web.1]: Completed 200 OK in 480ms (Views: 15.5ms | ActiveRecord: 3.3ms)
    2016-03-12T04:30:14.904181+00:00 app[web.1]: Started GET "/login" for 71.125.40.81 at 2016-03-12 04:30:14 +0000
    2016-03-12T04:30:14.958240+00:00 app[web.1]: Processing by SessionsController#new as HTML
    2016-03-12T04:30:15.544900+00:00 heroku[router]: at=info method=GET path="/login" host=xxxx.herokuapp.com request_id=71f94b8f-7543-439e-833f-bf1161c1d37a fwd="71.125.40.81" dyno=web.1 connect=1ms service=633ms status=200 bytes=5561
    2016-03-12T04:30:15.608618+00:00 heroku[router]: at=info method=GET path="/assets/application-6f5ae546d40366770d3a61453503cef12cb1811b5cf39fb0a67a1322f96873d9.css" host=xxxxx.herokuapp.com request_id=a2c69f95-d377-47a9-b1c7-5c4fb8594766 fwd="71.125.40.81" dyno=web.1 connect=0ms service=2ms status=200 bytes=29104
    2016-03-12T04:30:15.518580+00:00 app[web.1]:   Rendered sessions/new.html.erb within layouts/application (544.6ms)
    2016-03-12T04:30:15.522546+00:00 app[web.1]:   Rendered layouts/_shim.html.erb (0.3ms)
    2016-03-12T04:30:15.529268+00:00 app[web.1]:   Rendered layouts/_header.html.erb (6.1ms)
    2016-03-12T04:30:15.530501+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.4ms)
    2016-03-12T04:30:15.531077+00:00 app[web.1]: Completed 200 OK in 573ms (Views: 559.4ms | ActiveRecord: 0.0ms)
    2016-03-12T04:30:15.645644+00:00 heroku[router]: at=info method=GET path="/assets/application-44f9363a0510d929eca5abc71e6baff54884aadab1c158713bd34869de9bf38c.js" host=xxxx.herokuapp.com request_id=3535b08a-2406-4d83-9e4e-22046b0e0db7 fwd="71.125.40.81" dyno=web.1 connect=0ms service=6ms status=200 bytes=123671
    2016-03-12T04:30:17.308712+00:00 heroku[router]: at=info method=GET path="/password_resets/new" host=ancient-tor-3622.herokuapp.com request_id=9e49778c-5546-43d7-8990-fd543ad298b9 fwd="71.125.40.81" dyno=web.1 connect=0ms service=29ms status=200 bytes=5044
    2016-03-12T04:30:17.269613+00:00 app[web.1]: Started GET "/password_resets/new" for 71.125.40.81 at 2016-03-12 04:30:17 +0000
    2016-03-12T04:30:17.277696+00:00 app[web.1]: Processing by PasswordResetsController#new as HTML
    2016-03-12T04:30:17.284988+00:00 app[web.1]:   Rendered password_resets/new.html.erb within layouts/application (2.1ms)
    2016-03-12T04:30:17.289052+00:00 app[web.1]:   Rendered layouts/_shim.html.erb (0.4ms)
    2016-03-12T04:30:17.292766+00:00 app[web.1]:   Rendered layouts/_header.html.erb (1.5ms)
    2016-03-12T04:30:17.294115+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.4ms)
    2016-03-12T04:30:21.643797+00:00 app[web.1]: Started POST "/password_resets" for 71.125.40.81 at 2016-03-12 04:30:21 +0000
    2016-03-12T04:30:21.745309+00:00 app[web.1]:   [1m[33mUser Store (7.7ms)[0m  {"id":2,"exception":["Faraday::ConnectionFailed","Connection refused - connect(2)"]}
    2016-03-12T04:30:21.746719+00:00 app[web.1]: Completed 500 Internal Server Error in 100ms (Searchkick: 7.7ms | ActiveRecord: 9.8ms)
    2016-03-12T04:30:21.751092+00:00 app[web.1]: Faraday::ConnectionFailed (Connection refused - connect(2)):
    2016-03-12T04:30:21.751092+00:00 app[web.1]:   app/models/user.rb:83:in `create_reset_digest'
    2016-03-12T04:30:21.751093+00:00 app[web.1]:   app/controllers/password_resets_controller.rb:13:in `create'
    2016-03-12T04:30:21.836029+00:00 heroku[router]: at=info method=POST path="/password_resets" host=xxxxx.herokuapp.com request_id=69de3b2a-9f18-4a28-be0a-706a5dc9a341 fwd="71.125.40.81" dyno=web.1 connect=0ms service=181ms status=500 bytes=1714

2 个答案:

答案 0 :(得分:1)

我必须运行heroku run rake search kick:reindex CLASS=User并修复它。

答案 1 :(得分:0)

我重新制作了索引并且有效;

bundle exec rake searchkick:reindex:all

或者如果你想要你可以逐项重新索引

Products.reindex
User.reindex