openstack用bosh部署cloudfoundry(六)---添加mysql服务

上传java web应用需要数据库,下面说下安装mysql的具体过程,我安装的mysql是mysql-16。和前面安装bosh或者cloudfoundry的过程一样,安装mysql也需要三个东西,stemcell、release和manifest。

1. target到cf的director

root@bosh-cli:~#bosh target https://10.10.3110.191:25555
root@bosh-cli:~#bosh login

 用户名和密码都是admin 
  

2. 上传stemcell

创建目录

root@bosh-cli:~#mkdir -p ~/bosh-workspace/deployments/mysql    
root@bosh-cli:~# cd ~/bosh-workspace/deployments/mysql

 
  

上传stemcell

root@bosh-cli:~/bosh-workspace/stemcells# bosh upload stemcell bosh-stemcell-2818-openstack-kvm-ubuntu.tgz

3. 上传release

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


4. 创建manifest

root@bosh-cli:~/bosh-workspace/deployments/mysql#vim myql.yml

manifest的内容为:

---  
name: cf-services  
director_uuid: e7a05b61-d8cf-4654-bed3-84d01ba8d04f  #change 这是cloudfoundry的director的uuid,用bosh status查看
  
releases:  
- name: cf-mysql    #change
  version: 16       #change
    
compilation:  
  workers: 3  
  network: default  
  reuse_compilation_vms: true  
  cloud_properties:  
    instance_type: m1.medium # CHANGE    
  
update:   
  canaries: 0  
  canary_watch_time: 30000-600000  
  update_watch_time: 30000-600000  
  max_in_flight: 32  
  serial: false  
    
networks:  
  - name: floating  
    type: vip  
    cloud_properties: {}  
  - name: default  
    type: dynamic  
    cloud_properties:  
      security_groups:  
        - default 

meta:   
  environment: null 
  
  external_domain: vsc.com  
  apps_domain: vsc.com  
  nats:  
    user: nats  
    password: c1oudc0w  
    port: 4222  
    machines:  
      - 10.0.0.26
    #use_gnatsd: true  
  syslog_aggregator: null

resource_pools:  
  - name: services-small  
    network: default  
    size: 6 
    stemcell:  
      name: bosh-openstack-kvm-ubuntu-trusty-go_agent
      version: 2818  
    cloud_properties:  
      instance_type: m1.micro # CHANGE
  
jobs:  
  - name: mysql  
    release: cf-mysql  
    template: mysql  
    instances: 1  
    resource_pool: services-small  
    persistent_disk: 10000  
    networks:  
      - name: default  
        default: [dns, gateway]
      - name: floating
        static_ips:
          - 10.10.110.199
    properties: 
      admin_username: root 
      admin_password: c1oudc0w  
      port: 3306
      max_connections: 1500  
      haproxy_mysql_user: haproxy_check 
      cluster_ips:   
      - 10.10.110.199
      proxy_ips:
      - 10.10.110.200
      seeded_databases: null
      syslog_aggregator: null
      network_name: default
      
  - name: proxy
    release: cf-mysql
    template: proxy
    instances: 1
    resource_pool: services-small
    networks:
      - name: default
        default: [dns, gateway]
      - name: floating
        static_ips:
          - 10.10.110.200					 #change 200和199都是浮动ip
    properties:     
      mysql_ips: 
        - 10.10.110.199
      haproxy_mysql_user: haproxy_check
      network_name: default
      syslog_aggregator: null
      nats:
        user: nats
        password: c1oudc0w
        port: 4222
        machines:                      
          - 10.0.0.26						#machines是部署好的cloudfoundry中nats的ip
        #use_gnatsd: true
      external_domain: vsc.com
      haproxy_stats_password: c1oudc0w
 
  - name: cf-mysql-broker  
    release: cf-mysql  
    template: cf-mysql-broker  
    instances: 1  
    resource_pool: services-small  
    networks:  
      - name: default 
        default: [dns, gateway] 
    properties:
      max_user_connections_default: 40
      syslog_aggregator: null
      network_name: default  
      auth_username: root  
      auth_password: c1oudc0w  
      cookie_secret: c1oudc0w  
      external_host: p-mysql.vsc.com  
      ssl_enabled: false 
      skip_ssl_validation: true 
      cc_api_uri: http://api.vsc.com  
      nats:  
        user: nats  
        password: c1oudc0w  
        port: 4222  
        machines:
          - 10.0.0.26 
        #use_gnatsd: true  
      networks:  
        broker_network: default  
      services:  
      - name: p-mysql 
        plan_updateable: true 
        id: 44b26033-1f54-4087-b7bc-da9652c2a539  
        description: A MySQL service for application development and testing  
        tags:  
          - mysql  
        #max_db_per_node: 250  
        metadata:  
          displayName: "MySQL for Pivotal CF"  
          imageUrl: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAA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X27e4SMA2ADIsnV42gvOG4cAC0iUgyGqV5CbZ/Nmd5L3NfJ3eMMRlI82jjtNk2g4+AZjHKxkxuo+7qxfV4tUXOwkqk9wW7tbwEGAJwbJQSR3aMDAAAAAElFTkSuQmCC" 
          longDescription: "Provisioning a service instance creates a MySQL database. 
            Binding applications to the instance creates unique credentials for each
            application to access the database."  
          providerDisplayName: "Pivotal Software"  
          documentationUrl: "http://docs.gopivotal.com/"  
          supportUrl: "http://gopivotal.com/support/"  
        dashboard_client:  
          id: p-mysql  
          secret: c1oudc0w  
        plans:  
          - name: 100mb-dev  
            id: ab08f1bc-e6fc-4b56-a767-ee0fea6e3f20  
            description: Shared MySQL Server  
            max_storage_mb: 100 
            max_user_connections: 20 
            metadata:  
              costs:  
              - amount:  
                  usd: 0.0  
                unit: MONTH  
              bullets:  
                - Not for production use - server is not replicated  
                - Shared MySQL server  
                - 100 MB storage  
                - 40 concurrent connections  
              displayName: "100 MB Dev" 
          - name: 1gb-dev
            id: 11d0aa36-dcec-4021-85f5-ea4d9a5c8342
            description: Shared MySQL Server
            max_storage_mb: 1000
            max_user_connections: 40
            metadata:
              costs:
              - amount:
                  usd: 0.0
                unit: MONTH
              bullets:
                - Not for production use - server is not replicated
                - Shared MySQL server
                - 1000 MB storage
                - 40 concurrent connections
              displayName: "1 GB Dev" 
      mysql_node:  
        host: 10.10.110.199   
        admin_password: c1oudc0w 
        persistent_disk: 10000

  - name: broker-registrar
    template: broker-registrar
    release: cf-mysql
    instances: 1
    resource_pool: services-small
    lifecycle: errand
    networks:
      - name: default
    properties:
      cf:
        api_url: http://api.vsc.com
        admin_username: admin
        admin_password: admin
      broker:
        name: p-mysql
        host: p-mysql.vsc.com
        username: root
        password: c1oudc0w

  - name: broker-deregistrar
    template: broker-deregistrar
    release: cf-mysql
    instances: 1
    resource_pool: services-small
    lifecycle: errand
    networks:
      - name: default
    properties:
      cf:
        api_url: http://api.vsc.com
        admin_username: admin
        admin_password: admin
      broker:
        name: p-mysql
        host: p-mysql.vsc.com
        username: root
        password: c1oudc0w 

  - name: acceptance-tests  
    template: acceptance-tests  
    release: cf-mysql  
    instances: 1  
    resource_pool: services-small  
    lifecycle: errand  
    networks:  
      - name: default 
    properties:  
      cf:  
        api_url: http://api.vsc.com  
        admin_username: admin  
        admin_password: admin  
        apps_domain: vsc.com  
        skip_ssl_validation: true 
      broker:  
        host: p-mysql.vsc.com  
      service:  
        name: p-mysql
        plans:  
          - plan_name: 100mb-dev  
            max_storage_mb: 100
            max_user_connections: 20
          - plan_name: 1gb-dev
            max_storage_mb: 1000
            max_user_connections: 40
properties: {}  # Pivotal CF cannot generate global properties 

5. 部署mysql

root@bosh-cli:~/bosh-workspace/deployments/mysql#bosh deployment mysql.yml
root@bosh-cli:~/bosh-workspace/deployments/mysql#bosh deploy

6. 验证部署是否成功

root@bosh-cli:~/bosh-workspace/deployments/mysql#bosh vms

openstack用bosh部署cloudfoundry(六)---添加mysql服务_第1张图片

如果所有组件都正常运行,则部署成功。这里出现的unknown属于正常情况,因为清单文件中有几个job的多了一个lifecycle:errand属性,即这些job并不是服务,所以这里是unknown,只有服务这里才会显示出名字。



你可能感兴趣的:(云计算)