我在执行以下命令时遇到问题: bundle exec unicorn_rails
命令来启动机车 CMS 引擎的服务器。如果我运行它,我会得到:
$ bundle exec unicorn_rails
Your Gemfile lists the gem unicorn (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
E, [2014-02-09T18:04:20.887156 #59168] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-02-09T18:04:20.887275 #59168] ERROR -- : retrying in 0.5 seconds (4 tries left)
E, [2014-02-09T18:04:21.388747 #59168] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-02-09T18:04:21.388822 #59168] ERROR -- : retrying in 0.5 seconds (3 tries left)
E, [2014-02-09T18:04:21.890285 #59168] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-02-09T18:04:21.890360 #59168] ERROR -- : retrying in 0.5 seconds (2 tries left)
E, [2014-02-09T18:04:22.391341 #59168] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-02-09T18:04:22.391419 #59168] ERROR -- : retrying in 0.5 seconds (1 tries left)
E, [2014-02-09T18:04:22.892905 #59168] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
E, [2014-02-09T18:04:22.892983 #59168] ERROR -- : retrying in 0.5 seconds (0 tries left)
E, [2014-02-09T18:04:23.394424 #59168] ERROR -- : adding listener failed addr=0.0.0.0:8080 (in use)
/Users/Horibu/.rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.8.2/lib/unicorn/socket_helper.rb:185:in `bind': Address already in use - bind(2) (Errno::EADDRINUSE)
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.8.2/lib/unicorn/socket_helper.rb:185:in `new_tcp_server'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.8.2/lib/unicorn/socket_helper.rb:165:in `bind_listen'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:242:in `listen'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:805:in `block in bind_new_listeners!'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:805:in `each'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:805:in `bind_new_listeners!'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:138:in `start'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.8.2/bin/unicorn_rails:209:in `<top (required)>'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/bin/unicorn_rails:23:in `load'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/bin/unicorn_rails:23:in `<main>'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
from /Users/Horibu/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
我的日志文件(usr/local/var/log/mongodb/mongo.log):
***** SERVER RESTARTED *****
Sun Feb 9 17:58:23.047 [initandlisten] MongoDB starting : pid=56212 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=pavels-mbp-2.fritz.box
Sun Feb 9 17:58:23.047 [initandlisten] db version v2.4.9
Sun Feb 9 17:58:23.047 [initandlisten] git version: nogitversion
Sun Feb 9 17:58:23.047 [initandlisten] build info: Darwin minimavericks.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
Sun Feb 9 17:58:23.047 [initandlisten] allocator: tcmalloc
Sun Feb 9 17:58:23.047 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/usr/local/etc/mongod.conf", dbpath: "/usr/local/var/mongodb", logappend: "true", logpath: "/usr/local/var/log/mongodb/mongo.log" }
Sun Feb 9 17:58:23.048 [initandlisten] journal dir=/usr/local/var/mongodb/journal
Sun Feb 9 17:58:23.048 [initandlisten] recover : no journal files present, no recovery needed
Sun Feb 9 17:58:23.069 [initandlisten] couldn't open /usr/local/var/mongodb/local.ns errno:13 Permission denied
Sun Feb 9 17:58:23.069 [initandlisten] error couldn't open file /usr/local/var/mongodb/local.ns terminating
Sun Feb 9 17:58:23.069 dbexit:
Sun Feb 9 17:58:23.069 [initandlisten] shutdown: going to close listening sockets...
Sun Feb 9 17:58:23.069 [initandlisten] shutdown: going to flush diaglog...
Sun Feb 9 17:58:23.070 [initandlisten] shutdown: going to close sockets...
Sun Feb 9 17:58:23.070 [initandlisten] shutdown: waiting for fs preallocator...
Sun Feb 9 17:58:23.070 [initandlisten] shutdown: lock for final commit...
Sun Feb 9 17:58:23.070 [initandlisten] shutdown: final commit...
Sun Feb 9 17:58:23.070 [initandlisten] shutdown: closing all files...
Sun Feb 9 17:58:23.070 [initandlisten] closeAllFiles() finished
Sun Feb 9 17:58:23.070 [initandlisten] journalCleanup...
Sun Feb 9 17:58:23.070 [initandlisten] removeJournalFiles
Sun Feb 9 17:58:23.070 [initandlisten] shutdown: removing fs lock...
Sun Feb 9 17:58:23.070 dbexit: really exiting now
如果我运行:
$ ps wuax | grep mongo
我得到:
Horibu 49218 0,0 0,0 2451216 672 s000 S+ 5:44pm 0:00.00 grep mongo
如果我运行$ mongo,我会得到:
pavels-mbp-2:mylocomotiveapp Horibu$ mongo
MongoDB shell version: 2.4.9
connecting to: test
Sun Feb 9 17:50:38.097 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
mongoid.yml 看起来像这样:
development:
sessions:
default:
database: locomotive_dev
hosts:
- localhost:27017
options:
identity_map_enabled: true
test:
sessions:
default:
database: locomotive_test
hosts:
- localhost:27017
options:
identity_map_enabled: true
production:
sessions:
default:
database: locomotive_production
# heroku
# uri: <%= ENV['MONGOHQ_URL'] %>
hosts:
- localhost:27017
options:
identity_map_enabled: true
我的宝石列表:
pavels-mbp-2:mylocomotiveapp Horibu$ gem list
*** LOCAL GEMS ***
actionmailer (4.0.2, 3.2.16)
actionmailer-with-request (0.4.0)
actionpack (4.0.2, 3.2.16)
activeadmin (0.6.3)
activemodel (4.0.2, 3.2.16)
activerecord (4.0.2, 3.2.16)
activerecord-deprecated_finders (1.0.3)
activeresource (3.2.16)
activesupport (4.0.2, 3.2.16)
acts_as_indexed (0.8.3)
addressable (2.3.5)
arbre (1.0.1)
arel (4.0.2, 4.0.1, 3.0.3)
atomic (1.1.14)
awesome_nested_set (2.1.6)
babosa (0.3.11)
bcrypt-ruby (3.1.2)
better_errors (1.0.1)
bigdecimal (1.2.0)
bootstrap-sass (3.1.0.1)
bootstrap-sass-rails (3.1.0.0)
bourbon (3.1.8)
builder (3.1.4, 3.0.4)
bundler (1.5.2)
bundler-unload (1.0.2)
cancan (1.6.7)
carrierwave (0.9.0)
carrierwave-mongoid (0.6.3)
cells (3.8.8)
chronic (0.10.2)
chunky_png (1.2.9)
codemirror-rails (3.21)
coderay (1.1.0)
coffee-rails (4.0.1, 3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.7.0)
colorize (0.5.8)
commonjs (0.2.7)
compass (0.12.2)
compass-rails (1.0.3)
custom_fields (2.3.1)
daemons (1.1.9)
decorators (1.0.3)
devise (3.2.2, 2.2.8, 2.2.7)
devise-encryptable (0.1.2)
dragonfly (0.9.15)
ejs (1.0.0)
erubis (2.7.0)
eventmachine (1.0.3)
excon (0.31.0, 0.23.0)
execjs (2.0.2)
executable-hooks (1.3.1)
faker (0.9.5)
ffi (1.9.3)
flash_cookie_session (1.1.6)
fog (1.12.1)
formatador (0.2.4)
formtastic (2.2.1)
friendly_id (4.0.10.1)
fssm (0.2.10)
gem-wrappers (1.2.4)
globalize (3.0.4)
haml (4.0.5)
has_scope (0.6.0.rc)
heroku (3.3.0)
heroku-api (0.3.17)
highline (1.6.20)
hike (1.2.3)
httmultiparty (0.3.10)
httparty (0.12.0, 0.11.0)
i18n (0.6.9)
inherited_resources (1.4.1)
io-console (0.4.2)
jbuilder (1.5.3)
journey (1.0.4)
jquery-rails (3.1.0, 2.3.0, 2.1.4)
json (1.8.1, 1.7.7)
kaminari (0.15.1, 0.14.1)
kgio (2.9.1, 2.9.0)
launchy (2.4.2)
less (2.2.2)
libv8 (3.16.14.3 x86_64-darwin-12 x86_64-darwin-13)
listen (0.7.3)
locomotive-aloha-rails (0.23.2.2)
locomotive-tinymce-rails (3.5.8.2)
locomotive_cms (2.4.1)
locomotive_liquid (2.4.2)
locomotivecms-liquid (2.6.0)
locomotivecms-solid (0.2.2.1)
locomotivecms_mounter (1.4.0)
locomotivecms_solid (0.2.2)
locomotivecms_wagon (1.4.0)
logger (1.2.8)
mail (2.5.4)
meta_search (1.1.3)
mime-types (1.25.1)
mimetype-fu (0.1.2)
minitest (4.7.5, 4.3.2)
money (5.1.1)
mongo_session_store-rails3 (4.1.1)
mongoid (3.1.6)
mongoid-grid_fs (1.9.0)
mongoid-tree (1.0.4)
mongoid_migration (0.0.8)
moped (1.5.2)
multi_json (1.8.4, 1.7.9)
multi_xml (0.5.5)
multipart-post (2.0.0)
mysql2 (0.3.14)
net-scp (1.1.2)
net-ssh (2.8.0)
netrc (0.7.7)
nokogiri (1.5.11)
origin (1.1.0)
orm_adapter (0.5.0)
polyamorous (0.5.0)
polyglot (0.3.3)
psych (2.0.0)
rack (1.5.2, 1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (4.0.2, 3.2.16)
rails-backbone (0.7.2)
rails-i18n (0.7.4)
railties (4.0.2, 3.2.16)
raindrops (0.12.0)
rake (10.1.1, 10.0.4, 0.9.6)
rb-fsevent (0.9.4)
rb-inotify (0.9.3)
rdoc (4.1.1, 4.0.0, 3.12.2)
redcarpet (3.0.0)
RedCloth (4.2.9)
ref (1.0.5)
refinerycms (2.1.1)
refinerycms-acts-as-indexed (1.0.0)
refinerycms-authentication (2.1.1)
refinerycms-bootstrap (0.0.1)
refinerycms-core (2.1.1)
refinerycms-dashboard (2.1.1)
refinerycms-i18n (2.1.0)
refinerycms-images (2.1.1)
refinerycms-pages (2.1.1)
refinerycms-resources (2.1.1)
responders (1.0.0, 0.9.3)
rest-client (1.6.7)
routing-filter (0.3.1)
ruby-hmac (0.4.0)
rubygems-bundler (1.4.2)
rubyzip (1.1.0)
rvm (1.11.3.9)
sanitize (2.0.3)
sass (3.2.14)
sass-rails (3.2.6)
sdoc (0.4.0, 0.3.20)
seo_meta (1.4.0)
sprockets (2.10.1, 2.2.2)
sprockets-rails (2.0.1)
sprockets-sass (1.0.2)
sqlite3 (1.3.8)
stringex (2.0.11)
test-unit (2.0.0.0)
therubyracer (0.12.1)
thin (1.5.1)
thor (0.18.1)
thread_safe (0.1.3)
tilt (1.4.1)
treetop (1.4.15)
truncate_html (0.9.2)
tzinfo (0.3.38)
uglifier (2.4.0, 1.2.7)
unicorn (4.8.2)
warden (1.2.3)
wdm (0.1.0)
will_paginate (3.0.5)
zip (2.0.2)
首先,您应该找到使用pro的应用程序/进程,键入:
sudo netstat -lpn |grep :8080
您将获得类似于以下内容的输出:
tcp6 0 0 :::8080 :::* LISTEN 6782/java
然后使用进程 ID 杀死进程,在我的例子中为 6782:
sudo kill 6782
对于与MongoDB相关的问题,来自/usr/local/var/log/mongodb/mongo.log的这一行说明了一切。
Sun Feb 9 17:58:23.069 [initandlisten] couldn't open /usr/local/var/mongodb/local.ns errno:13 Permission denied
仔细检查运行 mongod 的用户的权限以及目录/usr/local/var/mongodb/和底层文件。 如果您获得正确的权限,则mongod服务器应该正在运行,您将不再看到最后一行。
Sun Feb 9 17:58:23.070 dbexit: really exiting now