OpenStack使用Bosh部署CloudFoundry(七)—部署MongoDB&Redis等服务

14 篇文章 0 订阅
11 篇文章 0 订阅

版本说明:

CloudFoundry:V2版本-v149+(本文后续章节中的Manifest适用于149+版本的CF Release)

OpenStack:Grizzly版本+nova-network

CloudFoundry部署交流QQ群: 176302388

CloudFoundry V2版本已经将第三方的服务以独立release包的形式托管在GitHub上,并且已经发布了第一个发布版,包括以下服务:

  • elastic search
  • memcached
  • mongodbc
  • postgresql
  • rabbitmq
  • redis
  • vblob
  • swift

    部署方式如下(可以选择部署DEV版或者正式的Release版,本文以最新代码的Release版为例):

    1、获取并更新代码

    git clone https://github.com/cloudfoundry/cf-services-contrib-release.git
    
    cd cf-services-contrib-release
    
    ./update

    2、打包并上传release包

    bosh create release releases/cf-services-contrib-2.yml
    
    bosh upload release
    本例中release包名为:cf-services-contrib

    3、编写YAML配置文件cf-services-contrib.yml

    ---
    name: cf-services-contrib
    director_uuid: 785aa0a6-87c7-4452-a862-c118afc90b37   # CHANGE
    
    releases:
      - name: cf-services-contrib
        version: latest
    
    compilation:
      workers: 3
      network: default
      reuse_compilation_vms: true
      cloud_properties:
        instance_type: v1.compile # CHANGE
    
    update:
      canaries: 1
      canary_watch_time: 30000-60000
      update_watch_time: 30000-60000
      max_in_flight: 4
    
    networks:
      - name: floating
        type: vip
        cloud_properties: {}
      - name: default
        type: dynamic
        cloud_properties:
          security_groups:
            - default # CHANGE
    
    resource_pools:
      - name: small
        network: default
        size: 8
        stemcell:
          name: bosh-openstack-kvm-ubuntu
          version: latest
        cloud_properties:
          instance_type: v1.small # CHANGE
    
    jobs:
      - name: gateways
        release: cf-service
        template:
        - elasticsearch_gateway
        - mongodb_gateway
        - memcached_gateway
        - postgresql_gateway_ng
        - redis_gateway
        - rabbit_gateway
        - vblob_gateway
        instances: 1
        resource_pool: small
        networks:
          - name: default
            default: [dns, gateway]
        properties:
          # Service credentials
          uaa_client_id: "cf"
          uaa_endpoint: http://uaa.vsc.com # CHANGE
          uaa_client_auth_credentials:
            username: services
            password: c1oudc0w # CHANGE
    
      - name: mongodb_service_node
        release: cf-service
        template: mongodb_node_ng
        instances: 1
        resource_pool: small
        persistent_disk: 4096
        properties:
          plan: default
        networks:
          - name: default
            default: [dns, gateway]
    
      - name: memcached_service_node
        release: cf-service
        template: memcached_node_ng
        instances: 1
        resource_pool: small
        persistent_disk: 4096
        properties:
          plan: default
        networks:
          - name: default
            default: [dns, gateway]
    
      - name: vblob_service_node
        release: cf-service
        template: vblob_node_ng
        instances: 1
        resource_pool: small
        persistent_disk: 4096
        properties:
          plan: default
        networks:
          - name: default
            default: [dns, gateway]
    
      - name: elasticsearch_service_node
        release: cf-service
        template: elasticsearch_node
        instances: 1
        resource_pool: small
        persistent_disk: 4096
        properties:
          plan: "free"
        networks:
          - name: default
            default: [dns, gateway]
    
      - name: postgresql_service_node
        release: cf-service
        template: postgresql_node_ng
        instances: 1
        resource_pool: small
        persistent_disk: 4096
        properties:
          postgresql_node:
            plan: default
        networks:
          - name: default
            default: [dns, gateway]
    
      - name: redis_service_node
        release: cf-service
        template: redis_node_ng
        instances: 1
        resource_pool: small
        persistent_disk: 4096
        properties:
          plan: default
        networks:
          - name: default
            default: [dns, gateway]
    
      - name: rabbit_service_node
        release: cf-service
        template: rabbit_node_ng
        instances: 1
        resource_pool: small
        persistent_disk: 4096
        properties:
          plan: default
        networks:
          - name: default
            default: [dns, gateway]
    
    properties:
      networks:
        apps: default
        management: default
    
      cc:
        srv_api_uri: http://api.vsc.com #CHANGE
    
      nats:
        address: 0.core.default.cf.bosh #CHANGE
        port: 4222 #CHANGE
        user: nats #CHANGE
        password: c1oudc0w #CHANGE
        authorization_timeout: 5
    
      service_plans:
        mongodb:
          default:
            description: "Developer, shared VM, 250MB storage, 10 connections"
            free: true
            job_management:
              high_water: 230
              low_water: 20
            configuration:
              capacity: 125
              max_clients: 10
              quota_files: 4
              quota_data_size: 240
              enable_journaling: true
              backup:
                enable: true
              lifecycle:
                enable: true
                serialization: enable
                snapshot:
                  quota: 1
    
        memcached:
          default:
            description: "Developer"
            free: true
            job_management:
              high_water: 230
              low_water: 20
            configuration:
              capacity: 125
    
        vblob:
          default:
            description: "Developer"
            free: true
            job_management:
              high_water: 230
              low_water: 20
            configuration:
              capacity: 125
    
        elasticsearch:
          "free":
            description: "Developer"
            free: true
            job_management:
              high_water: 230
              low_water: 20
            configuration:
              capacity: 125
    
        postgresql:
          default:
            description: "Developer, 250MB storage, 10 connections"
            free: true
            job_management:
              high_water: 230
              low_water: 20
            configuration:
              capacity: 125
              max_clients: 10
              quota_files: 4
              quota_data_size: 240
              enable_journaling: true
              backup:
                enable: false
              lifecycle:
                enable: false
                serialization: enable
                snapshot:
                  quota: 1
    
        redis:
          default:
            description: "Developer, 250MB storage, 10 connections"
            free: true
            job_management:
              high_water: 230
              low_water: 20
            configuration:
              capacity: 125
              max_clients: 10
              quota_files: 4
              quota_data_size: 240
              enable_journaling: true
              backup:
                enable: false
              lifecycle:
                enable: false
                serialization: enable
                snapshot:
                  quota: 1
    
    
        rabbit:
          default:
            description: "Developer, 250MB storage, 10 connections"
            free: true
            job_management:
              high_water: 230
              low_water: 20
            configuration:
              capacity: 125
              max_clients: 10
              quota_files: 4
              quota_data_size: 240
              enable_journaling: true
              backup:
                enable: false
              lifecycle:
                enable: false
                serialization: enable
                snapshot:
                  quota: 1
    
      mongodb_gateway:
        token: c1oudc0w # CHANGE - the token you use later with `cf create-service-auth-token`
        default_plan: default
        supported_versions: ["2.2"]
        version_aliases:
          current: "2.2"
        cc_api_version: v2
      mongodb_node:
        supported_versions: ["2.2"]
        default_version: "2.2"
        max_tmp: 900
    
      memcached_gateway:
        token: c1oudc0w # CHANGE - the token you use later with `cf create-service-auth-token`
        supported_versions: ["1.4"]
        version_aliases:
          current: "1.4"
        cc_api_version: v2
      memcached_node:
        supported_versions: ["1.4"]
        default_version: "1.4"
    
      vblob_gateway:
        token: c1oudc0w # CHANGE - the token you use later with `cf create-service-auth-token`
        supported_versions: ["0.51"]
        version_aliases:
          current: "0.51"
        cc_api_version: v2
      vblob_node:
        supported_versions: ["0.51"]
        default_version: "0.51"
    
      elasticsearch_gateway:
        token: c1oudc0w # CHANGE - the token you use later with `cf create-service-auth-token`
        supported_versions: ["0.20"]
        version_aliases:
          current: "0.20"
        cc_api_version: v2
      elasticsearch_node:
        supported_versions: ["0.20"]
        default_version: "0.20"
    
      postgresql_gateway:
        token: c1oudc0w # CHANGE - the token you use later with `cf create-service-auth-token`
        default_plan: default
        supported_versions: ["9.3"]
        version_aliases:
          current: "9.3"
        cc_api_version: v2
      postgresql_node:
        supported_versions: ["9.3"]
        default_version: "9.3"
        max_tmp: 900
        password: c1oudc0w# CHANGE
    
      redis_gateway:
        token: c1oudc0w # CHANGE - the token you use later with `cf create-service-auth-token`
        default_plan: default
        supported_versions: ["2.6"]
        version_aliases:
          current: "2.6"
        cc_api_version: v2
      redis_node:
        supported_versions: ["2.6"]
        default_version: "2.6"
        max_tmp: 900
    
      rabbit_gateway:
        token: c1oudc0w # CHANGE - the token you use later with `cf create-service-auth-token`
        default_plan: "default"
        supported_versions: ["3.0"]
        version_aliases:
          current: "3.0"
        cc_api_version: v2
      rabbit_node:
        supported_versions: ["3.0"]
        default_version: "3.0"
        max_tmp: 900
    
      swift_gateway:
        token: c1oudc0w # CHANGE - the token you use later with `cf create-service-auth-token`
        default_plan: "free"
        supported_versions: ["1.0"]
        cc_api_version: v2
      swift_node:
        supported_versions: ["1.0"]
        default_version: "1.0"
        name_suffix: 'a9s.eu'
        swift_operator_role_id: '2021022271a74ecdb94ceeeeeae657ad'
        fog:
          identity:
            provider: 'OpenStack'
            openstack_username: VF
            openstack_api_key: 1
            openstack_auth_url:  http://10.68.19.61:5000/v2.0/tokens
            openstack_service_type: ['identity']
          storage:
            provider: 'HP'
            hp_access_key: "yourtenant"
            hp_secret_key: "yourpass"
            hp_tenant_id: "eee1c14691d840f6b52a24c6c4cc2a0e"
            hp_auth_uri:  http://10.68.19.61:5000/v2.0
            hp_use_upass_auth_style: true
            hp_avl_zone: 'nova'
            hp_auth_version: "v2"
            self_signed_ssl: false
            hp_service_type: "Object Storage"

    4、部署服务

    bosh deployment cf-services-contrib.yml
    
    bosh deploy

    5、查看Services实例状态

    +------------------------------+---------+---------------+------------+
    | Job/index                    | State   | Resource Pool | IPs        |
    +------------------------------+---------+---------------+------------+
    | elasticsearch_service_node/0 | running | small         | 50.50.0.24 |
    | gateways/0                   | running | small         | 50.50.0.23 |
    | memcached_service_node/0     | running | small         | 50.50.0.20 |
    | mongodb_service_node/0       | running | small         | 50.50.0.19 |
    | postgresql_service_node/0    | running | small         | 50.50.0.25 |
    | rabbit_service_node/0        | running | small         | 50.50.0.22 |
    | redis_service_node/0         | running | small         | 50.50.0.18 |
    | vblob_service_node/0         | running | small         | 50.50.0.21 |
    +------------------------------+---------+---------------+------------+
    

    6、验证服务

    cf services -m
    
    cf create-service-auth-token
    本例中token创建参数:Lable=>mongodb  Token=>c1oudc0w

    创建service命令:

    cf create-service


    关于cf命令行的使用,可以查阅文档: http://docs.cloudfoundry.com/docs/using/managing-apps/cf/
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值