博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
服务Recipes
阅读量:6825 次
发布时间:2019-06-26

本文共 4907 字,大约阅读时间需要 16 分钟。

hot3.png

一项服务由服务描述文件和其支持的文件组成。

服务描述文件(Service Descriptor File)

描述了以下信息:

  • General: 描述服务的 name, service type, number of service instances, and the service icon filename
  • Compute: 指定供应machines时的template名称。 这个名字与cloud driver中定义的template名字相一致。描述machine池中可用于服务实例的machine硬件配置文件。硬件配置文件映射到一个特定的硬件设置和镜像大小(e.g. 在Amazon EC2将映射为镜像大小相关的硬件id[m1.small, c1.medium, etc.] and an ami id). 这可以与云环境中应用recipe运行的machine进行清晰的区别开。更多的可以参见 Cloud Drivers.
  • Lifecycle Events: Maps events to handling scripts or closures and, as such, is the most important part of the service recipe. An event handler can be an external Groovy script, a shell script, or a batch file (depending on the operating system). The handlers must reside in the service folder
    Cloudify can use the same recipe for different operating systems, as long as you specify the relevant instructions for each within the recipe, or the instructions are generic to all of them. The use of handler files is optional. For example, if a post-installation script is not specified in the service recipe, then Cloudify does not execute a handler after the service has been installed.
  • : Maps custom commands to handling scripts that can be invoked as commands using the Cloudify shell
  • : For monitoring service configuration, performance, and availability
  • : Describes the layout to use for displaying the collected metrics in the
    In future releases, Cloudify will also support “provided services”. These services are not provisioned by Cloudify and are only monitored for availability.
General Section

The General section describes the following attributes:

name

服务名称是相对各种Cloudify管理和监控工具,用于标识服务。因此,相同的Cloudify controller管理的所有应用的名称必须是唯一的。

icon

使用可选的图像文件作为Application Map中的服务务图标,将会显示在 .

It is recommended that the image will not exceed the size of 20×20 pixels, as this can burden the image loading within the Web Management Console, thus resulting in slower performance. Images exceeding the specified dimensions will be scaled to fit regardless.

type

服务类型,Cloudify web management console 在Application Map中定位服务。 If you do not specify an icon in this section, the service type is used to determine the default icon to display in the Application Map. 以下是可支持的类型:

  • WEB_SERVER
  • APP_SERVER
  • DATABASE
  • NOSQL_DB
  • MESSAGE_BUS
  • ESB_SERVER
  • LOAD_BALANCER
  • SECURITY_SERVER

numInstances

当服务启动时,供应初始的实例数。

General section示例如下:

 

service {

name "jboss-service"

icon "jboss.jpg"

type "APP_SERVER"

numInstances 2

 

//recipe body here

}

Isolation SLA (Multi Tenant Deployment)

Cloudify 允许在同一主机中部署多项服务。

此举的目的是,在基于BYON云时,将物理机最大化利用。支持以下四种模式:

  1. dedicated (default) – 该主机仅专用于一种服务实例。其它服务不能在该主机上部署。
  2. global – 该主机可能被所有的应用和租户共享。在 Isolation SLA部分配置其共享容量。
  3. appShared – 同一应用的服务可以共享machines。
  4. tenantShared – 同一租户(相同的安全验证组)的服务可共享machines。
在当前版本中,在managent machines中安装服务/应用仅允许global mode.

例子:

 

service {

name "groovy"

type "WEB_SERVER"

elastic true

numInstances 2

maxAllowedInstances 2

// define SLA requirements for each service instance with regards to isolation from other services

// if this is not defined - defaults to dedicated mode. which means each service instance is insalled on a dedicated VM.

isolationSLA {

global { // global - meaning each service instance can be installed on any VM that answer the requirements below.

// allowing services to share VM's. Note: VM's running management process are not included.

instanceCpuCores 0 // no CPU requirements, this way instances can be installed on the same VM even if it has just one CPU(can also define 0.5 CPU requirements and so on...)

instanceMemoryMB 128 // each instance needs 128MB to be allocated for him on the VM.

useManagement true // Enables installing services/applications on the management machines. Defaults to false.

}

}

可以定义在 -service.groovy :

 

isolationSLA {

appShared { // services belonging to the same application may share machines

instanceCpuCores 0

instanceMemoryMB 128

}

}

 

 

isolationSLA {

global { // all services may share machines

instanceCpuCores 0

instanceMemoryMB 128

}

}

 

isolationSLA {

tenantShared { // service belonging to the same authenticationGroup may share machines

instanceCpuCores 0

instanceMemoryMB 128

}

}

如果没有对其定义,那么a dedicated isolation 将被使用,即服务实例不能共享machines。
这项特性仅在 BYON Cloud Driver上做过测试。
Prior to using this, please read how to .

从一个文件加载 Sections

描述文件中的任一sections可以从外部文件中加载服务信息到描述文件中。这样,某一sections可以被多个服务的描述文件共享。

在服务描述文件中,定义在General section的Groovy参数可以被外部文件使用。

例如,定义一个标准的web management console metrics布局, 如下:

  1. 在一个外部文件中定义userInterface section。

    userInterface {

    metricGroups = [

    metricGroup{

    name = "process"

    metrics = ["cpu", "memory"]

    }

    ]

    widgetGroups = [

    widgetGroup{

    name ="cpu"

    widgets = [

    balanceGauge{metric = "cpu"},

    barLineChart{metric = "cpu"}

    ]

    },

    widgetGroup {

    name = "memory"

    widgets = [

    balanceGauge { metric = "memory" },

    barLineChart{ metric = "memory"

    axisYUnit Unit.PERCENTAGE

    }

    ]

    }

    ]

    }

  2. 在服务文件中可加载外部文件。

    service {

    name "myService"

    ...

    userInterface load("userInterface.groovy")

    }

转载于:https://my.oschina.net/hjswust/blog/123508

你可能感兴趣的文章
JQuery实现简单的服务器轮询效果
查看>>
项目Alpha冲刺 1
查看>>
项目Alpha冲刺 10
查看>>
【转载】.NET中使用Redis
查看>>
Go 在游戏行业中的工程实践
查看>>
javascript 性能优化
查看>>
html禁止清除input文本输入缓存
查看>>
数据库MySQL 之 库操作
查看>>
VS2017 添加引用时报错未能正确加载ReferenceManagerPackage包的解决方法(补充 ,使用vs命令工具时提示权限不足,需要管理员权限)...
查看>>
Oracle 11g 概述 chaper1
查看>>
pending list
查看>>
Cesium官方教程9--粒子系统
查看>>
java获取当前时间
查看>>
node:json与csv互转
查看>>
让webstorm里提示nodejs智能补全
查看>>
Dialog中EditText获取焦点,并且自动弹出软键盘
查看>>
缺陷报告的处理流程
查看>>
SQL Server 2008 "重新组织索引"和"重新生成索引"抉择,请大家帮帮看看
查看>>
shell做成csv文件
查看>>
Struts2之Action开发模式
查看>>