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

来源:互联网 发布:js清空数组中所有元素 编辑:程序博客网 时间:2024/03/29 16:29

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个用来编译包的虚拟机的配置,把其内存调大一些即可。




0 0
原创粉丝点击