Cloud Foundry V2 的文章目录在 Cloud Foundry V2 相关文章目录
我会不定期的做一些文章的更改,如有不便之处还要谅解。
在部署中遇到了什么问题可以在下面留言。
本博客的所有yml stemcell 和 release 都能在百度云上下载 http://pan.baidu.com/s/1pJHkPYV
如果你有对配置文件或者CF运维有什么更好的想法请联系我,我非常需要你的帮助
1、将stemcell上传至 micro bosh
登录到 micro bosh 上 默认密码为 admin
bosh target https://192.168.1.203:25555 Target set to `micro' Your username: admin Enter password: ***** Logged in as `admin'
上传 stemcell
bosh upload stemcell ~/stemcells/bosh-stemcell-2427-vsphere-esxi-ubuntu.tgz
Verifying stemcell...
File exists and readable OK
Verifying tarball...
Read tarball OK
Manifest exists OK
Stemcell image file OK
Stemcell properties OK
Stemcell info
-------------
Name: bosh-vsphere-esxi-ubuntu
Version: 2427
Checking if stemcell already exists...
No
Uploading stemcell...
bosh-stemcell: 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 385.9MB 18.2MB/s Time: 00:00:21
Director task 1
Started update stemcell
Started update stemcell > Extracting stemcell archive. Done (00:00:04)
Started update stemcell > Verifying stemcell manifest. Done (00:00:01)
Started update stemcell > Checking if this stemcell already exists. Done (00:00:00)
Started update stemcell > Uploading stemcell bosh-vsphere-esxi-ubuntu/2427 to the cloud. Done (00:02:25)
Started update stemcell > Save stemcell bosh-vsphere-esxi-ubuntu/2427 (sc-f487c612-1863-46a8-8cf5-ab0447f4f4f9). Done (00:00:00)
Done update stemcell (00:02:30)
Task 1 done
Started 2014-10-15 06:43:52 UTC
Finished 2014-10-15 06:46:22 UTC
Duration 00:02:30
Stemcell uploaded and created.
2、上传bosh的release至micro bosh
git clone https://github.com/cloudfoundry/bosh.git bosh upload release ~/bosh/release/releases/bosh-109.yml
Copying packages ---------------- nginx (3) SKIP genisoimage (3) SKIP powerdns (3) SKIP blobstore (33) SKIP ruby (7) SKIP mysql (1) SKIP nats (3) SKIP common (2) SKIP director (40) SKIP redis (3) SKIP registry (29) SKIP libpq (2) SKIP postgres (2) SKIP health_monitor (34) SKIP Copying jobs ------------ powerdns (4) FOUND LOCAL blobstore (4) FOUND LOCAL nats (5) FOUND LOCAL director (15) FOUND LOCAL redis (3) FOUND LOCAL registry (2) FOUND LOCAL postgres (6) FOUND LOCAL health_monitor (6) FOUND LOCAL Building tarball ---------------- Generated /tmp/d20141016-21679-l2zk07/d20141016-21679-11esjot/release.tgz Release size: 23.9K Verifying release... File exists and readable OK 。。。。。。。。。。。。。。。。 Monit file for 'health_monitor' OK Release info ------------ Name: bosh Version: 42 Packages - nginx (3) - genisoimage (3) - powerdns (3) - blobstore (33) - ruby (7) - mysql (1) - nats (3) - common (2) - director (40) - redis (3) - registry (29) - libpq (2) - postgres (2) - health_monitor (34) Jobs - powerdns (4) - blobstore (4) - nats (5) - director (15) - redis (3) - registry (2) - postgres (6) - health_monitor (6)
在执行这个命令的时候由于网络不稳定导致ruby的httpclient异常一直执行中断,所以写了一个脚本只要中断了会不停的去下载,适合在深更半夜里开,替你加班。
创建一个shell脚本
bosh deployment ~/deployments/bosh.yml Deployment set to `/home/base/deployments/bosh.yml'
vi download.sh
输入以下内容
while true
do
bosh upload release ~/bosh/release/releases/bosh-109.yml
if [ $? -eq 0 ]
then
break
fi
done
运行脚本
sh download.sh
3、编写 bosh 配置文件
查看stemcells名字和版本。
bosh stemcells +--------------------------+---------+-----------------------------------------+ | Name | Version | CID | +--------------------------+---------+-----------------------------------------+ | bosh-vsphere-esxi-ubuntu | 2427 | sc-f487c612-1863-46a8-8cf5-ab0447f4f4f9 | +--------------------------+---------+-----------------------------------------+ (*) Currently in-use Stemcells total: 1
查看releases的名字和版本
bosh releases +------+----------+-------------+ | Name | Versions | Commit Hash | +------+----------+-------------+ | bosh | 109* | 01851c1c+ | +------+----------+-------------+ (*) Currently deployed (+) Uncommitted changes Releases total: 1
查看bosh状态
bosh status
Config
/home/chance/.bosh_config
Director
Name micro
URL https://192.168.1.100:25555
Version 1.2427.0 (release:921db96c bosh:921db96c)
User admin
UUID f8a07fe6-d4a7-4dfc-815f-26b1633a76d7
CPI vsphere
dns enabled (domain_name: microbosh)
compiled_package_cache disabled
snapshots disabled
Deployment
Manifest /home/chance/deployments/bosh.yml
编写bosh配置文件
touch bosh.yml vi bosh yml
---
name: bosh
# 此处uuid就是bosh status里的UUID
director_uuid: 43f500b6-c68f-46c9-b390-711b4cb9dcec
release:
name: bosh
version: 109
compilation:
workers: 3
network: default
reuse_compilation_vms: true
cloud_properties:
ram: 2024
disk: 4048
cpu: 4
update:
canaries: 1
canary_watch_time: 3000-120000
update_watch_time: 3000-120000
max_in_flight: 4
networks:
- name: default
subnets:
- reserved:
- 192.168.1.10 - 192.168.1.19
static:
- 192.168.1.20 - 192.168.1.30
range: 192.168.1.0/24
gateway: 192.168.1.1
dns:
- 218.2.135.1
- 61.147.37.1
cloud_properties:
name: VM Network
resource_pools:
- name: small
stemcell:
name: bosh-vsphere-esxi-ubuntu
version: 2427
network: default
size: 7
cloud_properties:
ram: 1024
disk: 20480
cpu: 1
- name: director
stemcell:
name: bosh-vsphere-esxi-ubuntu
version: 2427
network: default
size: 1
cloud_properties:
ram: 1024
disk: 20480
cpu: 2
jobs:
- name: nats
template: nats
instances: 1
resource_pool: small
networks:
- name: default
static_ips:
- 192.168.1.20
- name: postgres
template: postgres
instances: 1
resource_pool: small
persistent_disk: 2048
networks:
- name: default
static_ips:
- 192.168.1.21
- name: redis
template: redis
instances: 1
resource_pool: small
networks:
- name: default
static_ips:
- 192.168.1.22
- name: powerdns
template: powerdns
instances: 1
resource_pool: small
networks:
- name: default
static_ips:
- 192.168.1.26
- name: director
template: director
instances: 1
resource_pool: director
persistent_disk: 2048
networks:
- name: default
static_ips:
- 192.168.1.23
- name: blobstore
template: blobstore
instances: 1
resource_pool: small
persistent_disk: 20480
networks:
- name: default
static_ips:
- 192.168.1.24
- name: registry
template: registry
instances: 1
resource_pool: small
networks:
- name: default
static_ips:
- 192.168.1.27
- name: health_monitor
template: health_monitor
instances: 1
resource_pool: small
networks:
- name: default
static_ips:
- 192.168.1.25
properties:
env:
nats:
user: NaTs
password: nAtS
address: 192.168.1.20
port: 4222
redis:
address: 192.168.1.22
port: 25255
password: rEdIs
postgres:
user: PoStGrEs
password: pOsTgReS
address: 192.168.1.21
port: 5432
database: bosh
dns:
address: 192.168.1.26
user: PoWeRdNs
password: pOwErDnS
db:
host: 192.168.1.21
user: PoStGrEs
password: pOsTgReS
databases:
name: pOwErDnS
webserver:
password: pOwErDnS
recursor: 192.168.1.100
blobstore:
address: 192.168.1.24
port: 25251
backend_port: 25552
agent:
user: AgEnT
password: aGeNt
director:
user: DiReCtOr
password: dIrEcToR
director:
name: bosh_director
address: 192.168.1.23
port: 25555
db:
host: 192.168.1.21
user: PoStGrEs
password: pOsTgReS
registry:
address: 192.168.1.27
http:
user: ReGiStRy
password: rEgIsTrY
db:
host: 192.168.1.21
user: PoStGrEs
password: pOsTgReS
hm:
http:
port: 25923
user: AdMiN
password: pAsSwOrD
director_account:
user: AdMiN
password: pAsSwOrD
event_nats_enabled: false
email_notifications: false
tsdb_enabled: false
pagerduty_enabled: false
varz_enabled: true
vcenter:
address: 192.168.1.6
user: administrator
password: ******
datacenters:
- name: vDataCenter
vm_folder: zhangqiaoqi_CF/vm_folder_bosh
template_folder: zhangqiaoqi_CF/template_folder_bosh
disk_path: boshdeployer_bosh
datastore_pattern: NFSDataStore
persistent_datastore_pattern: NFSDataStore
allow_mixed_datastores: true
clusters:
- vCluster
3、部署 bosh
检测部署文件有无语法错误,并指定配置文件
bosh deployment ~/deployments/bosh.yml Deployment set to `/home/base/deployments/bosh.yml'
bosh 部署
bosh deploy
Processing deployment manifest
------------------------------
Getting deployment properties from director...
Unable to get properties list from director, trying without it...
Compiling deployment manifest...
Cannot get current deployment information from director, possibly a new deployment
Please review all changes carefully
Deploying
---------
Deployment name: `bosh.yml'
Director name: `micro01'
Are you sure you want to deploy? (type 'yes' to continue): yes
Director task 7
Started preparing deployment
Started preparing deployment > Binding deployment. Done (00:00:00)
Started preparing deployment > Binding releases. Done (00:00:00)
Started preparing deployment > Binding existing deployment. Done (00:00:00)
Started preparing deployment > Binding resource pools. Done (00:00:00)
Started preparing deployment > Binding stemcells. Done (00:00:00)
Started preparing deployment > Binding templates. Done (00:00:00)
Started preparing deployment > Binding properties. Done (00:00:00)
Started preparing deployment > Binding unallocated VMs. Done (00:00:00)
Started preparing deployment > Binding instance networks. Done (00:00:00)
Done preparing deployment (00:00:00)
Started preparing package compilation
Started preparing package compilation > Finding packages to compile. Done (00:00:00)
Done preparing package compilation (00:00:00)
Started compiling packages
Started compiling packages > genisoimage/3. Done (00:05:20)
Started compiling packages > nginx/3. Done (00:02:02)
Started compiling packages > mysql/1. Done (00:01:19)
Started compiling packages > libpq/2. Done (00:01:32)
Started compiling packages > redis/3. Done (00:01:36)
Started compiling packages > postgres/2. Done (00:01:14)
Started compiling packages > ruby/7. Done (00:03:31)
Started compiling packages > health_monitor/34. Done (00:02:13)
Started compiling packages > director/40. Done (00:07:52)
Started compiling packages > nats/3. Done (00:01:18)
Done compiling packages (00:27:57)
Started preparing dns > Binding DNS. Done (00:00:01)
Started creating bound missing vms
Started creating bound missing vms > small/0
Started creating bound missing vms > small/1
Started creating bound missing vms > small/3
Started creating bound missing vms > small/2
Started creating bound missing vms > small/4
Started creating bound missing vms > director/0
Done creating bound missing vms > small/3 (00:02:12)
Done creating bound missing vms > small/2 (00:02:12)
Done creating bound missing vms > small/4 (00:02:12)
Done creating bound missing vms > director/0 (00:02:12)
Done creating bound missing vms > small/1 (00:02:12)
Done creating bound missing vms > small/0 (00:02:13)
Done creating bound missing vms (00:02:13)
Started binding instance vms
Started binding instance vms > nats/0
Started binding instance vms > postgres/0
Started binding instance vms > redis/0
Started binding instance vms > director/0
Started binding instance vms > blobstore/0
Started binding instance vms > health_monitor/0
Done binding instance vms > director/0 (00:00:01)
Done binding instance vms > nats/0 (00:00:01)
Done binding instance vms > postgres/0 (00:00:01)
Done binding instance vms > health_monitor/0 (00:00:01)
Done binding instance vms > redis/0 (00:00:01)
Done binding instance vms > blobstore/0 (00:00:01)
Done binding instance vms (00:00:01)
Started preparing configuration > Binding configuration. Done (00:00:00)
Started updating job nats > nats/0 (canary). Done (00:01:10)
Started updating job postgres > postgres/0 (canary). Done (00:01:30)
Started updating job redis > redis/0 (canary). Done (00:01:08)
Started updating job director > director/0 (canary). Done (00:01:33)
Started updating job blobstore > blobstore/0 (canary). Done (00:01:30)
Started updating job health_monitor > health_monitor/0 (canary). Done (00:01:09)
Task 7 done
Started 2014-10-20 01:16:08 UTC
Finished 2014-10-20 01:54:20 UTC
Duration 00:38:12
Deployed `bosh.yml' to `micro'
查看bosh
bosh vms Deployment `bosh' Director task 14 Task 14 done +------------------+---------+---------------+--------------+ | Job/index | State | Resource Pool | IPs | +------------------+---------+---------------+--------------+ | blobstore/0 | running | small | 192.168.1.24 | | director/0 | running | director | 192.168.1.23 | | health_monitor/0 | running | small | 192.168.1.25 | | nats/0 | running | small | 192.168.1.20 | | postgres/0 | running | small | 192.168.1.21 | | powerdns/0 | running | small | 192.168.1.26 | | redis/0 | running | small | 192.168.1.22 | +------------------+---------+---------------+--------------+ VMs total: 7
本文详细介绍如何在microbosh环境中部署Cloud Foundry V2,包括上传stemcell、release文件,编写配置文件并最终完成部署的过程。此外还提供了解决部署过程中遇到的问题的方法。
302

被折叠的 条评论
为什么被折叠?



