在学习使用CloudFoundry过程中做的一些笔记,只做稍微整理。对CF不了解的可以当做看热闹,对CF了解的希望对你有用。这也是一个踩坑、添坑的过程,所以我不能保证自己做的是完成正确,我也有可能挖坑给你,请牢记!由于各种原因,如公司规定、个人认知能力有限,说得不到位或者给你挖了坑,请谅解。

项目所在:https://github.com/yudai/cf_nise_installer

一键安装

bash < <(curl -s -k -B https://raw.github.com/yudai/cf_nise_installer/${INSTALLER_BRANCH:-master}/local/bootstrap.sh)

然后启动

cd cf_nise_installer/ &&./local/start_processes.sh

我自己更改了一下代码,虽然不多,但对于国内用户的网络、和网速来说一次运行即成功的概率比较小。重复运行时,可以帮你减少一点等待时间。项目在https://github.com/kelby/cf_nise_installer

运行报错

The following templates and packages forjob micro_ng will be installed.

#nats

* common

* nats

* ruby

#health_manager_next

* health_manager_next

* common

* ruby

* syslog_aggregator

#uaa

* common

* ruby

* syslog_aggregator

* uaa

#cloud_controller_ng

* common

* cloud_controller_ng

* nginx

* libpq

* mysqlclient

* sqlite

* ruby

* syslog_aggregator

#gorouter

* common

* golang

* gorouter

* syslog_aggregator

#dea_next

* common

* dea_next

* warden

* rootfs_lucid64

* ruby

* golang

* sqlite

* mysqlclient

* syslog_aggregator

* libpq

* git

* buildpack_cache

* insight_agent

* libyaml

#[11684] INFO: Resolving packagedependencies...

#[11684] INFO: Installing the followingpackages:

#[11684] INFO:  * common

#[11684] INFO:  * libyaml

#[11684] INFO:  * ruby

#[11684] INFO:  * nats

#[11684] INFO:  * health_manager_next

#[11684] INFO:  * syslog_aggregator

#[11684] INFO:  * uaa

#[11684] INFO:  * libpq

#[11684] INFO:  * mysqlclient

#[11684] INFO:  * sqlite

#[11684] INFO:  * cloud_controller_ng

#[11684] INFO:  * nginx

#[11684] INFO:  * golang

#[11684] INFO:  * gorouter

#[11684] INFO:  * buildpack_cache

#[11684] INFO:  * insight_agent

#[11684] INFO:  * dea_next

#[11684] INFO:  * warden

#[11684] INFO:  * rootfs_lucid64

#[11684] INFO:  * git

#[8121] INFO: Installing package common

#[8121] INFO: The same version of thepackage is already installed. Skipping

#[8121] INFO: Installing package libyaml

#[8121] INFO: The same version of thepackage is already installed. Skipping

#[8121] INFO: Installing package ruby

#[8121] INFO: Running the packaging scriptfor ruby

/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/bosh-fbb73b1d320c/bosh_cli/lib/cli/release_compiler.rb:163:in`rescue in find_in_indices': Blobstore error: Failed to create object,underlying error: execution expired/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/httpclient-2.2.4/lib/httpclient/session.rb:300:in`connect' (Bosh::Cli::BlobstoreError)

/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/httpclient-2.2.4/lib/httpclient/session.rb:300:in`ssl_connect'

/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/httpclient-2.2.4/lib/httpclient/session.rb:739:in`block in connect'

省略……。

/home/cloud/cf_nise_installer/nise_bosh/lib/nise_bosh/builder.rb:189:in`install_packages'

/home/cloud/cf_nise_installer/nise_bosh/lib/nise_bosh/builder.rb:263:in`install_job'

/home/cloud/cf_nise_installer/nise_bosh/lib/nise_bosh/runner.rb:101:in`run_default_mode'

/home/cloud/cf_nise_installer/nise_bosh/lib/nise_bosh/runner.rb:65:in`run'

./bin/nise-bosh:4:in `<main>'

from/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/bosh-fbb73b1d320c/bosh_cli/lib/cli/release_compiler.rb:121:in`find_in_indices'

from/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/bosh-fbb73b1d320c/bosh_cli/lib/cli/release_compiler.rb:109:in`find_package'

from/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/bosh-fbb73b1d320c/bosh_agent/lib/bosh_agent/message/compile_package.rb:62:in`start'

from/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/bosh-fbb73b1d320c/bosh_agent/lib/bosh_agent/message/compile_package.rb:31:in`process'

from /home/cloud/cf_nise_installer/nise_bosh/lib/nise_bosh/builder.rb:215:in`run_packaging'

from/home/cloud/cf_nise_installer/nise_bosh/lib/nise_bosh/builder.rb:203:in`install_package'

from /home/cloud/cf_nise_installer/nise_bosh/lib/nise_bosh/builder.rb:191:in`block in install_packages'

from/home/cloud/cf_nise_installer/nise_bosh/lib/nise_bosh/runner.rb:101:in`run_default_mode'

from /home/cloud/cf_nise_installer/nise_bosh/lib/nise_bosh/runner.rb:65:in`run'

from ./bin/nise-bosh:4:in `<main>'

类似

https://github.com/yudai/cf_nise_installer/issues/16

https://github.com/yudai/cf_nise_installer/issues/11

https://github.com/nttlabs/nise_bosh/issues/18

解决方法:多运行几次安装脚本就行了

安装脚本(顺利)

cloud:~$ bash < <(curl -s -k -Bhttps://raw.github.com/yudai/cf_nise_installer/${INSTALLER_BRANCH:-master}/local/bootstrap.sh)

/usr/bin/git

Already on 'master'

Already up-to-date.

+ rvm

+ which git

/usr/bin/git

+ '[' '!' -d nise_bosh ']'

+ cd nise_bosh

+ sudo ./bin/init

[sudo] password for cloud:

+ bosh_app_dir=/var/vcap

+ bosh_dir=/var/vcap/bosh

+ apt-get update

Hit http://mirrors.163.com lucidRelease.gpg

Ign http://mirrors.163.com/ubuntu/lucid/main Translation-en_US

Hit http://mirrors.163.comlucid-backports/multiverse Sources

Reading package lists... Done

+ DEBIAN_FRONTEND=noninteractive

+ apt-get install -f -y --force-yes--no-install-recommends build-essential libssl-dev lsof strace bind9-hostdnsutils tcpdump iputils-arping curl wget libcurl3 libcurl3-dev bisonlibreadline6-dev libxml2 libxml2-dev libxslt1.1 libxslt1-dev zip unzipnfs-common flex psmisc apparmor-utils iptables sysstat rsync openssh-server traceroutelibncurses5-dev quota libaio1 gdb tripwire libcap2-bin libyaml-dev

Reading package lists... Done

Building dependency tree

gettext is already the newest version.

0 upgraded, 0 newly installed, 0 to removeand 72 not upgraded.

+ cat

++ grep '^vcap$' -c

++ cut -f1 -d :

++ cat /etc/passwd

+ '[' 1 -eq 0 ']'

+ echo 'User vcap exists already, skippkingadduser...'

User vcap exists already, skippkingadduser...

++ lsb_release -cs

+ '[' lucid == lucid ']'

+ variant=lts-backport-oneiric

+ apt-get install -ylinux-image-virtual-lts-backport-oneiriclinux-headers-virtual-lts-backport-oneiric

Reading package lists... Done

Building dependency tree

Reading state information... Done

linux-image-virtual-lts-backport-oneiric isalready the newest version.

linux-headers-virtual-lts-backport-oneiricis already the newest version.

0 upgraded, 0 newly installed, 0 to removeand 72 not upgraded.

+ monit_basename=monit-5.2.4

+ cd /tmp

+ wgethttp://mmonit.com/monit/dist/monit-5.2.4.tar.gz -O monit-5.2.4.tar.gz

--2013-09-17 17:50:05-- http://mmonit.com/monit/dist/monit-5.2.4.tar.gz

Resolving mmonit.com... 62.109.39.247

Connecting tommonit.com|62.109.39.247|:80... connected.

HTTP request sent, awaiting response... 200OK

Length: 609225 (595K) [application/x-gzip]

Saving to: `monit-5.2.4.tar.gz'

100%[=====================================================================================================================================================>]609,225      116K/s   in 5.3s

2013-09-17 17:50:11 (112 KB/s) -`monit-5.2.4.tar.gz' saved [609225/609225]

monit 每次运行安装脚本都会重新下载、编译、安装,并且默认存放在 /tmp 里。

针对国内的网络、网速,这是一个特烦的过程,建议修改。相应源代码在 nise_bosh的bin/init里。

+ tar xvzf monit-5.2.4.tar.gz

monit-5.2.4/

monit-5.2.4/http/

monit-5.2.4/sendmail.c

+ cd monit-5.2.4

+ ./configure --prefix=/var/vcap/bosh--without-ssl

checking for gcc... gcc

checking whether the C compiler works...yes

config.status: config.h is unchanged

monit has been configured with thefollowing options:

Architecture: LINUX

PAM support: enabled

SSL support: disabled

large files support: enabled

Compiler flags: -g -O2 -Wall -D_REENTRANT

Linker flags: -lpthread -lcrypt-lresolv -lnsl

pid file location: /var/run

+ make -j4

flex -i l.l

gcc -c -DLINUX-DSYSCONFDIR="\"/var/vcap/bosh/etc\"" -I. -I./device-I./http -I./process -I./protocols -g -O2 -Wall -D _REENTRANT  lex.yy.c -o lex.yy.o

lex.yy.c:4818: warning: ?.nput?.defined butnot used

gcc -rdynamic alert.o collector.o control.odaemonize.o env.o event.o file.o gc.o http.o log.o md5.o monitor.o net.oprocess.o sendmail.o sha.o signal.o socket.o spawn.o ssl.o state.o status.outil.o validate.o xmalloc.o xml.o device/device_common.o http/base64.ohttp/cervlet.o http/engine.o http/processor.o process/process_common.oprotocols/apache_status.o protocols/clamav.o protocols/default.oprotocols/dns.o protocols/dwp.o protocols/ftp.o protocols/generic.oprotocols/gps.o protocols/http.o protocols/imap.o protocols/ldap2.oprotocols/ldap3.o protocols/lmtp.o protocols/memcache.o protocols/mysql.oprotocols/nntp.o protocols/ntp3.o protocols/pgsql.o protocols/pop.oprotocols/postfix_policy.o protocols/protocol.o protocols/radius.oprotocols/rdate.o protocols/rsync.o protocols/sip.o protocols/smtp.oprotocols/ssh.o protocols/tns.o device/sysdep_LINUX.o process/sysdep_LINUX.oy.tab.o lex.yy.o  -lfl -lpthread -lcrypt-lresolv -lnsl  -o monit

+ make install

/usr/bin/install -c  -m 755 -d /var/vcap/bosh/bin || exit 1

/usr/bin/install -c  -m 755 -d /var/vcap/bosh/share/man/man1 ||exit 1

/usr/bin/install -c  -m 555 monit /var/vcap/bosh/bin || exit 1

/usr/bin/install -c  -m 444 monit.1/var/vcap/bosh/share/man/man1/monit.1 || exit 1

+ mkdir -p /var/vcap/bosh/etc

+ cat

+ chmod 0700 /var/vcap/bosh/etc/monitrc

+ mkdir -p /var/vcap/monit

+ touch /var/vcap/monit/empty.monitrc

+ echo Done.

Done.

+ '[' '!' -d /sys/fs/cgroup ']'

+ '[' '!' -d /home/cloud/.rbenv ']'

+ . /home/cloud/.profile

++ '[' -n '4.1.5(1)-release' ']'

++ '[' -f /home/cloud/.bashrc ']'

++ . /home/cloud/.bashrc

+++ '[' -z '' ']'

+++ return

++ '[' -d /home/cloud/bin ']'

++ exportPATH=/home/cloud/.rbenv/bin:/home/cloud/.rbenv/bin:/home/cloud/.rbenv/shims:/home/cloud/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

++PATH=/home/cloud/.rbenv/bin:/home/cloud/.rbenv/bin:/home/cloud/.rbenv/shims:/home/cloud/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

+++ rbenv init -

++ eval 'source '\''/home/cloud/.rbenv/libexec/../completions/rbenv.bash'\''

rbenv rehash 2>/dev/null

rbenv() {

typeset command

command="$1"

if[ "$#" -gt 0 ]; then

shift

fi

case "$command" in

rehash|shell)

eval "`rbenv "sh-$command" "$@"`";;

*)

command rbenv "$command""$@";;

esac

}'

+++ source/home/cloud/.rbenv/libexec/../completions/rbenv.bash

++++ complete -F _rbenv rbenv

+++ rbenv rehash

+ grep -q 1.9.3-p448

+ rbenv versions

+ typeset command

+ command=versions

+ '[' 1 -gt 0 ']'

+ shift

+ case "$command" in

+ command rbenv versions

+ rbenv versions

+ rbenv local 1.9.3-p448

+ typeset command

+ command=local

+ '[' 2 -gt 0 ']'

+ shift

+ case "$command" in

+ command rbenv local 1.9.3-p448

+ rbenv local 1.9.3-p448

+ gem install bundler cf --no-rdoc --no-ri

Successfully installed bundler-1.3.5

Successfully installed cf-5.3.0

2 gems installed

+ rbenv rehash

+ typeset command

+ command=rehash

+ '[' 1 -gt 0 ']'

+ shift

+ case "$command" in

++ rbenv sh-rehash

++ typeset command

++ command=sh-rehash

++ '[' 1 -gt 0 ']'

++ shift

++ case "$command" in

++ command rbenv sh-rehash

++ rbenv sh-rehash

+ eval 'hash -r 2>/dev/null || true'

++ hash -r

+ ./local/clone_cf_release.sh

+ ./common/clone_cf_release.sh

+ CF_RELEASE_URL=https://github.com/cloudfoundry/cf-release.git

+ CF_RELEASE_BRANCH=master

+ CF_RELEASE_USE_HEAD=no

++ cut -f1 '-d '

++ rbenv version

+ ruby_version=1.9.3-p448

+ '[' '!' -d cf-release ']'

+ ./local/launch_nise_bosh.sh

++ head -n 1

++ cut -f1 -d /

++ cut -f 6 -d ' '

++ grep 'inet .*global'

++ ip addr

+ NISE_IP_ADDRESS=10.20.8.246

+ NISE_IP_ADDRESS=10.20.8.246

+ ./common/launch_nsie_bosh.sh

+ sed s/192.168.10.10/10.20.8.246/gmanifests/micro.yml

+ '[' '' '!=' '' ']'

+ '[' '' '!=' '' ']'

+ cd nise_bosh

+ bundle install

Using rake (10.0.4)

Using json (1.8.0)

Using bundler (1.3.5)

Your bundle is complete!

Use `bundle show [gemname]` to see where abundled gem is installed.

+ sudo env PATH=/home/cloud/.rbenv/bin:/home/cloud/.rbenv/bin:/home/cloud/.rbenv/shims:/home/cloud/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/gamesbundle exec ./bin/nise-bosh -y ../cf-release ../manifests/deploy.yml micro -n10.20.8.246

The following templates and packages forjob micro will be installed.

#postgres

* common

* postgres

#[16896] INFO: Resolving packagedependencies...

#[16896] INFO: Installing the followingpackages:

#[16896] INFO:  * common

#[16896] INFO:  * postgres

#[16896] INFO: Installing package common

#[16896] INFO: The same version of thepackage is already installed. Skipping

#[16896] INFO: Installing package postgres

#[16896] INFO: The same version of thepackage is already installed. Skipping

Done!

+ sudo envPATH=/home/cloud/.rbenv/bin:/home/cloud/.rbenv/bin:/home/cloud/.rbenv/shims:/home/cloud/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/gamesbundle exec ./bin/nise-bosh --keep-monit-files -y ../cf-release ../manifests/deploy.ymlmicro_ng -n 10.20.8.246

这一步等于

cloud:~/cf_nise_installer/nise_bosh$ sudo env PATH=/home/cloud/.rbenv/bin:/home/cloud/.rbenv/bin:/home/cloud/.rbenv/shims:/home/cloud/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games bundle exec ./bin/nise-bosh --keep-monit-files -y ../cf-release ../manifests/deploy.yml micro_ng -n 10.20.8.246

由于各种原因,你一次安装可能没能成功。那么你从这里下载安装即可,可以节约一点时间。

CSDN有时候会把复制粘贴过来的文字做一些处理,结果把上面命令里的空格去掉了,运行不了。看文章的同学要注意了!

The following templates and packages forjob micro_ng will be installed.

#nats

* common

* nats

* ruby

#health_manager_next

* health_manager_next

* common

* ruby

* syslog_aggregator

#uaa

* common

* ruby

* syslog_aggregator

* uaa

#cloud_controller_ng

* common

* cloud_controller_ng

* nginx

* libpq

* mysqlclient

* sqlite

* ruby

* syslog_aggregator

#gorouter

* common

* golang

* gorouter

* syslog_aggregator

#dea_next

* common

* dea_next

* warden

* rootfs_lucid64

* ruby

* golang

* sqlite

* mysqlclient

* syslog_aggregator

* libpq

* git

* buildpack_cache

* insight_agent

* libyaml

#[17021] INFO: Resolving packagedependencies...

#[17021] INFO: Installing the followingpackages:

#[17021] INFO:  * common

#[17021] INFO:  * libyaml

#[17021] INFO:  * ruby

#[17021] INFO:  * nats

#[17021] INFO:  * health_manager_next

#[17021] INFO:  * syslog_aggregator

#[17021] INFO:  * uaa

#[17021] INFO:  * libpq

#[17021] INFO:  * mysqlclient

#[17021] INFO:  * sqlite

#[17021] INFO:  * cloud_controller_ng

#[17021] INFO:  * nginx

#[17021] INFO:  * golang

#[17021] INFO:  * gorouter

#[17021] INFO:  * buildpack_cache

#[17021] INFO:  * insight_agent

#[17021] INFO:  * dea_next

#[17021] INFO:  * warden

#[17021] INFO:  * rootfs_lucid64

#[17021] INFO:  * git

#[17021] INFO: Installing package common

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package libyaml

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package ruby

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package nats

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing packagehealth_manager_next

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing packagesyslog_aggregator

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package uaa

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package libpq

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing packagemysqlclient

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package sqlite

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing packagecloud_controller_ng

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package nginx

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package golang

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package gorouter

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing packagebuildpack_cache

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing packageinsight_agent

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package dea_next

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing package warden

#[17021] INFO: The same version of thepackage is already installed. Skipping

#[17021] INFO: Installing packagerootfs_lucid64

#[17021] INFO: Running the packaging scriptfor rootfs_lucid64

省略……。

#[17021] INFO: Installing package git

#[17021] INFO: Running the packaging scriptfor git

Done!

+ ./local/postinstall.sh

+ ./common/postinstall.sh

+ set +x

Done!

RESTART your server!

CF target: 'cf target http://api.10.20.8.246.xip.io'#先执行./local/start_processes.sh

CF login : 'cf login --password c1oudc0w admin'

安装后生成目录及其大小

cloud:/$ du -sh var/

2.2G          var/

cloud:/var/vcap$ ls

bosh data  jobs  monit packages  shared  store sys

cloud:/var/vcap$ ls bosh/

bin etc  share  state.yml

cloud:/var/vcap$ ls data/

cloud_controller_ng  dea_next jobs  packages  sys tmp  uaa  warden

cloud:/var/vcap$ ls jobs/

cloud_controller_ng  dea_next gorouter  health_manager_next  nats postgres  uaa

cloud:/var/vcap$ ls monit/

ls: cannot open directory monit/:Permission denied

cloud:/var/vcap$ ls packages/

buildpack_cache      common   git     gorouter             insight_agent  libyaml     nats   postgres        ruby   syslog_aggregator  warden

cloud_controller_ng  dea_next golang  health_manager_next  libpq         mysqlclient  nginx  rootfs_lucid64  sqlite uaa

cloud:/var/vcap$ ls sys

cores log  rsyslog  run

cloud:/var/vcap$ ls shared/

cc-packages cc-resources

cloud:/var/vcap$ ls store/

postgres

安装后,使用问题

安装好后,cf target 并不能使用,主要是 ip地址.xp.io 的形式,我们这边解析不了。根据https://github.com/yudai/cf_nise_installer/issues/9修改

/var/vcap/data/jobs/cloud_controller_ng/14/config/cloud_controller_ng.yml

external_domain:

-ccng.10.20.8.246.xip.io

-"api.10.20.8.246.xip.io"

改为了

external_domain:

- api.foundry

-"api.foundry"

再修改/etc/hosts

(以上是方法一)

或者,修改

common/launch_nsie_bosh.sh

local/install.sh

将NISE_DOMAIN定义为喜闻乐见的 vcap.me

分析代码,直接影响的是

cf_nise_installer/manifests/deploy.yml

(以上是方法二)

在/var/vcap/jobs/cloud_controller_ng/config/cloud_controller_ng.yml里修改,那是治标不治本。

我是在安装的时候就已经设置NISE_DOMAINO为 vcap.me ,详解见我修改过的源代码。

(以上是方法三,推荐)

cloud:~$ curl api.vcap.me/info

有一个细节,这里的"authorization_endpoint":http://uaa.vcap.me才对

如果是http://login.vcap.me以后会报错!

{"name":"vcap","build":"2222","support":"http://support.cloudfoundry.com","version":2,"description":"CloudFoundry sponsored byPivotal","authorization_endpoint":"http://uaa.vcap.me","token_endpoint":"http://uaa.vcap.me","allow_debug":true}

实用命令

启动

cloud:~/cf_nise_installer$ ./local/start_processes.sh

+ ./common/start_processes.sh

+ sudo /var/vcap/bosh/bin/monit

[sudo] password for cloud:

monit: generated unique Monit id857bbdd24325be367d902459bd8e99e5 and stored to '/root/.monit.id'

Starting monit daemon with http interfaceat [127.0.0.1:2822]

+ sleep 5

+ for process in postgres natscloud_controller_ng

+ sudo /var/vcap/bosh/bin/monit startpostgres

+ sleep 30

省略

+ sleep 5

+ for process in nginx_ccng gorouterhealth_manager_next uaa uaa_cf-registrar warden dea_next dir_server

+ sudo /var/vcap/bosh/bin/monit startdir_server

+ sleep 5

+ echo 'Waiting for all processes to start'

Waiting for all processes to start

+ (( i=0 ))

+ (( i < 120 ))

+ grep -E 'running$'

+ tail -n +3

+ sudo /var/vcap/bosh/bin/monit summary

Process 'nats'                      running

Process 'health_manager_next'       running

Process 'uaa'                       running

Process 'uaa_cf-registrar'          running

Process 'cloud_controller_ng'       running

Process 'nginx_ccng'                running

Process 'gorouter'                  running

Process 'warden'                    running

Process 'dea_next'                  running

Process 'postgres'                  running

System 'system_cloud'               running

+ break

查看各组件详解运行状态。

cloud:~/cf_nise_installer$ sudo /var/vcap/bosh/bin/monit status

The Monit daemon 5.2.4 uptime: 2m

Process 'nats'

status                           running

monitoring status                monitored

pid                               9668

parent pid                       1

uptime                           2m

children                         0

memory kilobytes                 18148

memory kilobytes total           18148

memory percent                    0.4%

memory percent total             0.4%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                   Sun Sep 22 11:34:33 2013

Process 'health_manager_next'

status                           running

monitoring status                monitored

pid                              9868

parent pid                       1

uptime                           1m

children                         0

memory kilobytes                 31936

memory kilobytes total           31936

memory percent                   0.7%

memory percent total             0.7%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                    Sun Sep 22 11:34:33 2013

Process 'uaa'

status                           running

monitoring status                monitored

pid                              9901

parent pid                       1

uptime                            1m

children                         0

memory kilobytes                 554776

memory kilobytes total           554776

memory percent                   13.6%

memory percent total             13.6%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                   Sun Sep 22 11:34:33 2013

Process 'uaa_cf-registrar'

status                           running

monitoring status                monitored

pid                              9950

parent pid                       1

uptime                           0m

children                         0

memory kilobytes                 26508

memory kilobytes total           26508

memory percent                   0.6%

memory percent total             0.6%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                   Sun Sep 22 11:34:33 2013

Process 'cloud_controller_ng'

status                            running

monitoring status                monitored

pid                              9683

parent pid                       1

uptime                           1m

children                         0

memory kilobytes                  70228

memory kilobytes total           70228

memory percent                   1.7%

memory percent total             1.7%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                    Sun Sep 22 11:34:33 2013

Process 'cloud_controller_jobs'

status                           not monitored

monitoring status                not monitored

data collected                   Sun Sep 22 11:34:33 2013

Process 'nginx_ccng'

status                           running

monitoring status                monitored

pid                              9742

parent pid                       1

uptime                           1m

children                         1

memory kilobytes                 1004

memory kilobytes total           5292

memory percent                   0.0%

memory percent total             0.1%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                    Sun Sep 22 11:34:33 2013

Process 'gorouter'

status                           running

monitoring status                monitored

pid                              9746

parent pid                       1

uptime                            1m

children                         0

memory kilobytes                 6120

memory kilobytes total           6120

memory percent                   0.1%

memory percent total             0.1%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                   Sun Sep 22 11:34:33 2013

Process 'warden'

status                           running

monitoring status                monitored

pid                               9962

parent pid                       1

uptime                           0m

children                         0

memory kilobytes                 29400

memory kilobytes total           29400

memory percent                    0.7%

memory percent total             0.7%

cpupercent                       0.0%

cpupercent total                 0.0%

port response time               0.001s to 127.0.0.1:2345/ [HTTP via TCP]

data collected                    Sun Sep 22 11:34:33 2013

Process 'dea_next'

status                           running

monitoring status                monitored

pid                              10002

parent pid                       1

uptime                           0m

children                         0

memory kilobytes                 36712

memory kilobytes total           36712

memory percent                   0.9%

memory percent total             0.9%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                   Sun Sep 22 11:34:33 2013

Process 'dir_server'

status                           running

monitoring status                monitored

pid                              10124

parent pid                       1

uptime                           0m

children                         0

memory kilobytes                 4364

memory kilobytes total           4364

memory percent                   0.1%

memory percent total              0.1%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                   Sun Sep 22 11:34:33 2013

Process 'postgres'

status                           running

monitoring status                 monitored

pid                              9640

parent pid                       1

uptime                           2m

children                         17

memory kilobytes                 12204

memory kilobytes total           75232

memory percent                   0.3%

memory percent total             1.8%

cpupercent                       0.0%

cpupercent total                 0.0%

data collected                   Sun Sep 22 11:34:33 2013

System 'system_cloud'

status                           running

monitoring status                monitored

load average                     [1.48] [0.49] [0.20]

cpu                              0.1%us 0.4%sy 3.0%wa

memory usage                     1129072 kB [27.8%]

swapusage                        0 kB [0.0%]

data collected                   Sun Sep 22 11:34:33 2013

和上面一条命令功能一样,不过只显示结果。(推荐)

cloud:~/cf_nise_installer$ sudo /var/vcap/bosh/bin/monit summary

The Monit daemon 5.2.4 uptime: 3m

Process 'nats'                      running

Process 'health_manager_next'       running

Process 'uaa'                       running

Process 'uaa_cf-registrar'          running

Process 'cloud_controller_ng'       running

Process 'cloud_controller_jobs'     not monitored

Process 'nginx_ccng'                running

Process 'gorouter'                  running

Process 'warden'                    running

Process 'dea_next'                  running

Process 'dir_server'                running

Process 'postgres'                  running

System 'system_cloud'               running

启动所有。使用的是 monit ,详细解释看 help 或网上查找。

cloud:~$ sudo /var/vcap/bosh/bin/monit start all

'nats' start:/var/vcap/jobs/nats/bin/nats_ctl

'health_manager_next' start:/var/vcap/jobs/health_manager_next/bin/health_manager_next_ctl

'uaa' start: /var/vcap/jobs/uaa/bin/uaa_ctl

'uaa_cf-registrar' start:/var/vcap/jobs/uaa/bin/cf-registrar_ctl

'cloud_controller_ng' start:/var/vcap/jobs/cloud_controller_ng/bin/cloud_controller_ng_ctl

'cloud_controller_jobs' start:/var/vcap/jobs/cloud_controller_ng/bin/cloud_controller_jobs_ctl

'nginx_ccng' start:/var/vcap/jobs/cloud_controller_ng/bin/nginx_ctl

'gorouter' start:/var/vcap/jobs/gorouter/bin/gorouter_ctl

'warden' start:/var/vcap/jobs/dea_next/bin/warden_ctl

'dea_next' start:/var/vcap/jobs/dea_next/bin/dea_ctl

'dir_server' start:/var/vcap/jobs/dea_next/bin/dir_server_ctl

'postgres' start:/var/vcap/jobs/postgres/bin/postgres_ctl

成功案例

cloud:~/cf_nise_installer$ cf target http://api.vcap.me

Setting target to http://api.vcap.me... OK

cloud:~/cf_nise_installer$ cf login --password c1oudc0w admin

target: http://api.vcap.me

Authenticating... OK

There are no spaces. You may want to createone with create-space.... OK

cloud:~/hello$ cf create-org adminorg

Creating organization adminorg... OK

Switching to organization adminorg... OK

There are no spaces. You may want to createone with create-space.... OK

Target Information (where will apps bepushed):

CFinstance: http://api.vcap.me (API version: 2)

user: admin

target app space: N/A (org: adminorg)

cloud:~/hello$ cf create-space adminspace adminorg

Switching to organization adminorg... OK

Creating space adminspace... OK

Adding you as a manager... OK

Adding you as a developer... OK

Space created!

cf switch-space adminspace    # targets new space

cloud:~/hello$ cf target --space adminspace

Switching to space adminspace... OK

Target Information (where will apps bepushed):

CFinstance: http://api.vcap.me (API version: 2)

user: admin

target app space: adminspace (org: adminorg)

cloud:~/hello$ cf push

Name> hellofromsinatra

Instances> 1

1: 128M

2: 256M

3: 512M

4: 1G

Memory Limit> 256M

Creating hellofromsinatra... OK

1: hellofromsinatra

2: none

Subdomain> hellofromsinatra

1: 10.20.8.246.xip.io

2: vcap.me

3: none

Domain> 2

Creating route hellofromsinatra.vcap.me...OK

Binding hellofromsinatra.vcap.me tohellofromsinatra... OK

Create services for application?> n

Save configuration?> y

Saving to manifest.yml... OK

Uploading hellofromsinatra... OK

Preparing to start hellofromsinatra...FAILED

CFoundry::BadResponse: 502: 502 BadGateway: Registered endpoint failed to handle the request.

CloudFoundry v2对于我们简单的用Sinatra写的hello world是运行不通的。因为CF v2必需有 Gemfile。

cloud@cloud:~/hello$ ls

app.rb manifest.yml

cloud@cloud:~/hello$ cat manifest.yml

---

applications:

- name: hellofromsinatra

memory: 256M

instances: 1

host: hellofromsinatra

domain: vcap.me

path: .

加 -t --debug 可以查看更多报错信息,以下有省略。

cloud:~/hello$ cf push -t --debug

Using manifest file manifest.yml

>>>

REQUEST: GET http://api.vcap.me/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/apps?q=name%3Ahellofromsinatra&inline-relations-depth=1

REQUEST_HEADERS:

Accept : application/json

Authorization : [PRIVATE DATA HIDDEN]

Content-Length : 0

RESPONSE: [200]

RESPONSE_HEADERS:

content-length : 3875

content-type : application/json;charset=utf-8

date : Sun, 22 Sep 2013 07:24:34 GMT

server : nginx

x-content-type-options : nosniff

x-vcap-request-id : 94ddf408-9d39-40f4-8f0c-df5aa9fd22af

RESPONSE_BODY:

{

"total_results": 1,

"total_pages": 1,

"prev_url": null,

"next_url": null,

"resources": [

{

"metadata": {

"guid": "b553ad88-7a39-474c-831a-b4a67b276921",

"url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921",

"created_at": "2013-09-22T14:28:06+08:00",

"updated_at": "2013-09-22T14:43:31+08:00"

},

"entity": {

"name": "hellofromsinatra",

"production": false,

"space_guid":"6a71bd43-b49f-4961-8f94-e0ce204e6824",

"stack_guid":"71f99b10-f6c7-40f2-8089-41f6160ec865",

"buildpack": null,

"detected_buildpack": null,

"environment_json": {

},

"memory": 256,

"instances": 1,

"disk_quota": 1024,

"state": "STARTED",

"version": "35afbeaf-f2d9-4985-bfbf-3ab764e611c4",

"command": null,

"console": true,

"debug": null,

"staging_task_id":"cc0de60da59b9a371e6059a05107d570",

"space_url": "/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824",

"space": {

"metadata": {

"guid": "6a71bd43-b49f-4961-8f94-e0ce204e6824",

"url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824",

"created_at": "2013-09-22T14:24:24+08:00",

"updated_at": null

},

"entity": {

"name": "adminspace",

"organization_guid":"d4a4f441-b4aa-4f43-838f-d822b0148084",

"events_url": "/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/events"

}

},

"stack_url":"/v2/stacks/71f99b10-f6c7-40f2-8089-41f6160ec865",

"stack": {

"metadata": {

"guid": "71f99b10-f6c7-40f2-8089-41f6160ec865",

"url": "/v2/stacks/71f99b10-f6c7-40f2-8089-41f6160ec865",

"created_at": "2013-09-22T11:32:53+08:00",

"updated_at": "2013-09-22T12:57:33+08:00"

},

"entity": {

"name": "lucid64",

"description": "Ubuntu 10.04"

}

},

"service_bindings_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/service_bindings",

"service_bindings": [

],

"routes_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/routes",

"routes": [

{

"metadata": {

"guid":"17a7e226-4336-4d5f-a5a7-f53d7191dca2",

"url":"/v2/routes/17a7e226-4336-4d5f-a5a7-f53d7191dca2",

"created_at":"2013-09-22T14:28:21+08:00",

"updated_at": null

},

"entity": {

"host":"hellofromsinatra",

"domain_guid":"8bb6fc22-15aa-4c55-af6e-be7d3efe44be",

"space_guid":"6a71bd43-b49f-4961-8f94-e0ce204e6824",

"domain_url":"/v2/domains/8bb6fc22-15aa-4c55-af6e-be7d3efe44be",

"space_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824",

"apps_url":"/v2/routes/17a7e226-4336-4d5f-a5a7-f53d7191dca2/apps"

}

}

],

"events_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/events",

"events": [

]

}

}

]

}

<<<

>>>

REQUEST: GEThttp://api.vcap.me/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/apps?q=name%3Ahellofromsinatra&inline-relations-depth=1

REQUEST_HEADERS:

Accept : application/json

Authorization : [PRIVATE DATA HIDDEN]

Content-Length : 0

RESPONSE: [200]

RESPONSE_HEADERS:

content-length : 3875

content-type : application/json;charset=utf-8

date : Sun, 22 Sep 2013 07:24:34 GMT

server : nginx

x-content-type-options : nosniff

x-vcap-request-id : 580f06d3-9b3e-441e-a667-3ed9bd87357a

RESPONSE_BODY:

{

"total_results": 1,

"total_pages": 1,

"prev_url": null,

"next_url": null,

"resources": [

{

"metadata": {

"guid": "b553ad88-7a39-474c-831a-b4a67b276921",

"url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921",

"created_at": "2013-09-22T14:28:06+08:00",

"updated_at": "2013-09-22T14:43:31+08:00"

},

"entity": {

"name": "hellofromsinatra",

"production": false,

"space_guid":"6a71bd43-b49f-4961-8f94-e0ce204e6824",

"stack_guid":"71f99b10-f6c7-40f2-8089-41f6160ec865",

"buildpack": null,

"detected_buildpack": null,

"environment_json": {

},

"memory": 256,

"instances": 1,

"disk_quota": 1024,

"state": "STARTED",

"version": "35afbeaf-f2d9-4985-bfbf-3ab764e611c4",

"command": null,

"console": true,

"debug": null,

"staging_task_id":"cc0de60da59b9a371e6059a05107d570",

"space_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824",

"space": {

"metadata": {

"guid": "6a71bd43-b49f-4961-8f94-e0ce204e6824",

"url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824",

"created_at": "2013-09-22T14:24:24+08:00",

"updated_at": null

},

"entity": {

"name": "adminspace",

"organization_guid":"d4a4f441-b4aa-4f43-838f-d822b0148084",

"organization_url":"/v2/organizations/d4a4f441-b4aa-4f43-838f-d822b0148084",

"developers_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/developers",

"managers_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/managers",

"auditors_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/auditors",

"apps_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/apps",

"domains_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/domains",

"service_instances_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/service_instances",

"app_events_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/app_events",

"events_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824/events"

}

},

"stack_url": "/v2/stacks/71f99b10-f6c7-40f2-8089-41f6160ec865",

"stack": {

"metadata": {

"guid": "71f99b10-f6c7-40f2-8089-41f6160ec865",

"url":"/v2/stacks/71f99b10-f6c7-40f2-8089-41f6160ec865",

"created_at": "2013-09-22T11:32:53+08:00",

"updated_at": "2013-09-22T12:57:33+08:00"

},

"entity": {

"name": "lucid64",

"description": "Ubuntu 10.04"

}

},

"service_bindings_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/service_bindings",

"service_bindings": [

],

"routes_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/routes",

"routes": [

{

"metadata": {

"guid":"17a7e226-4336-4d5f-a5a7-f53d7191dca2",

"url":"/v2/routes/17a7e226-4336-4d5f-a5a7-f53d7191dca2",

"created_at":"2013-09-22T14:28:21+08:00",

"updated_at": null

},

"entity": {

"host":"hellofromsinatra",

"domain_guid":"8bb6fc22-15aa-4c55-af6e-be7d3efe44be",

"space_guid":"6a71bd43-b49f-4961-8f94-e0ce204e6824",

"domain_url":"/v2/domains/8bb6fc22-15aa-4c55-af6e-be7d3efe44be",

"space_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824",

"apps_url":"/v2/routes/17a7e226-4336-4d5f-a5a7-f53d7191dca2/apps"

}

}

],

"events_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/events",

"events": [

]

}

}

]

}

<<<

Uploading hellofromsinatra.  >>>

REQUEST: PUThttp://api.vcap.me/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/bits

REQUEST_HEADERS:

Authorization : [PRIVATE DATA HIDDEN]

REQUEST_BODY:{:resources=>"[]", :application=>#<UploadIO:0x00000002310950@content_type="application/zip",@original_filename="b553ad88-7a39-474c-831a-b4a67b276921.zip",@local_path="/tmp/b553ad88-7a39-474c-831a-b4a67b276921.zip",@io=#<File:/tmp/b553ad88-7a39-474c-831a-b4a67b276921.zip>, @opts={}>}

RESPONSE: [201]

RESPONSE_HEADERS:

content-length : 0

content-type : application/json;charset=utf-8

date : Sun, 22 Sep 2013 07:24:34 GMT

server : nginx

x-content-type-options : nosniff

x-vcap-request-id : 7350b93f-fa63-48c9-a6d8-4c964e6515f3

RESPONSE_BODY:

<<<                                                                                                                                                                                        ... OK

Stopping hellofromsinatra>>>

REQUEST: PUT http://api.vcap.me/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921

REQUEST_HEADERS:

Authorization : [PRIVATE DATA HIDDEN]

Content-Length : 19

Content-Type : application/json

REQUEST_BODY:{"state":"STOPPED"}

. RESPONSE: [201]

RESPONSE_HEADERS:

content-length : 1148

content-type : application/json;charset=utf-8

date : Sun, 22 Sep 2013 07:24:34 GMT

server : nginx

x-content-type-options : nosniff

x-vcap-request-id : 5707fb90-8d84-4a02-81ef-f4c05e5707ab

RESPONSE_BODY:

{

"metadata": {

"guid": "b553ad88-7a39-474c-831a-b4a67b276921",

"url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921",

"created_at": "2013-09-22T14:28:06+08:00",

"updated_at": "2013-09-22T15:24:34+08:00"

},

"entity": {

"name": "hellofromsinatra",

"production": false,

"space_guid":"6a71bd43-b49f-4961-8f94-e0ce204e6824",

"stack_guid":"71f99b10-f6c7-40f2-8089-41f6160ec865",

"buildpack": null,

"detected_buildpack": null,

"environment_json": {

},

"memory": 256,

"instances": 1,

"disk_quota": 1024,

"state": "STOPPED",

"version": "35afbeaf-f2d9-4985-bfbf-3ab764e611c4",

"command": null,

"console": true,

"debug": null,

"staging_task_id":"cc0de60da59b9a371e6059a05107d570",

"space_url": "/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824",

"stack_url":"/v2/stacks/71f99b10-f6c7-40f2-8089-41f6160ec865",

"service_bindings_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/service_bindings",

"routes_url": "/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/routes",

"events_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/events"

}

}

<<<                                                                                                                                                                                        ... OK

>>>

REQUEST: PUThttp://api.vcap.me/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921

REQUEST_HEADERS:

Authorization : [PRIVATE DATA HIDDEN]

Content-Length : 2

Content-Type : application/json

REQUEST_BODY: {}

RESPONSE: [201]

RESPONSE_HEADERS:

content-length : 1148

content-type : application/json;charset=utf-8

date : Sun, 22 Sep 2013 07:24:34 GMT

server : nginx

x-content-type-options : nosniff

x-vcap-request-id : 246cfef1-2d90-4f60-adb1-aae4eb765107

RESPONSE_BODY:

{

"metadata": {

"guid": "b553ad88-7a39-474c-831a-b4a67b276921",

"url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921",

"created_at": "2013-09-22T14:28:06+08:00",

"updated_at": "2013-09-22T15:24:34+08:00"

},

"entity": {

"name": "hellofromsinatra",

"production": false,

"space_guid":"6a71bd43-b49f-4961-8f94-e0ce204e6824",

"stack_guid":"71f99b10-f6c7-40f2-8089-41f6160ec865",

"buildpack": null,

"detected_buildpack": null,

"environment_json": {

},

"memory": 256,

"instances": 1,

"disk_quota": 1024,

"state": "STOPPED",

"version": "35afbeaf-f2d9-4985-bfbf-3ab764e611c4",

"command": null,

"console": true,

"debug": null,

"staging_task_id": "cc0de60da59b9a371e6059a05107d570",

"space_url":"/v2/spaces/6a71bd43-b49f-4961-8f94-e0ce204e6824",

"stack_url":"/v2/stacks/71f99b10-f6c7-40f2-8089-41f6160ec865",

"service_bindings_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/service_bindings",

"routes_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/routes",

"events_url":"/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921/events"

}

}

<<<

Preparing to starthellofromsinatra>>>

REQUEST: PUThttp://api.vcap.me/v2/apps/b553ad88-7a39-474c-831a-b4a67b276921

REQUEST_HEADERS:

Authorization : [PRIVATE DATA HIDDEN]

Content-Length : 34

Content-Type : application/json

REQUEST_BODY:{"console":true,"state":"STARTED"}

RESPONSE: [502]

RESPONSE_HEADERS:

content-type : text/plain; charset=utf-8

date : Sun, 22 Sep 2013 07:25:34 GMT

transfer-encoding : chunked

x-cf-routererror : endpoint_failure

RESPONSE_BODY:

502 Bad Gateway: Registered endpoint failedto handle the request.

<<<                                                                                                                                                                                        ...FAILED

CFoundry::BadResponse: 502: 502 BadGateway: Registered endpoint failed to handle the request.

/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/cfoundry-4.3.5.rc1/lib/cfoundry/baseclient.rb:180:in`handle_error_response': 502: 502 Bad Gateway: Registered endpoint failed tohandle the request. (CFoundry::BadResponse)

from/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/cfoundry-4.3.5.rc1/lib/cfoundry/baseclient.rb:148:in`handle_response'

from/home/cloud/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/cfoundry-4.3.5.rc1/lib/cfoundry/baseclient.rb:89:in`request'

from/home/cloud/.rbenv/versions/1.9.3-p448/bin/cf:23:in `load'

from/home/cloud/.rbenv/versions/1.9.3-p448/bin/cf:23:in `<main>'

用户 注册

cloud:~$ cf register

Email> lizhka@example.com

Password> ********

Confirm Password> ********

Your password strength is: good

Creating user... OK

target: http://api.vcap.me

Authenticating... OK

There are no organizations. You may want tocreate one with create-org.... OK

修改密码

cloud@cloud:~$ cf passwd

Current Password> ********

New Password> ******

Verify Password> ******

Your password strength is: good

Changing password... OK

启动解析

./local/start_processes.sh

for process in \

postgres \

nats \

cloud_controller_ng;

do

sudo /var/vcap/bosh/bin/monit start $process

sleep 30

done;

for process in \

nginx_ccng \

gorouter \

health_manager_next \

uaa \

uaa_cf-registrar \

warden \

dea_next \

dir_server;

do

sudo /var/vcap/bosh/bin/monit start $process

sleep 5

done

共11项

上面提到过,其实是用 monit 实现的。

monit是如何使用的?

cloud:/var/vcap/bosh/bin$ ./monit -h

Usage: monit [options] {arguments}

Options are as follows:

-cfile       Use this control file

-dn          Run as a daemon once per nseconds

-gname       Set group name for start,stop, restart, monitor and unmonitor

-llogfile    Print log information to thisfile

-ppidfile    Use this lock file in daemonmode

-sstatefile  Set the file monit shouldwrite state information to

-I           Do not run in background(needed for run from init)

-t           Run syntax check for the control file

-v           Verbose mode, work noisy (diagnostic output)

-H[filename] Print SHA1 and MD5 hashes of the file or of stdin if the

filename is omited; monit willexit afterwards

-V           Print version number and patchlevel

-h           Print this text

Optional action arguments for non-daemonmode are as follows:

 start all           - Start all services

start name          - Only start the named service

 stop all            - Stop all services

stopname           - Only stop the namedservice

 restart all         - Stop and start all services

restart name        - Only restart the named service

 monitor all         - Enable monitoring of all services

monitor name        - Only enable monitoring of the namedservice

 unmonitor all       - Disable monitoring of all services

unmonitor name      - Only disable monitoring of the namedservice

 reload              - Reinitialize monit

status              - Print full status informationfor each service

 summary             - Print short status informationfor each service

quit                - Kill monit daemon process

 validate            - Check all services and start ifnot running

procmatch <pattern> - Test processmatching pattern

进程监控

cloud:/var/vcap/sys/log/cloud_controller_ng#netstat -nlpt

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp       0      0 127.0.0.1:2822          0.0.0.0:*               LISTEN     1230/monit

错误处理:

cc_ng.log里记录

rake aborted!

cannot load such file -- active_record/base

/var/vcap/data/packages/cloud_controller_ng/24/cloud_controller_ng/config/initializers/active_record.rb:1:in`require'

/var/vcap/data/packages/cloud_controller_ng/24/cloud_controller_ng/config/initializers/active_record.rb:1:in`<top (required)>'

/var/vcap/data/packages/cloud_controller_ng/24/cloud_controller_ng/lib/cloud_controller/config.rb:183:in`require'

/var/vcap/data/packages/cloud_controller_ng/24/cloud_controller_ng/lib/cloud_controller/config.rb:183:in`block in run_initializers'

/var/vcap/data/packages/cloud_controller_ng/24/cloud_controller_ng/lib/cloud_controller/config.rb:182:in`each'

/var/vcap/data/packages/cloud_controller_ng/24/cloud_controller_ng/lib/cloud_controller/config.rb:182:in`run_initializers'

/var/vcap/data/packages/cloud_controller_ng/24/cloud_controller_ng/Rakefile:167:in`run_initializers'

/var/vcap/data/packages/cloud_controller_ng/24/cloud_controller_ng/Rakefile:102:in`db'

/var/vcap/data/packages/cloud_controller_ng/24/cloud_controller_ng/Rakefile:109:in`block (2 levels) in <top (required)>'

Tasks: TOP => db:migrate

(See full trace by running task with--trace)

查看该文件

1require "active_record/base"

2require "delayed_job_active_record"

3

4module CCInitializers

5   def self.active_record(_)

6     # ActiveRecord uses a tablenamed schema_migrations.  So does Sequel.

7     # However, the schemas ofthose tables are different, and the only apparent way to

8     # resolve the conflict hereis to have ActiveRecord use a prefix to force a different table.

9    ActiveRecord::Base.table_name_prefix = "ar_"

10    Delayed::Job.set_delayed_job_table_name

11   end

12en

不应该存在此文件的!做删除处理……。其实这是我升级过程中遇到的一个问题,因为前一版本有这文件,而后一版本不再需要了。

个人经验:不要随便删除目录或文件(删除内容可以),注意查看文件、目录的权限!

使用cf_nise_installer安装使用CloudFoundry笔记相关推荐

  1. 使用cf_nise_installer安装CloudFoundry出现not monitored问题

    使用github.com/yudai/cf_nise_installer安装cf v2的版本,安装过程一切正常,但是启动的时候,出现: warden not monitored dea_next no ...

  2. freebsd mysql 安装_Freebsd中mysql安装及使用笔记-阿里云开发者社区

    Freebsd中mysql安装及使用笔记 x3d 2009-07-31 662浏览量 简介: 1.安装 一开始连mysql的软件包在freebsd中叫什么都不知道: 依稀属于databases类,先到 ...

  3. CENTOS7.2使用RDO方式安装OpenStack Mitaka笔记

    CENTOS7.2使用RDO方式安装OpenStack Mitaka笔记 1.配置/etc/hosts 192.168.13.108 openstack 2.配置OpenStack Mitaka安装源 ...

  4. docker 安装git_docker随手笔记第十二节 jenkins+docker+nginx+纯静态页面配置

    docker随手笔记第一节 docker概念及安装 docker随手笔记第二节 docker常用命令解析 docker随手笔记第三节 docker构建java镜像 docker随手笔记第四节 dock ...

  5. Linux系统使用--Ubuntu 16.04 安装为知笔记

    一.前言 为了测试MetaWebBlog协议在为知笔记的使用情况,需要安装为知笔记. 二.准备工具和环境搭建 2.1 准备工具 安装Linux版的为知笔记需要准备很多必要的工具,现列表如下: 1. Q ...

  6. V-Rep虚拟机器人实验平台在Ubuntu18.04LTS安装与使用笔记

    V-Rep在Ubuntu18.04LTS安装与使用笔记 V-Rep官网链接如下,一直很困惑有两个地址,打开还字体不一样... 1. http://www.v-rep.eu 2. http://www. ...

  7. RedHat EL5 x86-64上命令行安装Oracle 10g笔记

    RedHat EL5 x86-64上命令行安装Oracle 10g笔记 声明:本文中所描述的系统命令,未经特殊标示,均为"#"代表root权限,"$"代表ora ...

  8. Spark下载和安装(学习笔记)

    夫君子之行,静以修身,俭以养德,非淡泊无以明志,非宁静无以致远. 夫学须静也,才须学也,非学无以广才,非志无以成学.淫慢则不能励精,险躁则不能冶性. 年与时驰,意与日去,遂成枯落,多不接世,悲守穷庐, ...

  9. 在 Ubuntu 16.04 中 安装为知笔记

    个人博客原文:在 Ubuntu 16.04 中 安装为知笔记 摘要:本文讲述如何在 Ubuntu 16.04 中编译安装为知笔记. 安装依赖的软件 git sudo apt-get install g ...

最新文章

  1. jwt 私钥_JSON Web Token (JWT)生成Token及解密实战。
  2. 逻辑回归的相关问题及java实现
  3. Quartz.NET 架构与源代码分析系列 part 2 :Job 作业
  4. Android获取当前位置,推荐使用百度地图SDK获取位置
  5. CakePHP 2.10.17 发布,PHP 快速开发框架
  6. django orm插入一条_如何通过django的ORM远程发布文章?
  7. mysql 从库 问题_一篇文章帮你解决Mysql 中主从库不同步的问题
  8. HttpUtility.UrlEncode 方法 (String) 对 URL 字符串进行编码 NET Framework 4.6 and 4.5
  9. mysql 报错1005_MysqlERROR 1005错误处理
  10. 这样设置路由,99.9%的黑客都攻不破
  11. linux vsftpd 550 create directory operation failed解决方法
  12. java中result方法_java.sql.resultSet接口中有很多方法的实现
  13. [个人笔记]C# 基础语法
  14. C语言题目:输出三角形面积和周长 (15 分)
  15. 计算机画图工具介绍PPT,怎么用思维导图制作PPT课件,迅捷画图软件讲解
  16. 浅谈FLUKE光缆认证?何为CFP?何为OFP?
  17. linux开发员用游戏本吗,为什么很多程序员使用thinkpad而不是同等价位的游戏本呢?...
  18. c语言如何乘分数,C语言分数相乘程序简化问题。
  19. 关于计算机春联PPT,春节祝福专题-春联.ppt
  20. maya 白天室内灯光_maya室内灯光问题

热门文章

  1. 微信公众号认证开具深圳电子普通发票查询方法。
  2. 。iBm T43 程序组 IBM软件详解
  3. 计算机里多了一个本地磁盘分区,win8系统压缩磁盘新建分区(多分区一个本地磁盘)教程...
  4. 银联卡现金转账类业务规则
  5. 10 款实用的 CSS 开发助手推荐
  6. 王小波《沉默的大多数》
  7. 14本人工智能技术入门书籍下载
  8. [Luogu P3147] [BZOJ 4576] [USACO16OPEN]262144
  9. 实现文件中名词的统计计数_SOLIDWORKS PDM系统中如何实现PDF文件批量签章?
  10. 关于高德地图定位跑到非洲的情况。