[セットトップ]OpenStack Boshを使用したCloudFoundryの導入(7)-MongoDB&Redisなどのサービスの導入


バージョンの説明:
CloudFoundry:V 2バージョン-v 149+(本明細書の後続章のManifestは149+バージョンのCF Releaseに適用)
OpenStack:Grizzlyバージョン+nova-network CloudFoundry導入交流QQ群:
176302388
CloudFoundry V 2のバージョンでは、GitHubにサードパーティ製サービスが独立したreleaseパッケージとして管理され、次のサービスを含む最初のリリースがリリースされています.
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.サービスインスタンスのステータスの表示
+------------------------------+---------+---------------+------------+
| 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=>c 1 oudc 0 w
サービスコマンドの作成:
cf create-service

cfコマンドラインの使用については、ドキュメントを参照してください.http://docs.cloudfoundry.com/docs/using/managing-apps/cf/