2012-11-15 317 views
1

更新我一直在四處搜尋,以瞭解在重新引導後可能需要在項目中重新啓動哪些服務。其中一人在想獅身人面像,我終於得到它記錄了這一點:如何重新啓動服務器後重新啓動RoR服務

[Fri Nov 16 19:34:29.820 2012] [29623] accepting connections 

但我仍然無法運行的searchd或searchd的--stop因爲當時在等沒有產生的sphinx.conf文件/ sphinxsearch欲瞭解更多信息,請參閱此開啓線程thinking_sphinx after reboot

然後我轉向尋找重新啓動獨角獸或薄基於我得到的一些見解。問題是當我檢查我的寶石時,我看到一個薄的獨角獸。但是,當我嘗試啓動其中一個他們沒有文件駐留在etc/init.d/nginx和sphinxsearch文件所在的位置...

重新啓動將徹底清除應用程序服務器的文件,如瘦或獨角獸?我們託管在Rackspace公司的運行

紅寶石1.9.2p290
軌(3.2.8,3.2.7,3.2.0)
的nginx/1.1.19

  • 注意到有寶石的獨角獸和薄,但沒有unicorn.rb或thin.rb在我的配置文件夾中的我的應用程序...我仍然超級迷失,如果任何人可以給我一些洞察力的一些步驟來弄清楚我會真的很感激它。任何事情都會有所幫助,謝謝閱讀。

薄1.4.1
麒麟4.3.1

當我運行麒麟我得到相同issue as referenced here

> /usr/local/bin/unicorn start 

/usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/configurator.rb:610:in `parse_rackup_file': rackup file (start) not readable (ArgumentError) 
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/configurator.rb:76:in `reload' 
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/configurator.rb:67:in `initialize' 
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:104:in `new' 
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb:104:in `initialize' 
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/bin/unicorn:121:in `new' 
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.3.1/bin/unicorn:121:in `<top (required)>' 
from /usr/local/bin/unicorn:19:in `load' 
from /usr/local/bin/unicorn:19:in `<main>' 

當我運行薄它只是打開一個命令行提示符...

/usr/local/bin/thin start 

>> Using rack adapter 

其他寶石:

*當地的寶石*

actionmailer (3.2.8, 3.2.7, 3.2.0) 
actionpack (3.2.8, 3.2.7, 3.2.0) 
activemodel (3.2.8, 3.2.7, 3.2.0) 
activerecord (3.2.8, 3.2.7, 3.2.0) 
activeresource (3.2.8, 3.2.7, 3.2.0) 
activesupport (3.2.8, 3.2.7, 3.2.0) 
arel (3.0.2) 
builder (3.0.0) 
bundler (1.1.5) 
carmen (1.0.0.beta2) 
carmen-rails (1.0.0.beta3) 
cocaine (0.2.1) 
coffee-rails (3.2.2) 
coffee-script (2.2.0) 
coffee-script-source (1.3.3) 
daemons (1.1.9) 
erubis (2.7.0) 
eventmachine (0.12.10) 
execjs (1.4.0) 
faraday (0.8.4) 
faraday_middleware (0.8.8) 
foursquare2 (1.8.2) 
geokit (1.6.5) 
hashie (1.2.0) 
hike (1.2.1) 
httparty (0.8.3) 
httpauth (0.1) 
i18n (0.6.0) 
journey (1.0.4) 
jquery-rails (2.0.2) 
json (1.7.4, 1.7.3) 
jwt (0.1.5) 
kgio (2.7.4) 
lastfm (1.8.0) 
libv8 (3.3.10.4 x86_64-linux) 
mail (2.4.4) 
mime-types (1.19, 1.18) 
minitest (1.6.0) 
multi_json (1.3.6) 
multi_xml (0.5.1) 
multipart-post (1.1.5) 
mysql2 (0.3.11) 
oauth2 (0.8.0) 
paperclip (3.1.1) 
polyglot (0.3.3) 
rack (1.4.1) 
rack-cache (1.2) 
rack-ssl (1.3.2) 
rack-test (0.6.1) 
rails (3.2.8, 3.2.7, 3.2.0) 
railties (3.2.8, 3.2.7, 3.2.0) 
raindrops (0.10.0, 0.9.0) 
rake (0.9.2.2, 0.8.7) 
rdoc (3.12, 2.5.8) 
riddle (1.5.3) 
sass (3.2.0, 3.1.19) 
sass-rails (3.2.5) 
sprockets (2.1.3) 
sqlite3 (1.3.6) 
sqlite3-ruby (1.3.3) 
therubyracer (0.10.2, 0.10.1) 
thin (1.4.1) 
thinking-sphinx (2.0.10) 
thor (0.16.0, 0.15.4, 0.14.6) 
tilt (1.3.3) 
treetop (1.4.10) 
tzinfo (0.3.33) 
uglifier (1.2.7, 1.2.4) 
unicorn (4.3.1) 
xml-simple (1.1.1) 

我的,是由另一組建立了一個項目。我對config文件夾中的一個常量文件做了一些修改(改變了一些填充了某些下拉字段的數組的值),但是必須重新啓動應用程序才能識別這些更改。託管是通過Rackspace,我們通過他們的網站上的選項重新啓動。我聯繫了他們並檢查了我們的服務器的狀態,該端口是開放的和可操作的。問題是,當您轉到該網站的地址時,應用程序未運行。然後當我輸入服務器的IP地址時,它只是說「歡迎來到Nginx」。但在日誌文件中,我看到:

[Thu Nov 15 02:34:37.945 2012] [15916] caught SIGTERM, shutting down 
[Thu Nov 15 02:34:37.996 2012] [15916] shutdown complete 

我對服務器端設置不太熟練。我從來沒有在一個Rails項目上工作,該項目必須在應用程序啓動之前啓動特定的服務。任何有關如何找出需要重新啓動的服務以及如何重新啓動服務的見解都將不勝感激。我在這一點上感覺在水中那種死了......

感謝,

艾倫

回答

0

好了,所以搜索和嘗試無數的事情,我在網上找到我跑這個命令行的小時後:

unicorn_rails -p 3000 

而魔法般的網站正在備份和運行,現在我的問題是whe ñ關閉控制檯(我已經運行該命令)該站點再次下降。

我要follow this,希望能夠解決這個問題

注:這些都是我拿了把事情的工作

當重新啓動你的應用程序之前重新啓動某些服務的服務器中的步驟將可訪問:

1)thinking_sphinx
參考網站
http://pat.github.com/ts/en/rake_tasks.html
http://www.claytonlz.com/2010/09/thinkingsphinx-conf-problems/

a)create/modify app/config/sphinx.yml 

    development: 
     morphology: stem_en 
     port: 9312 
     bin_path: "/usr/bin"    # set up the path to binary for searchd 
     searchd_binary_name: searchd 
     indexer_binary_name: indexer 
     #mem_limit: 128M 
    test: 
     morphology: stem_en 
     port: 9312 
     mem_limit: 128M 
    production: 
     morphology: stem_en 
     port: 9312 
     mem_limit: 512M 
    # the searchd ip, in case it's not on localhost 
    # address: 10.10.0.0 
    # this is by default included in db/sphinx 
    # searchd_file_path: "/path/to/shared/folder/sphinx" 

b)rake thinking_sphinx:index 
c)rake thinking_sphinx:configure  # creates config/development.sphinx.conf which helps define sphinx's indexing 

d)# then you have to start sphinx, there are 2 ways to do this 

    rake thinking_sphinx:start 
    rake thinking_sphinx:stop 

    OR 

    searchd 
    searchd --stop 

    # only the rake commands worked for me, when I tried to run searchd 
    # I got an error FATAL: no readable config file (looked in /etc/sphinxsearch/sphinx.conf, ./sphinx.conf). 
    # for some reason we dont have a sphinx.conf file, but the rake commands work without it 

e)# once you start thinking_sphinx check log/searchd.log file for the line 
    [Fri Nov 16 19:34:29.820 2012] [29623] accepting connections 

2)的nginx
參考站點:
http://wiki.nginx.org/CommandLine

a) check that nginx is up and running 
    i) start server 
     # to check where nginx resides type in this into server console 
     which nginx 
     # whatever path it gives you is how you start the server this is my path 
     /usr/sbin/nginx 
    ii) stop server 
     /usr/sbin/nginx -s stop # use the path given by which command 

3)麒麟(起始的應用程序服務器)
參考網站:
http://codelevy.com/2010/02/09/getting-started-with-unicorn.html

a) test if unicorn will run after previous changes 
    unicorn_rails -p 3000 
    # the site should now be up and running, check that it is 
    # console should now log the different actions you do on the site 

b) create unicorn.rb in config folder (if none is there) 
    # only start this step if the step above got the site running 
    # close the console or exit the process you started above 
    # contents of unicorn.rb 
    worker_processes 2  #(starts 2 child processes, not completely neccissary) 
    preload_app true 
    timeout 30 
    listen 3000 

    after_fork do |server, worker| 
     ActiveRecord::Base.establish_connection 
    end 

c) run unicorn in the background 
    # make sure you exited the process above before running this 
    unicorn_rails -c config/unicorn.rb -D 

    # this was giving me an error that it said was logged by stderr 
    # I got the command to run by adding a command to the front 
    http://stackoverflow.com/questions/2325152/check-for-stdout-or-stderr 

    exec 2> /dev/null unicorn_rails -c config/unicorn.rb -D 


d) (optional) check stats from starting unicorn 

    i) pgrep -lf unicorn_rails 
     #sample output 
     5374 unicorn_rails master -c config/unicorn.rb -D    
     5388 unicorn_rails worker[0] -c config/unicorn.rb -D # not needed currently 
     5391 unicorn_rails worker[1] -c config/unicorn.rb -D # not needed currently 

    ii) cat tmp/pids/unicorn.pid # from inside the streetpotato folder 
     #sample output 
     5374 
1

Nginx是由本身不會成爲Rails應用程序。它需要一個「應用程序服務器」,它可以傳遞請求並獲得響應。有很多選擇,最受歡迎的是乘客,瘦身和獨角獸。我建議你從服務器上的nginx配置開始,看看有沒有提到這些。這應該指出你如何重新啓動它們。

http://www.modrails.com/documentation/Users%20guide%20Nginx.html

http://articles.slicehost.com/2008/5/27/ubuntu-hardy-nginx-rails-and-thin

http://sirupsen.com/setting-up-unicorn-with-nginx/(向下滾動導軌上獨角獸)

+0

感謝您對我的迴應。我甩的寶石,它看起來像薄和獨角獸是吧,我也認爲我可能需要重新啓動思維 - 獅身人面像。 –

0

我知道我遲到的遊戲,但這一進程在運行:

unicorn_rails -p 3000 

是快死的時候,你通過關閉會話默認。如果你想讓它繼續沒有死,運行:

nohup unicorn_rails -p 3000 & 

「nohup的」代表「不掛斷」,這使運行的過程中,你甚至下降後。'&'告訴操作系統在後臺運行它作爲一項工作。

希望這個地獄!