openstack用bosh安装cloudfoundry(四)---用micro bosh部署bosh

本文介绍如何利用Microbosh部署Cloudfoundry,包括配置BOSH CLI目标、上传Stemcell与Release、创建部署清单文件、执行部署及验证部署结果等步骤。

micro bosh其实就是一个单机版的bosh,它里面已经包含了bosh 的所有组件,bosh则是分布式的。其实用micro bosh就已经可以部署cloudfoundrry了,但是在生产环境中,还是要用bosh来部署cf。


下面是用micro bosh部署cloudfoundry的具体步骤:

1. 从bosh cli target到micro bosh上

bosh target https://10.10.110.119:25555
用户名和密码都是admin

提示:若要取消targett,则命令为:

#bosh logout

2. 上传stemcell(stemcell的作用在之前的博客中已经说明了)

root@bosh-cli:~/bosh-workspace/stemcells# bosh upload stemcell bosh-stemcell-2818-openstack-kvm-ubuntu.tgz  
  
Verifying stemcell...  
File exists and readable                                     OK  
Using cached manifest...  
Stemcell properties                                          OK  
  
Stemcell info  
-------------  
Name:    bosh-openstack-kvm-ubuntu  
Version: 2818 
  
Checking if stemcell already exists...  
No  
  
Uploading stemcell...  
  
latest-bosh-s: 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 251.3MB  11.3MB/s Time: 00:00:22  
  
Director task 1  
  
Update stemcell  
  extracting stemcell archive (00:00:06)  
  verifying stemcell manifest (00:00:00)  
  checking if this stemcell already exists (00:00:00)  
  uploading stemcell bosh-stemcell/776 to the cloud (00:01:53)  
  save stemcell bosh-stemcell/776 (f207bfcd-f0cb-4ea2-b753-022e6234ebfa) (00:00:00)  
Done                    5/5 00:01:59  
  
Task 1 done  
Started         2013-12-16 09:51:59 UTC  
Finished        2013-12-16 09:53:58 UTC  
Duration        00:01:59  
  
Stemcell uploaded and created  


3.上传release(可以将直接下载好的上传上去,如果自己生成的话太耗时了)

root@bosh-cli:~/bosh-workspace# bosh upload release /root//bosh-workspace/bosh/release/bosh-134.tgz


4. 验证上面上传的stemcell和release

root@bosh-cli:~# bosh stemcells  
  
+---------------------------+---------+--------------------------------------+  
| Name                      | Version | CID                                  |  
+---------------------------+---------+--------------------------------------+  
| bosh-openstack-kvm-ubuntu | 2818    | e64c6da5-f2ab-48f2-b03d-79c29d1acc43 |  
+---------------------------+---------+--------------------------------------+  
  
Stemcells total: 1  
root@bosh-cli:~# bosh releases  
  
+------+-----------+-------------+  
| Name | Versions  | Commit Hash |  
+------+-----------+-------------+  
| bosh | 134 | a8e43f41+   |  
+------+-----------+-------------+  
(*) Currently deployed  
(+) Uncommitted changes  
  
Releases total: 1  
说明:如果上传了多个stemcell和release,用上述命令查看时会全部显示出来。


5. 创建部署bosh的清单文件

创建目录

root@bosh-cli:~# mkdir -p ~/bosh-workspace/deployments/bosh-openstack  
root@bosh-cli:~# cd ~/bosh-workspace/deployments/bosh-openstack  
root@bosh-cli:~/bosh-workspace/deployments/bosh-openstack:#vim bosh-openstack.yml<span style="font-family: Arial, Helvetica, sans-serif;"> </span>

bosh-openstack.yml的具体内容为(里面标识为change的需要根据自己的环境进行相应修改):

---  
name: bosh-openstack  
director_uuid: f90bb17e-eec9-42ff-b3e5-25507fcd3d28  #change  这是micro bosh的director,用bosh status可查到 
  
release:  
  name: bosh  
  version: 134  #bosh release所显示的release的版本    
  
compilation:  
  workers: 3  
  network: default  
  reuse_compilation_vms: true  
  cloud_properties:  
    instance_type: v1.small
  
update:  
  canaries: 1  
  canary_watch_time: 3000-120000  
  update_watch_time: 3000-120000  
  max_in_flight: 4  
  max_errors: 1  
  
networks:  
  - name: floating  
    type: vip  
    cloud_properties: {}  
  - name: default  
    type: dynamic  
    cloud_properties: {}  
  
resource_pools:  
  - name: common  
    network: default  
    size: 8  
    stemcell:  
      name: bosh-openstack-kvm-ubuntu-trusty-go_agent  
      version: 2818  
    cloud_properties:  
      instance_type: v1.micro  
  
jobs:  
  - name: nats  
    template: nats  
    instances: 1  
    resource_pool: common  
    networks:  
      - name: default  
        default: [dns, gateway]  
  
  - name: redis  
    template: redis  
    instances: 1  
    resource_pool: common  
    networks:  
      - name: default  
        default: [dns, gateway]  
  
  - name: postgres  
    template: postgres  
    instances: 1  
    resource_pool: common  
    persistent_disk: 16384  
    networks:  
      - name: default  
        default: [dns, gateway]  
  
  - name: powerdns  
    template: powerdns  
    instances: 1  
    resource_pool: common  
    networks:  
      - name: default  
        default: [dns, gateway]  
      - name: floating  
        static_ips:  
          - 10.10.110.117  #117和下面的118是两个浮动ip,应根据你的环境来进行修改
  
  - name: blobstore  
    template: blobstore  
    instances: 1  
    resource_pool: common
    persistent_disk: 51200  
    networks:  
      - name: default  
        default: [dns, gateway]  
  
  - name: director  
    template: director  
    instances: 1  
    resource_pool: common  
    persistent_disk: 16384  
    networks:  
      - name: default  
        default: [dns, gateway]  
      - name: floating  
        static_ips:  
          - 10.10.110.118 
  
  - name: registry  
    template: registry  
    instances: 1  
    resource_pool: common  
    networks:  
      - name: default  
        default: [dns, gateway]  
  
  - name: health_monitor  
    template: health_monitor  
    instances: 1  
    resource_pool: common  
    networks:  
      - name: default  
        default: [dns, gateway]  
  
properties:  
  nats:  
    address: 0.nats.default.bosh-openstack.microbosh  
    user: nats  
    password: nats  
  
  redis:  
    address: 0.redis.default.bosh-openstack.microbosh  
    password: redis  
  
  postgres: &bosh_db  
    host: 0.postgres.default.bosh-openstack.microbosh  
    user: postgres  
    password: postgres  
    database: bosh  
  
  dns:  
    address: 10.10.110.117  
    db: *bosh_db  
    recursor: 10.10.110.119 
  
  blobstore:  
    address: 0.blobstore.default.bosh-openstack.microbosh  
    agent:  
      user: agent  
      password: agent  
    director:  
      user: director  
      password: director  
  
  director:  
    name: bosh  
    address: 0.director.default.bosh-openstack.microbosh  
    db: *bosh_db  
  
  registry:  
    address: 0.registry.default.bosh-openstack.microbosh  
    db: *bosh_db  
    http:  
      user: registry  
      password: registry  
  
  hm:  
    http:  
      user: hm  
      password: hm  
    director_account:  
      user: admin  
      password: admin  
    resurrector_enabled: true  
  
  ntp:  
    - 0.north-america.pool.ntp.org  
    - 1.north-america.pool.ntp.org  
  
  openstack:  
    auth_url: http://10.10.110.111:5000/v2.0  #和之前部署micro bosh一样,ip应为控制节点的ip
    username: admin     
    api_key: admin    
    tenant: admin        
    default_security_groups: ["default"] 
    default_key_name: microbosh 

6. 部署bosh

设置bosh的部署文件

root@bosh-cli:~/bosh-workspace/deployments# bosh deployment ~/bosh-workspace/deployments/bosh-openstack/bosh-openstack.yml  
Deployment set to `/root/bosh-workspace/deployments/bosh-openstack/bosh-openstack.yml' 

部署

root@bosh-cli:~/bosh-workspace/deployments# bosh deploy 

7. 验证部署是否成功

root@bosh-cli:~/bosh-workspace/deployments/bosh-openstack# bosh vms  
Deployment `bosh-openstack'  
  
Director task 90  
  
Task 90 done  
  
+------------------+---------+---------------+--------------------------+  
| Job/index        | State   | Resource Pool | IPs                      |  
+------------------+---------+---------------+--------------------------+  
| blobstore/0      | running | common        | 50.50.0.11               |  
| director/0       | running | common        | 50.50.0.10, 10.68.19.132 |  
| health_monitor/0 | running | common        | 50.50.0.13               |  
| nats/0           | running | common        | 50.50.0.5                |  
| postgres/0       | running | common        | 50.50.0.7                |  
| powerdns/0       | running | common        | 50.50.0.9, 10.68.19.131  |  
| redis/0          | running | common        | 50.50.0.6                |  
| registry/0       | running | common        | 50.50.0.12               |  
+------------------+---------+---------------+--------------------------+  
  
VMs total: 8  

只要8个虚拟机都是正常运行的,说明bosh部署成功。


说明:在整个部署过程中,最好所用的stemcell都相同,免得安装的每一步都采用不同的stemcell。但是并不是非得所有用的stemcell必须相同,在部署bosh或者cloudfoundry的过程中首先会编译release里面的包,如果有的包始终无法编译,则必须调整stemcell的版本(一般是把stemcell版本调高一些)。顺便说下,如果编译包的过程中提示time out ping这种错误的话,解决方法是在清单文件中调整那3个用来编译包的虚拟机的配置,把其内存调大一些即可。




该数据集通过合成方式模拟了多种发动机在运行过程中的传感器监测数据,旨在构建一个用于机械系统故障检测的基准资源,特别适用于汽车领域的诊断分析。数据按固定时间间隔采集,涵盖了发动机性能指标、异常状态以及工作模式等多维度信息。 时间戳:数据类型为日期时间,记录了每个数据点的采集时刻。序列起始于2024年12月24日10:00,并以5分钟为间隔持续生成,体现了对发动机运行状态的连续监测。 温度(摄氏度):以浮点数形式记录发动机的温度读数。其数值范围通常处于60至120摄氏度之间,反映了发动机在常规工况下的典型温度区间。 转速(转/分钟):以浮点数表示发动机曲轴的旋转速度。该参数在1000至4000转/分钟的范围内随机生成,符合多数发动机在正常运转时的转速特征。 燃油效率(公里/升):浮点型变量,用于衡量发动机的燃料利用效能,即每升燃料所能支持的行驶里程。其取值范围设定在15至30公里/升之间。 振动_X、振动_Y、振动_Z:这三个浮点数列分别记录了发动机在三维空间坐标系中各轴向的振动强度。测量值标准化至0到1的标度,较高的数值通常暗示存在异常振动,可能与潜在的机械故障相关。 扭矩(牛·米):以浮点数表征发动机输出的旋转力矩,数值区间为50至200牛·米,体现了发动机的负载能力。 功率输出(千瓦):浮点型变量,描述发动机单位时间内做功的速率,取值范围为20至100千瓦。 故障状态:整型分类变量,用于标识发动机的异常程度,共分为个等级:0代表正常状态,1表示轻微故障,2对应中等故障,3指示严重故障。该列作为分类任务的目标变量,支持基于传感器数据预测故障等级。 运行模式:字符串类型变量,描述发动机当前的工作状态,主要包括:怠速(发动机运转但无负载)、巡航(发动机在常规负载下平稳运行)、重载(发动机承受高负荷或高压工况)。 数据集整体包含1000条记录,每条记录对应特定时刻的发动机性能快照。其中故障状态涵盖从正常到严重故障的级分类,有助于训练模型实现故障预测与诊断。所有数据均为合成生成,旨在模拟真实的发动机性能变化与典型故障场景,所包含的温度、转速、燃油效率、振动、扭矩及功率输出等关键传感指标,均为影响发动机故障判定的重要因素。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值