vSphere部署Cloud Foundry V2 (4) ---- 使用 micro bosh 部署 bosh

本文详细介绍如何在microbosh环境中部署Cloud Foundry V2,包括上传stemcell、release文件,编写配置文件并最终完成部署的过程。此外还提供了解决部署过程中遇到的问题的方法。

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

 

基于数据驱动的 Koopman 算子的递归神经网络模型线性化,用于纳米定位系统的预测控制研究(Matlab代码实现)内容概要:本文围绕“基于数据驱动的 Koopman 算子的递归神经网络模型线性化,用于纳米定位系统的预测控制研究”展开,提出了一种结合数据驱动方法与Koopman算子理论的递归神经网络(RNN)模型线性化方法,旨在提升纳米定位系统的预测控制精度与动态响应能力。研究通过构建数据驱动的线性化模型,克服了传统非线性系统建模复杂、计算开销大的问题,并在Matlab平台上实现了完整的算法仿真与验证,展示了该方法在高精度定位控制中的有效性与实用性。; 适合人群:具备一定自动化、控制理论或机器学习背景的科研人员与工程技术人员,尤其是从事精密定位、智能控制、非线性系统建模与预测控制相关领域的研究生与研究人员。; 使用场景及目标:①应用于纳米级精密定位系统(如原子力显微镜、半导体制造设备)中的高性能预测控制;②为复杂非线性系统的数据驱动建模与线性化提供新思路;③结合深度学习与经典控制理论,推动智能控制算法的实际落地。; 阅读建议:建议读者结合Matlab代码实现部分,深入理解Koopman算子与RNN结合的建模范式,重点关注数据预处理、模型训练与控制系统集成等关键环节,并可通过替换实际系统数据进行迁移验证,以掌握该方法的核心思想与工程应用技巧。
基于粒子群算法优化Kmeans聚类的居民用电行为分析研究(Matlb代码实现)内容概要:本文围绕基于粒子群算法(PSO)优化Kmeans聚类的居民用电行为分析展开研究,提出了一种结合智能优化算法与传统聚类方法的技术路径。通过使用粒子群算法优化Kmeans聚类的初始聚类中心,有效克服了传统Kmeans算法易陷入局部最优、对初始值敏感的问题,提升了聚类的稳定性和准确性。研究利用Matlab实现了该算法,并应用于居民用电数据的行为模式识别与分类,有助于精细化电力需求管理、用户画像构建及个性化用电服务设计。文档还提及相关应用场景如负荷预测、电力系统优化等,并提供了配套代码资源。; 适合人群:具备一定Matlab编程基础,从事电力系统、智能优化算法、数据分析等相关领域的研究人员或工程技术人员,尤其适合研究生及科研人员。; 使用场景及目标:①用于居民用电行为的高效聚类分析,挖掘典型用电模式;②提升Kmeans聚类算法的性能,避免局部最优问题;③为电力公司开展需求响应、负荷预测和用户分群管理提供技术支持;④作为智能优化算法与机器学习结合应用的教学与科研案例。; 阅读建议:建议读者结合提供的Matlab代码进行实践操作,深入理解PSO优化Kmeans的核心机制,关注参数设置对聚类效果的影响,并尝试将其应用于其他相似的数据聚类问题中,以加深理解和拓展应用能力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值