您的位置:首页 > 其它

CloudFoundry部署(三):BOSH部署

2014-04-17 14:11 316 查看
CloudFoundry部署之BOSH部署

一、BOSH部署

设置MicroBosh的目标(target),并且登陆
bosh target 192.168.2.20:25555
bosh login
用户名:admin 密码:admin



下载stemcell和bosh-release,stemcell上篇文章中已经下载完毕,这里bosh-release用的是bosh-2200.tgz
上传stemcell和bosh-release
bosh upload stemcell ~/stemcell/bosh-stemcell-2375-vsphere-esxi-ubuntu.tgz
bosh upload release bosh-2200.tgz













创建目录~/deployments/bosh01,编辑Bosh部署清单文件bosh_manifest.yml
设置部署清单前需要获得MicroBosh的director的uuuid
bosh status



sudo mkdir -p ~/deployements/bosh01
sudo chmod 777 -R ~/deployments/bosh01
vi bosh_manifest.yml

---
name: BOSH01
director_uuid: 2cf48741-3919-40d1-8bd7-3a82a9012672 # Change this to the UUID of the BOSH director.
release:                                            # Find this with > bosh status.
  name: bosh # Change this to reflect the name of your release. This is specified in your release manifest.
  version: 46 # Specify the version of your release. This is also specified in your release manifest.

networks:
# all of these settings depend on your own infrastructure setup
- name: default # An internal name for the network in your manifest file
  subnets:
  - reserved:
    - 192.168.2.141 - 192.168.2.254 # IP addresses which you don't want allocated by BOSH
    - 192.168.2.2 - 192.168.2.24    # IP addresses which you don't want allocated by BOSH
    static:
    - 192.168.2.25 - 192.168.2.39 # A static IP range that can be used for deploying BOSH
    range: 192.168.2.0/24        # The range of IP addresses that can be accessible by BOSH
    gateway: 192.168.2.1
    dns:
    - 192.168.2.2 # use your own DNS server IP
    cloud_properties:
      name: "VM Network"      # The name of the virtual machine network in vCenter

#
# You shouldn't have to change any of the resource pool parameters
#

resource_pools:
- name: small
  stemcell:
    name: bosh-vsphere-esxi-ubuntu
    version: 2375
  network: default
  size: 3
  cloud_properties:
    ram: 512
    disk: 2048
    cpu: 1
- name: medium
  stemcell:
    name: bosh-vsphere-esxi-ubuntu
    version: 2375
  network: default
  size: 2
  cloud_properties:
    ram: 1024
    disk: 8192
    cpu: 1
- name: director
  stemcell:
    name: bosh-vsphere-esxi-ubuntu
    version: 2375
  network: default
  size: 1
  cloud_properties:
    ram: 2048
    disk: 8192
    cpu: 2

compilation:
  workers: 4
  network: default
  cloud_properties:
    ram: 2048
    disk: 4096
    cpu: 4

#
# If you have errors with canary instances during a deployment, you can try 
# increasing the canary_watch_time and update_watch_time. The values here are in 
# milliseconds. Divide by 1000 to get the value in seconds.
# 
#

update:
  canaries: 1
  canary_watch_time: 60000
  update_watch_time: 60000
  max_in_flight: 1
  max_errors: 2

jobs:

- name: nats
  template: nats
  instances: 1
  resource_pool: small
  networks:
  - name: default
    static_ips:
    - 192.168.2.25         # Assign a static IP

- name: postgres
  template: postgres
  instances: 1
  resource_pool: medium
  persistent_disk: 2048
  networks:
  - name: default
    static_ips:
    - 192.168.2.26        # Assign a static IP from the static range specified above

- name: redis
  template: redis
  instances: 1
  resource_pool: small
  networks:
  - name: default
    static_ips:
    - 192.168.2.27     # Assign a static IP from the static range specified above

- name: director
  template: director
  instances: 1
  resource_pool: director
  persistent_disk: 2048
  networks:
  - name: default
    static_ips:
    - 192.168.2.28      # Assign a static IP from the static range specified above

- name: blobstore
  template: blobstore
  instances: 1
  resource_pool: medium
  persistent_disk: 20480
  networks:
  - name: default
    static_ips:
    - 192.168.2.29     # Assign a static IP from the static range specified above

- name: health_monitor
  template: health_monitor
  instances: 1
  resource_pool: small
  networks:
  - name: default
    static_ips:
    - 192.168.2.30    # Assign a static IP from the static range specified above

properties:
  env:

  blobstore:
    address: 192.168.2.29     # This should be the same IP specified for the job above
    port: 25251
    backend_port: 25552
    agent:
      user: agent
      password: 38fh20
    director:
      user: director
      password: oe9U37dbd

  networks:
    apps: default
    management: default

  nats:
    user: nats              
    password: 38dhj389ddck378gcE
    address: 192.168.2.25    # This should be the same IP specified for the job above
    port: 4222

  postgres:
    user: bosh             
    password: 29fhcuebJDldhv265kB
    address: 192.168.2.26   # This should be the same IP specified for the job above
    port: 5432
    database: bosh

  redis:
    address: 192.168.2.27   # This should be the same IP specified for the job above
    port: 25255
    password: wicjew93hf2

  director:
    name: bosh_director
    address: 192.168.2.28  # This should be the same IP specified for the job above
    port: 25555
    encryption: false
    db:
      user: bosh
      password: 29fhcuebJDldhv265kB
      host: 192.168.2.26

  hm:
    http:
      port: 25923
      user: admin
      password: 8wufn
    director_account:
      user: director
      password: oe9U37dbd
    intervals:
      poll_director: 60
      poll_grace_period: 30
      log_stats: 300
      analyze_agents: 60
      agent_timeout: 180
      rogue_agent_alert: 180
    loglevel: info
    email_notifications: false # if this is false you don't need to worry about the smtp section below
    email_recipients:
    - zhaozhenyang@apusic.com
    smtp:
      from: zhaozhenyang@apusic.com
      host: com-smtp.apusic.net
      port: 25
      auth: plain
      user: appcloud
      password: 38fhsoeY
      domain: localdomain
    tsdb_enabled: false     # it this is false you don't have to worry about the tsdb settings. Plus you can't set it to true until you have a complete Cloud Foundry running.
    #tsdb:
    #  address: 10.1.4.228 # opentsdb static IP from your Cloud Foundry deploy (optional)
    #  port: 4242

  vcenter:
    address: 192.168.2.2      # The IP of your vCenter server
    user: WIN-0HB5C2E36RV\Administrator     # Your vCenter server user
    password: kingdee$2012     # You vCenter user password
    datacenters:
      - name: CF-Zone01           # The datacenter name in vCenter
        vm_folder: vm_folder   # This folder should be created automatically by BOSH
        template_folder: template_folder # This folder should be created automatically by BOSH
        disk_path: cf_folder # Create this path manually in your datastore
        datastore_pattern: NFSDataStore # See the offcial BOSH documentation (documentation.md) for additional pattern params
        persistent_datastore_pattern: NFSDataStore
        allow_mixed_datastores: true # Are you mixing persistent and non-persistent disks?
        clusters:
        - CF-Cluster01:                   # The cluster name
            resource_pool: CLOUDFOUNDRY      # Manually create this resource pool for BOSH

设置部署清单
cd ~/deployments/bosh01
bosh deployment bosh_manifest.yml




开始部署
bosh deploy






有时会出现Error 400007: `director/0' is not running after update"错误提示虚拟机没有正常启动,查看状态确定是否处于running状态,若处于running状态则暂时忽略该问题,进行下一步验证,下一步若成功则忽略此问题若出现上述问题,重新运行bosh deploy

登陆到failing虚拟机运行monit stop director,monit start dirctor等待一会重新运行bosh vms看状态
等待结果,若部署成功则查看虚拟机是否都处于running状态
bosh vms


注:# 启动的编译虚拟机不会占用static范围内的ip而是随机ip

        # 最后启动的bosh虚拟机是job中分配的ip
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息