问题4:上传的APP的health值为0%
问题描述:解决了3的问题后,我试着铺设一个自己的应用。结果出现下面的这个情况,首先App需要很久才启动起来,让后提示我去查看log文件。这是不是一种正常情况呢?
vm@vm:~$ vmc start hello
Staging Application 'hello': OK
Starting Application 'hello': ..........................
Application is taking too long to start, check your logs
Starting Application 'hello': OK
当然不是,我查看了一下我推送的应用的状态,很容易就看到这个health值为0
vm@vm:~$ vmc apps
+-------------+----+--------+---------------+----------+
| Application | # | Health | URLS | Services |
+-------------+----+--------+---------------+----------+
| hello | 1 | 0% | hello.vcap.me | |
+-------------+----+--------+---------------+----------+
而之后我也试着使用w3m访问自己的页面,结果也失败了,这说明我们还是没有成功。好吧,接下来让我们考虑一下是什么情况。
我首先想到的是这个https://github.com/cloudfoundry/uaa。然后也试着重新弄了一个uaa的节点,但是问题还是没有解决。
然后我就上网搜,找到如下的一个回答:
Check the dea logfile on your DEA node(s). There is another problem with
the multi-node guide where the "rest" / CC node contains the path
information for the runtimes, but the DEA node has them installed at a
different place.
I filed a bug on that particular issue (not that it's the same one that
you're having, but maybe) here:
https://cloudfoundry.atlassian.net/browse/CF-140.
You can work around it by tweaking
cloudfoundry/.deployments/<name>/config/runtimes.yml on the CC node...
notice the <name> is different on your CC and DEA nodes, if you followed
the multi-node deployment guide exactly, and that's what breaks the
runtimes. You can edit the paths in that file (what I did), or try to
reinstall either the CC or DEA node to use the same "name", so that the
path happens to line up properly.
Good luck! Once it works it really is kinda nice. The multi-node guides are
just *awful* though.
意思大概就是去查看dea的log日志。晕,在问题3的时候我们才试着查看过dea的日志信息,当时试着改过一个问题,已经没问题了,现在怎么还会有问题?但是没办法我还是试着查看了一下,结果很惊讶的发现下面的信息:
[2012-10-16 12:52:28.863974] dea - pid=6504 tid=a226 fid=0c51 DEBUG -- Ignoring request, {"version"=>"1.8.7", "description"=>"Ruby 1.8.7", "executable"=>"/home/vm/cloudfoundry/.deployments/rest/deploy/rubies/ruby-1.8.7-p357/bin/ruby", "version_flag"=>"-e 'puts RUBY_VERSION'", "additional_checks"=>"-e 'puts RUBY_PATCHLEVEL >= 174'", "version_output"=>"1.8.7", "environment"=>{"PATH"=>"/home/vm/cloudfoundry/.deployments/rest/deploy/rubies/ruby-1.8.7-p357/bin:/home/vm/cloudfoundry/.deployments/rest/deploy/nodes/node-0.8.2/bin:$PATH", "BUNDLE_GEMFILE"=>nil}, "name"=>"ruby18"} runtime not supported.
[2012-10-16 12:52:37.610533] dea - pid=6504 tid=a226 fid=0c51 DEBUG -- DEA received router start message: {"id":"e02da355f3b4a439cae9066fce2ec6ef","version":0.98}
解决方法:天哪,这不是和问题3中的情况一样么!!!最后解决方法也和问题3一样咯。试着修改后,再重启一下每个节点。
vm@vm:~/test$ vmc apps
+-------------+----+---------+---------------+----------+
| Application | # | Health | URLS | Services |
+-------------+----+---------+---------------+----------+
| env | 1 | RUNNING | env.vcap.me | |
| hello | 1 | RUNNING | hello.vcap.me | |
+-------------+----+---------+---------------+----------+
OK,现在已经没有问题了。
vm@vm:~$ vmc start hello
Staging Application 'hello': OK
Starting Application 'hello': ..........................
Application is taking too long to start, check your logs
Starting Application 'hello': OK
总结
多节点的部署,说难挺难,说简单也算可以,心得如下:
(1)最好了解CF的基本架构,我感觉如果了解,很多东西弄起来就会有思路。也会方便很多。
(2)学会查找资料,百我这次遇到的问题的解决方法都是在CF的社区和google的group里面找到的。
(3)学会查看日志,也就是~/cloudfoundry/.deployment/XXX/log底下的信息,有时候答案就在里面了。