Do you have the port open on your Sphinx server to allow your app server to
connect through to it?
On 21/08/2013, at 5:45 PM, Lihong He wrote:
> when I run app and search, my app report errors on page:
> Mysql2::Error in SearchController#show
>
> Can't connect to MySQL server on '192.168.5.133' (111)
> Rails.root: /home/git/labhub
>
> Application Trace | Framework Trace | Full Trace
> app/contexts/search_context.rb:99:in `execute'
> app/controllers/search_controller.rb:11:in `show'
>
> and on console the outputs is:
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Started GET "/search?pid=1&search=asd" for 192.168.5.131 at 2013-08-21
> 15:19:13 +0800
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Creating scope :open. Overwriting existing method Issue.open.
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Creating scope :open. Overwriting existing method MergeRequest.open.
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Creating scope :public. Overwriting existing method Project.public.
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Creating scope :private. Overwriting existing method Project.private.
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Creating scope :public. Overwriting existing method Snippet.public.
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Processing by SearchController#show as HTML
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Parameters: {"pid"=>"1", "search"=>"asd"}
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> User Load (0.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1
> LIMIT 1
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> (0.7ms) SELECT COUNT(*) FROM `system_notifications` WHERE
> `system_notifications`.`receiver_id` = 1 AND `system_notifications`.`read` = 0
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Invitation Load (0.8ms) SELECT id FROM `invitations` WHERE (status = 0)
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> (0.6ms) SELECT COUNT(*) FROM `invitation_notifications` WHERE
> `invitation_notifications`.`receiver_id` = 1 AND (invitation_id IN (NULL))
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Invitation Load (0.9ms) SELECT id FROM `invitations` WHERE (status != 30
> and status != 0)
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> (0.7ms) SELECT COUNT(*) FROM `invitation_notifications` WHERE
> `invitation_notifications`.`sender_id` = 1 AND
> `invitation_notifications`.`read` = 0 AND (invitation_id IN (NULL))
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> MergeRequest Load (0.8ms) SELECT id FROM `merge_requests` WHERE (author_id
> != 1)
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> (0.6ms) SELECT COUNT(*) FROM `merge_request_notifications` WHERE
> `merge_request_notifications`.`receiver_id` = 1 AND
> `merge_request_notifications`.`read` = 0 AND (merge_request_id in (NULL))
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> MergeRequest Load (0.8ms) SELECT id FROM `merge_requests` WHERE (author_id
> = 1)
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> CACHE (0.0ms) SELECT COUNT(*) FROM `merge_request_notifications` WHERE
> `merge_request_notifications`.`receiver_id` = 1 AND
> `merge_request_notifications`.`read` = 0 AND (merge_request_id in (NULL))
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Issue Load (0.8ms) SELECT id FROM `issues` WHERE (author_id != 1)
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> (0.6ms) SELECT COUNT(*) FROM `issue_notifications` WHERE
> `issue_notifications`.`receiver_id` = 1 AND `issue_notifications`.`read` = 0
> AND (issue_id in (NULL))
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Issue Load (0.7ms) SELECT id FROM `issues` WHERE (author_id = 1)
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> CACHE (0.0ms) SELECT COUNT(*) FROM `issue_notifications` WHERE
> `issue_notifications`.`receiver_id` = 1 AND `issue_notifications`.`read` = 0
> AND (issue_id in (NULL))
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> (0.6ms) SELECT COUNT(*) FROM `commit_notifications` WHERE
> `commit_notifications`.`receiver_id` = 1 AND `commit_notifications`.`read` = 0
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> (0.6ms) SELECT COUNT(*) FROM `social_action_notifications` WHERE
> `social_action_notifications`.`receiver_id` = 1 AND
> `social_action_notifications`.`read` = 0
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Sphinx Query (0.8ms) SELECT * FROM `project_core`, `project_delta` WHERE
> MATCH('asd @public 1') AND sphinx_deleted = 0 ORDER BY forks_count DESC LIMIT
> 0, 20
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Completed 500 Internal Server Error in 155ms
> [8a42a220540be5cbd2fcdc6d2fcaa69d] [192.168.5.131] [2013-08-21 15:19:13.377]
> Mysql2::Error (Can't connect to MySQL server on '192.168.5.133' (111)):
> app/contexts/search_context.rb:99:in `execute'
> app/controllers/search_controller.rb:11:in `show'
>
> The detail is:
> 1. PC1(192.168.5.155): web app (with TS, ts-delayed-delta gem - these are
> in the Gemfile)
> the thinking_sphinx.yml is:
>
> development:
> mem_limit: 1024M
> address: "192.168.5.133"
> bin_path: "/usr/bin"
> port: 9312
>
> run rake ts:configure OK
> 2. PC2(192.168.5.133): web app (with TS, ts-delayed-delta gem) + Delayed
> Job workers + Sphinx
> (1) thinking_sphinx.yml
>
> development:
> mem_limit: 1024M
> bin_path: "/usr/bin"
> port: 9312
>
> (2) rake jobs:work
> [Worker(host:hlh-virtual-machine pid:3168)] Starting job worker
>
> (3) rake ts:index OK
>
> (4) git@hlh-virtual-machine:~/labhub$ which indexer
> /usr/bin/indexer
>
> (5) git@hlh-virtual-machine:~/labhub$ searchd --config
> config/development.sphinx.conf --pidfile
> Sphinx 2.0.4-release (r3135)
> Copyright (c) 2001-2012, Andrew Aksyonoff
> Copyright (c) 2008-2012, Sphinx Technologies Inc
> (http://sphinxsearch.com)
>
> using config file 'config/development.sphinx.conf'...
> WARNING: compat_sphinxql_magics=1 is deprecated; please update your
> application and config
> listening on 127.0.0.1:9312
> precaching index 'user_core'
> precaching index 'user_delta'
> precaching index 'project_core'
> precaching index 'project_delta'
> precaching index 'project_file_core'
> precaching index 'project_file_delta'
> precaching index 'snippet_core'
> precaching index 'snippet_delta'
> precaching index 'organization_core'
> precaching index 'organization_delta'
> precached 10 indexes in 0.012 sec
>
> (6) git@hlh-virtual-machine:~/labhub$ ps aux | grep searchd
> git 4221 0.0 0.1 18572 1524 ? S 15:36 0:00
> searchd --config config/development.sphinx.conf --pidfile
> git 4222 0.0 0.5 24284 6080 ? Sl 15:36 0:00
> searchd --config config/development.sphinx.conf --pidfile
> git 4228 0.0 0.0 4392 836 pts/2 S+ 15:40 0:00 grep
> --color=auto searchd
> 3、then PC1 run rails s
> and access the web pages and search, but unlucky, I failed the search,
> the output is above. What's the matter or my thinking_sphinx.yml's config is
> wrong? Thank you so much!
>
> my next question is: If I should run rake ts:start on PC2? Of course
> now it doesn't work whether I rake ts:start or not!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.