CloudFoundry Service 使用
生活随笔
收集整理的這篇文章主要介紹了
CloudFoundry Service 使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Mysql服務在V2版本號中github上有獨立的releaseproject(cf-mysql-release),該release提供了一個Mysql-broker和一個Mysql-server和(broker-registrar,broker-deregistrar,acceptance-tests)
Broker是基于CF V2 ServiceBroker API開發,用于管理內部或外部Mysql數據庫
一、MysqlBroker&Mysql部署
git clone https://github.com/cloudfoundry/cf-mysql-release cd cf-mysql-release ./update
bosh create release releases/cf-mysql-8.yml bosh upload release releases/cf-mysql-8.tgz
--- name: CFMYSQL02 director_uuid: fdd46e30-f2c5-41dc-9662-0976fdac5716releases: - name: cf-mysqlversion: 8compilation:workers: 2cloud_properties:ram: 2048disk: 6144cpu: 2network: defaultreuse_compilation_vms: true update:canaries: 1#waiting for 60s to get update job statuscanary_watch_time: 30000-180000update_watch_time: 30000-180000max_in_flight: 4max_errors: 4networks: - name: defaultsubnets:- range: 192.168.2.0/24# Reserved IPs are the IPs that BOSH should not use in the declared range.reserved:# IP addresses which you don't want allocated by BOSH- 192.168.2.20 - 192.168.2.55 - 192.168.2.140 - 192.168.2.254# IP addresses which you don't want allocated by BOSH- 192.168.2.2 - 192.168.2.10# Static IPs are the IPs that are statically assigned to jobs in this manifest. The BOSH director does not attempt# to dynamically assign these to new VMs.static:- 192.168.2.56 - 192.168.2.100gateway: 192.168.2.1# If you configured your BOSH/micro-BOSH to enable DNS, leave the DNS section empty. The BOSH director automatically uses the# BOSH/micro-BOSH powerDNS IP. If any jobs ever need to resolve DNS entries outside the BOSH powerDNS subdomain# (*.microbosh by default), configure the powerDNS recursor in your bosh release.dns:- 192.168.2.2 cloud_properties:name: "VM Network" meta:# override this in your stub to set the environment name,# which is used for the deployment name## i.e. cf-tabascoenvironment: ~external_domain: acp.localapps_domain: acp.localnats:user: natspassword: c1oudc0wport: 4222machines:- 192.168.2.43use_gnatsd: trueresource_pools:- name: services-smallnetwork: defaultsize: 5stemcell:name: bosh-vsphere-esxi-ubuntu# Stemcell version 2200 is the first to support errands for aws and vsphereversion: 2366cloud_properties:ram: 2048disk: 20480cpu: 1jobs:- name: mysqlrelease: cf-mysqltemplate: mysqlinstances: 1resource_pool: services-smallpersistent_disk: 10000networks:- name: defaultstatic_ips: 192.168.2.56properties:admin_password: c1oudc0wmax_connections: 1500max_user_connections: 40cluster_ips: - 192.168.2.56- name: cf-mysql-brokerrelease: cf-mysqltemplate: cf-mysql-brokerinstances: 1resource_pool: services-smallnetworks:- name: defaultstatic_ips: 192.168.2.57properties:auth_username: rootauth_password: c1oudc0wcookie_secret: c1oudc0wexternal_host: p-mysql.acp.localssl_enabled: falseskip_ssl_validation: truecc_api_uri: https://api.acp.localnats:user: natspassword: c1oudc0wport: 4222machines:- 192.168.2.43use_gnatsd: truenetworks:broker_network: defaultservices:- name: p-mysqlid: 44b26033-1f54-4087-b7bc-da9652c2a539description: A MySQL service for application development and testingtags:- mysqlmax_db_per_node: 250metadata:displayName: "MySQL for Pivotal CF"imageUrl: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABoxJREFUeNrkW01sG0UUnkQ90FNNOfVHilvKBQS2iASHVtiCHkAqxI3ECZG4KOJGnOZQxCVxeuHnEJz0BlVjF3FCyg9UooeKOogeqBTkOEov/DlS056a2hfCASm8b3izXY/XZr07Xq/hSSs7jr2775v3vu+92Zm+vb098X+2fR2/wAeZCL0k6YjzEeHXA9pXa3SU+H2R35f++nCu0sn76+tEBJDTcDDNjsd8nm6LjmU68gRGKdQAkONwesKA063AyDEY1dAAwI5n6RgIKHVrDETOLxC+ACDHEeL5AB13AiJNICwHCgATG0Y8ExIyX2Egqh0HgAku38E89xMNKQKh2M6P+tt0PsUSFTbnBcvqTeYj8wDwiZcc9DtstkD3mjWaAuz8Qo8VeXOUDhO+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gYUQBUgooE5DTIcy1zwZoU1cmunv1/tlTikRQ/IRXDwByhRYIAIBEEAKpKhOOxw0cdSa4hRbTaH2pR8l9lluwA4I9REaDJWR86/q3TdBppyCZI1SQARREim2IJxMhvVXfE1Z9u1/3/pWMn5IyzMQCw+oqqopoIwTNAtNeYVkchNE+jrKeHmn8wUAss64XQctBp4GTo9CB/hp8JNKiyekDSryMSBmvF8OgpQII+a4N8QyHEj5Br3XZeFksjY9JBXf6UiiA9pk6/6jv8nSrBfLcBQK+A/h8yia7zwfRHDaMNbkAh5QSQGwGyPxnSmyE8O+v60je7RMJJVI7V3T+szxAFPkgw17QXYGQKYZJEkOHktSU50arKZ/kkitrmrfYnZVb1ZXROzVA2DFxQFxGbZek85iHhPPL/a4oGD7NSWf2DZusD8MXpMIGg1hzIKbnNjbbnIxDZNPppVwAwCKiUwrgg0mvjE3VaSttqPiAdtlTwYalm64j7W/TKiICJ/4DzM63WD7tZKBkKafRaVznlvdsUUJEwETZpdFvvu4lgV3OCjGKhx5xPutk/4HpStIdAKLh13hUHOHACgAjrynEQXradH3jdMhPnjios64g97x3y9FyAJRIgzIUk5KNeN0753jbHy2vQRicCdnwVtX27e4SMA2ADIsnV42gvOG4cAC0iUgyGqV5CbZ/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-mysqlsecret: c1oudc0wplans:- name: 100mb-devid: ab08f1bc-e6fc-4b56-a767-ee0fea6e3f20description: Shared MySQL Servermax_storage_mb: 100metadata:costs:- amount:usd: 0.0unit: MONTHbullets:- Not for production use - server is not replicated- Shared MySQL server- 100 MB storage- 40 concurrent connectionsdisplayName: "100 MB Dev"mysql_node:host: 192.168.2.56 # 也能夠設置成外部的mysql節點admin_password: c1oudc0w- name: broker-registrartemplate: broker-registrarrelease: cf-mysqlinstances: 1resource_pool: services-smalllifecycle: errandnetworks:- name: defaultproperties:cf:api_url: https://api.acp.localadmin_username: adminadmin_password: adminbroker:name: p-mysqlhost: p-mysql.acp.localusername: rootpassword: c1oudc0w- name: broker-deregistrartemplate: broker-deregistrarrelease: cf-mysqlinstances: 1resource_pool: services-smalllifecycle: errandnetworks:- name: defaultproperties:cf:api_url: https://api.acp.localadmin_username: adminadmin_password: adminbroker:name: p-mysqlhost: p-mysql.acp.localusername: rootpassword: c1oudc0w- name: acceptance-teststemplate: acceptance-testsrelease: cf-mysqlinstances: 1resource_pool: services-smalllifecycle: errandnetworks:- name: defaultproperties:cf:api_url: https://api.acp.localadmin_username: adminadmin_password: adminapps_domain: acp.localskip_ssl_validation: truebroker:host: p-mysql.acp.localservice:name: p-mysqlplan_name: 100mb-devmax_storage_mb: 100 properties: {} # Pivotal CF cannot generate global properties
bosh deploy
cf create-service-broker p-mysql root c1oudc0w http://p-mysql.acp.local
cf curl /v2/service_plans
找到guid后邊的值并復制 改動相應權限為public cf curl PUT /v2/service_plans/060cb8c2-3633-493c-acf1-3b60e78aacd4 -b '{"public":'true'}'
cf create-service
cf bind-service java-hello-offline-mysql p-mysql-32d67
cf push java-hello-offline-mysql -b java-buildpack-offline
cf services
總結
以上是生活随笔為你收集整理的CloudFoundry Service 使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 巧用 GitHub 创建自己的私人 Ma
- 下一篇: MariaDB的Aria存储引擎