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部署
- 下载cf-mysql-release
git clone https://github.com/cloudfoundry/cf-mysql-release
cd cf-mysql-release
./update - 编译并上传cf-mysql-release至blobstore
bosh create release releases/cf-mysql-8.yml
bosh upload release releases/cf-mysql-8.tgz - 创建并编写yml部署文件
---
name: CFMYSQL02
director_uuid: fdd46e30-f2c5-41dc-9662-0976fdac5716 releases:
- name: cf-mysql
version: 8 compilation:
workers: 2
cloud_properties:
ram: 2048
disk: 6144
cpu: 2
network: default
reuse_compilation_vms: true update:
canaries: 1
#waiting for 60s to get update job status
canary_watch_time: 30000-180000
update_watch_time: 30000-180000
max_in_flight: 4
max_errors: 4 networks:
- name: default
subnets:
- 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.100
gateway: 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-tabasco
environment: ~ external_domain: acp.local
apps_domain: acp.local
nats:
user: nats
password: c1oudc0w
port: 4222
machines:
- 192.168.2.43
use_gnatsd: true resource_pools:
- name: services-small
network: default
size: 5
stemcell:
name: bosh-vsphere-esxi-ubuntu
# Stemcell version 2200 is the first to support errands for aws and vsphere
version: 2366
cloud_properties:
ram: 2048
disk: 20480
cpu: 1 jobs:
- name: mysql
release: cf-mysql
template: mysql
instances: 1
resource_pool: services-small
persistent_disk: 10000
networks:
- name: default
static_ips: 192.168.2.56
properties:
admin_password: c1oudc0w
max_connections: 1500
max_user_connections: 40
cluster_ips:
- 192.168.2.56
- name: cf-mysql-broker
release: cf-mysql
template: cf-mysql-broker
instances: 1
resource_pool: services-small
networks:
- name: default
static_ips: 192.168.2.57
properties:
auth_username: root
auth_password: c1oudc0w
cookie_secret: c1oudc0w
external_host: p-mysql.acp.local
ssl_enabled: false
skip_ssl_validation: true
cc_api_uri: https://api.acp.local
nats:
user: nats
password: c1oudc0w
port: 4222
machines:
- 192.168.2.43
use_gnatsd: true
networks:
broker_network: default
services:
- name: p-mysql
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,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABoxJREFUeNrkW01sG0UUnkQ90FNNOfVHilvKBQS2iASHVtiCHkAqxI3ECZG4KOJGnOZQxCVxeuHnEJz0BlVjF3FCyg9UooeKOogeqBTkOEov/DlS056a2hfCASm8b3izXY/XZr07Xq/hSSs7jr2775v3vu+92Zm+vb098X+2fR2/wAeZCL0k6YjzEeHXA9pXa3SU+H2R35f++nCu0sn76+tEBJDTcDDNjsd8nm6LjmU68gRGKdQAkONwesKA063AyDEY1dAAwI5n6RgIKHVrDETOLxC+ACDHEeL5AB13AiJNICwHCgATG0Y8ExIyX2Egqh0HgAku38E89xMNKQKh2M6P+tt0PsUSFTbnBcvqTeYj8wD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uUVAFtBgIAOT84dEAiqmkNEgFOac851qwYwbZgYUQBUgooE5DTIcy1zwZoU1cmunv1/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-mysql
secret: c1oudc0w
plans:
- name: 100mb-dev
id: ab08f1bc-e6fc-4b56-a767-ee0fea6e3f20
description: Shared MySQL Server
max_storage_mb: 100
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"
mysql_node:
host: 192.168.2.56 # 也能够设置成外部的mysql节点
admin_password: c1oudc0w
- name: broker-registrar
template: broker-registrar
release: cf-mysql
instances: 1
resource_pool: services-small
lifecycle: errand
networks:
- name: default
properties:
cf:
api_url: https://api.acp.local
admin_username: admin
admin_password: admin
broker:
name: p-mysql
host: p-mysql.acp.local
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: https://api.acp.local
admin_username: admin
admin_password: admin
broker:
name: p-mysql
host: p-mysql.acp.local
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: https://api.acp.local
admin_username: admin
admin_password: admin
apps_domain: acp.local
skip_ssl_validation: true
broker:
host: p-mysql.acp.local
service:
name: p-mysql
plan_name: 100mb-dev
max_storage_mb: 100
properties: {} # Pivotal CF cannot generate global properties - 部署
bosh deploy
- 注冊Mysql-Broker
cf create-service-broker p-mysql root c1oudc0w http://p-mysql.acp.local
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3poZW55YW5nX2dv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
- 改动service_plan的訪问权限为public
cf curl /v2/service_plans
找到guid后边的值并复制
改动相应权限为public
cf curl PUT /v2/service_plans/060cb8c2-3633-493c-acf1-3b60e78aacd4 -b '{"public":'true'}' - 创建service
cf create-service
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3poZW55YW5nX2dv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
- 绑定应用至service
cf bind-service java-hello-offline-mysql p-mysql-32d67
- 上传绑定好的应用
cf push java-hello-offline-mysql -b java-buildpack-offline
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3poZW55YW5nX2dv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
- 检查service
cf services
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3poZW55YW5nX2dv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
CloudFoundry Service 使用的更多相关文章
- cloudfoundry service broker 制作
实验室这边需要制作service broker.从今天开始将精力投入其中.
- SpringCloud-初识
说道SpringCloud,原来就去了解过,也有很大兴趣,只是当初不知道这是个什么东西.在它之前,我学习Spring,在官网肆无忌惮的逛的时候,发现了SpringBoot,那个时候就打算开始学习Spr ...
- Cloud Foundry中 JasperReports service集成
Cloud Foundry作为业界第一个开源的PaaS解决方案,正越来越多的被业界接受和认可.随着PaaS的发展,Cloud Foundry顺应潮流,充分发挥开源项目的特点,到目前为止,已经支持了大批 ...
- Cloud Foundry中通用service的集成
目前,CloudFoundry已经集成了很多第三方的中间件服务,并且提供了用户添加自定义服务的接口.随着Cloud Foundry的发展,开发者势必会将更多的服务集成进Cloud Foundry,以供 ...
- CloudFoundry.yml修订
--- name: CFRELEASE02 director_uuid: fdd46e30-f2c5-41dc-9662-0976fdac5716 releases: - name: cf versi ...
- Service Mesh简介
1.1 Service Mesh 1.1.1 什么是Service Mesh Service Mesh是最近才兴起的一个名词,最早在2016年9月29日由开发Linkerd的Buoyant公司首次 ...
- 开源的PaaS方案:在OpenStack上部署CloudFoundry (五)常见问题
部署CloudFoundry可能遇到的问题 1. Bosh 报告 OpenStack API Request Entity Too Large error 解决办法,修改/etc/nova/api-p ...
- 开源的PaaS方案:在OpenStack上部署CloudFoundry (二)部署OpenStack
硬件要求 安装OpenStack 1 安装CentOS 65系统并清空iptables防火墙规则 2 安装系统需要的工具包包括Openstack依赖的和CloudFoundry依赖的 3 安装EPEL ...
- 开源的PaaS方案:在OpenStack上部署CloudFoundry (一)简介
目录(?)[-] OpenStack简介 OpenStack是一个美国国家航空航天局和Rackspace合作研发的以Apache许可证授权并且是一个自由软件和开放源代码项目 OpenStack是一个云 ...
随机推荐
- (转)DEDECMS模板原理、模板标签学习 - .Little Hann
本文,小瀚想和大家一起来学习一下DEDECMS中目前所使用的模板技术的原理: 什么是编译式模板.解释式模板,它们的区别是什么? 模板标签有哪些种类,它们的区别是什么,都应用在哪些场景? 学习模板的机制 ...
- 关于IO学习的几个函数
这是最近学到的几个关于IO文件操作的几个小算法,今天总结出来. 1. 删除一个给定的目录,这上目录不为空目录,使用递归来实现 public void test04(File file) { File[ ...
- 通知(Notification)的使用
新建一个 NotificationTest项目,并修改 activity_main.xml 中的代码,如下所示:<LinearLayout xmlns:android="http:// ...
- JSON解析之——Android
JSON解析之——Android 一.google天气案例 之前xml学习中的google天气的例子非常形象,所以我们继续以google天气作为案例进行学习,下面是我从google官网下载下来的天气J ...
- 【转】iOS申请发布证书-图文详解
摘要 发布产品到App Store所需证书,2013年5月26日测试 IOS 发布证书 distribution 打包程序 真机调试证书 本文讲述发布证书的申请,申请真机调试证书请参考:http:// ...
- 苹果被拒的血泪史。。。(update 2015.11)
项目提交了N此了,也审核N次了,苹果的审核机制依旧那么不急不慢.昨天刚刚又被拒了.回忆下之前的,总结一下吧. 2015.04.28 昨天被拒非常亏,app的评级是17+,但是在app展示图里有一个比较 ...
- nodejs概论(实操篇)
什么是模块? 模块分为原生模块(node.jsAPI提供的原生模块,在启动时已经被加载)和 文件模块(动态加载模块,主要由原生模块module来实现和完成.通过调 用node.js的require方法 ...
- centos 6.X 安装输入法
1.打开终端 su 输入 密码 yum install "@Chinese Support" 2.接下来是启用中文输入法的操作 系统 ->首选项 ->输入法 3.在弹出 ...
- Java并发编程之CAS
CAS(Compare and swap)比较和替换是设计并发算法时用到的一种技术.简单来说,比较和替换是使用一个期望值和一个变量的当前值进行比较,如果当前变量的值与我们期望的值相等,就使用一个新值替 ...
- spring web flow 2.0入门(转)
Spring Web Flow 2.0 入门 一.Spring Web Flow 入门demo(一)简单页面跳转 附源码(转) 二.Spring Web Flow 入门demo(二)与业务结合 附源码 ...