brooklyn mac
Greetings, fellow developers!!
问候,同伴们!!
The control and management of computing systems have evolved from an environment in which a single process running on a computer system to a large, complex and dynamic environment in which multiple processes running on geographically dispersed heterogeneous computers that could span several continents.
计算系统的控制和管理已从在计算机系统上运行单个进程的环境演变为在大型,复杂而动态的环境中运行的大型环境,在该环境中,多个进程在可能跨越多个洲的地理位置分散的异构计算机上运行。
什么是自主计算? (What is Autonomic Computing?)
Autonomic computing is a term used by IBM to describe the need to shift the burden of managing IT systems from IT professionals to the systems themselves. Autonomic computing is a computer’s ability to manage itself automatically through adaptive technologies that further computing capabilities and cut down on the time required by computer professionals to resolve system difficulties and other maintenance such as software updates.
自主计算是IBM用来描述将管理IT系统的负担从IT专业人员转移到系统本身的需求的术语。 自主计算是计算机通过自适应技术自动管理自身的能力,该技术可进一步提高计算能力并减少计算机专业人员解决系统难题和其他维护(如软件更新)所需的时间。
![Image for post](https://miro.medium.com/max/9999/1*wTq4MtzCNRpuSMxOy4200Q.png)
什么是Apache Brooklyn? (What is Apache Brooklyn?)
This is where Apache Brooklyn comes into picture. Brooklyn is an open source framework which is able to manage provisioning and application deployment, monitor an application’s health and metrics, understand the dependencies between components (such as knowing that adding a new web server means that the load-balancer needs reconfiguration) and apply complex policies to manage the application. Major influence on the design of Brooklyn are the ideas of autonomic computing and promise theory.
这就是Apache Brooklyn出现的地方。 Brooklyn是一个开放源代码框架,该框架能够管理配置和应用程序部署,监视应用程序的运行状况和指标,了解组件之间的依赖关系(例如知道添加新的Web服务器意味着负载均衡器需要重新配置)并能够应用复杂管理应用程序的策略。 对布鲁克林设计的主要影响是自主计算和诺言理论的思想。
![Image for post](https://miro.medium.com/max/9999/1*AiPVCxkXH-liAEMQB1UPnw.png)
布鲁克林的重要元素 (Important Elements of Brooklyn)
BLUEPRINTS: Brooklyn uses YAML blueprints to describe an application and its components. These blueprints,which incorporate policies to manage an application, can be treated as modular components that can be composed and reused in many ways.
蓝图: Brooklyn使用YAML蓝图来描述应用程序及其组件。 这些包含用于管理应用程序的策略的蓝图可以视为可以以多种方式组成和重用的模块化组件。
LOCATIONS: Locations can be defined in order to specify where the processes of an application will run. Brooklyn supports different cloud providers and pre-prepared machines (including localhost).
位置:可以定义位置以指定应用程序的进程将在何处运行。 布鲁克林支持不同的云提供商和预先准备的计算机(包括本地主机)。
ENTITIES: The central concept in a Brooklyn deployment is that of an entity. An entity represents a resource under management (individual machines or software processes) or logical collections of these. They can have events, operations, and processing logic associated with them, and it is through this mechanism that the active management is delivered.
实体:在布鲁克林部署的中心概念是实体的。 实体表示受管理的资源(单个机器或软件过程)或这些资源的逻辑集合。 它们可以具有事件,操作和与它们相关联的处理逻辑,并且通过这种机制可以交付主动管理。
APPLICATIONS: These are the top-level entities that are the parents of all other entities.
应用程序:这些是顶级实体,是所有其他实体的父级。
SENSORS: Sensors are the mechanism for entities to expose information for other entities to see. Sensors from an entity can be subscribed to by other entities to track changes in the entity’s activity. Sensors can be updated, potentially frequently, by the entity or associated tasks.
传感器:传感器是实体将信息公开给其他实体查看的机制。 来自其他实体的传感器可以由其他实体订阅,以跟踪该实体活动的变化。 实体或关联的任务可能会频繁更新传感器。
EFFECTORS: Effectors are a means by which you can manipulate the entities in an application. Note that the three “life-cycle” related effectors, start, stop, and restart are common to all applications and software process entities in Brooklyn.
效应器:效应器是一种您可以在应用程序中操作实体的方法。 请注意,三个“生命周期”相关的效应器start , stop和restart对于布鲁克林的所有应用程序和软件过程实体都是通用的。
POLICIES: Policies perform the active management enabled by Brooklyn. Entities can have policy instances attached to them, which can subscribe to sensors from other entities or run periodically. When they run they can perform calculations, look up other values, invoke effectors or emit sensor values from the entity with which they are associated. A policy coordinates the runtime management of entities by carrying out actions, initiated by specific triggers. Policies are often used to keep the system in a healthy state, such as handling failures and auto-scaling.
政策:政策执行布鲁克林启用的主动管理。 实体可以附加有策略实例,这些策略实例可以订阅其他实体的传感器或定期运行。 当它们运行时,它们可以执行计算,查找其他值,调用效应器或从与它们关联的实体发出传感器值。 策略通过执行由特定触发器启动的动作来协调实体的运行时管理。 策略通常用于使系统保持健康状态,例如处理故障和自动扩展。
布鲁克林提供的不同政策 (Different Policies Provided by Brooklyn)
Auto-Scaler: Dynamically adjusts its size in response to keeping a metric within a given range.
自动缩放器:动态调整其大小,以将指标保持在给定范围内。
Service Replacer: Replaces a failed member.
服务替换器:替换失败的成员。
Service Restarter: Restart the service on failure.
服务重新启动器:失败时重新启动服务。
Connection-failure detector: Emits an event if the connection is lost/ restored used for monitoring a host port
连接失败检测器:如果连接丢失/恢复,则发出事件,用于监视主机端口
Elect-primary policy: Keeps exactly one of its children or members as primary
选举为主政策:将其子女或成员中的一个保持为首要
Periodic-effector execution: Executes after a particular interval
定期执行器执行:在特定间隔后执行
Scheduled-effector execution: Executes at a configurable time or configurable delay
计划执行器执行:在可配置的时间或可配置的延迟执行
SSH-connectivity failure detector: Emits an event if connection is lost/ restored used for monitoring an SSH machine
SSH连接故障检测器:如果连接丢失/恢复,则发出事件,用于监视SSH计算机
使用Apache Brooklyn进行部署 (Deployment using Apache Brooklyn)
Apache Brooklyn uses Apache jclouds to support a range of cloud locations. The identifiers for some of the most commonly used jclouds-supported clouds are :
Apache Brooklyn使用Apache jclouds支持多种云位置。 一些最常用的jclouds支持的云的标识符为:
jclouds:aws-ec2:<region>
: Amazon EC2, where:<region>
might beus-east-1
oreu-west-1
(or omitted)jclouds:aws-ec2:<region>
:Amazon EC2,其中:<region>
可能是us-east-1
或eu-west-1
(或省略)
jclouds:aws-ec2:<region>
: Amazon EC2, where :<region>
might be us-east-1
or eu-west-1
(or omitted)
jclouds:aws-ec2:<region>
:Amazon EC2,其中:<region>
可能是us-east-1
或eu-west-1
(或省略)
jclouds:softlayer:<region>
: IBM Softlayer, where:<region>
might bedal05
orams01
(or omitted)jclouds:softlayer:<region>
:IBM Softlayer,其中:<region>
可能是dal05
或ams01
(或省略)jclouds:google-compute-engine
: Google Compute Enginejclouds:google-compute-engine
:Google Compute Enginejclouds:openstack-nova:<endpoint>
: OpenStack, where:<endpoint>
is the access URL (required)jclouds:openstack-nova:<endpoint>
:OpenStack,其中:<endpoint>
是访问URL(必需)jclouds:cloudstack:<endpoint>
: Apache CloudStack, where:<endpoint>
is the access URL (required)jclouds:cloudstack:<endpoint>
:Apache CloudStack,其中:<endpoint>
是访问URL(必需)
name: Tomcat Cluster
location:
'jclouds:aws-ec2':
identity: ******************
credential: *****************************
hardwareId: t2.micro
region: us-west-2
services:
- type: org.apache.brooklyn.entity.group.DynamicCluster
name: Cluster
id: cluster
brooklyn.config:
cluster.initial.size: 1
dynamiccluster.memberspec:
'$brooklyn:entitySpec':
type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
name: Tomcat Server
brooklyn.config:
wars.root: >-https://search.maven.org/remotecontent?filepath=org/apache/brooklyn/example/brooklyn-example-hello-world-webapp/0.12.0/brooklyn-example-hello-world-webapp-0.12.0.war
brooklyn.policies:
- type: org.apache.brooklyn.policy.ha.ServiceRestarter
brooklyn.config:
failOnRecurringFailuresInThisDuration: 5m
brooklyn.enrichers:
- type: org.apache.brooklyn.policy.ha.ServiceFailureDetector
brooklyn.config:
entityFailed.stabilizationDelay: 30s
brooklyn.policies:
- type: org.apache.brooklyn.policy.ha.ServiceReplacer
- type: org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy
brooklyn.config:
metric: webapp.reqs.perSec.perNode
metricUpperBound: 3
metricLowerBound: 1
resizeUpStabilizationDelay: 2s
resizeDownStabilizationDelay: 1m
maxPoolSize: 3
brooklyn.enrichers:
- type: org.apache.brooklyn.enricher.stock.Aggregator
brooklyn.config:
enricher.sourceSensor: '$brooklyn:sensor("webapp.reqs.perSec.windowed")'
enricher.targetSensor: '$brooklyn:sensor("webapp.reqs.perSec.perNode")'
enricher.aggregating.fromMembers: true
transformation: average
- type: org.apache.brooklyn.entity.proxy.nginx.NginxController
name: Load Balancer (nginx)
brooklyn.config:
loadbalancer.serverpool: '$brooklyn:entity("cluster")'
nginx.sticky: false
The above YAML gives an architecture for an application consisting of a cluster of tomcat servers and an nginx load-balancer. Two policies: Service replacer and Auto-scaler are applied to the cluster.
上面的YAML提供了一种应用程序的体系结构,该应用程序由tomcat服务器群集和nginx负载均衡器组成。 两个策略:服务替换器和自动缩放器应用于集群。
![Image for post](https://miro.medium.com/max/9999/1*QyHZ22NnRUyDSBxaVAnp3w.png)
Adding the above code in the YAML editor gives a graphical design of the architecture, Brooklyn gives the flexibility to edit the architecture and policies for each entity through UI as well .
将上述代码添加到YAML编辑器中可以对架构进行图形化设计,布鲁克林还可以灵活地通过UI为每个实体编辑架构和策略。
![Image for post](https://miro.medium.com/max/9999/1*RhLY9sqeS2PjDNmcX7JssA.png)
Brooklyn provides details regarding events and the actions taken by brooklyn to resolve any abnormalities seen in application behavior. The graphical visualization is rather poor, brooklyn provides only a quilt diagram for graphical representation of the events which is not so intuitive.
布鲁克林提供有关事件和布鲁克林为解决应用程序行为中发现的任何异常而采取的措施的详细信息。 图形的可视化效果很差,布鲁克林仅提供用于事件的图形表示的被子图,但不那么直观。
![Image for post](https://miro.medium.com/max/9999/1*A-jTQq6dsAUgUrldEqljKw.png)
优点和缺点 (PROS and CONS)
优点 (PROS)
- Brooklyn is an open-source tool which is big plus and the setup is rather simple. 布鲁克林是一个开放源码的工具,它的优点是很大,而且设置非常简单。
Brooklyn uses Apache jclouds to support a range of cloud platforms.
布鲁克林使用Apache jclouds支持多种云平台。
- Events and the actions taken are displayed in the activities page. 事件和采取的措施显示在活动页面中。
- Gives intelligence on what sensors are available based on the entity. 提供有关基于实体的可用传感器的智能。
- Location for deployment can be saved which can be used when deploying other services avoiding repetition. 可以保存部署位置,可以在部署其他服务时避免重复使用。
- Policies and entities can be configured to great levels of precision as per user requirements. 可以根据用户要求将策略和实体配置为很高的精度。
- Custom sensors can be created by using enrichers, combining one or more sensors using mathematical operators like aggregators, reducers, combiners, deltas, mean and other enrichers. 可以通过使用增强器创建自定义传感器,并使用数学运算符(例如聚合器,归约器,组合器,增量,均值和其他增强器)组合一个或多个传感器。
- Can deploy applications using CLI or dashboard (can deploy through a yaml file called blueprint.) 可以使用CLI或仪表板部署应用程序(可以通过名为blueprint的yaml文件进行部署。)
缺点 (CONS)
- Deployment has to be done through brooklyn itself for it to monitor applications, it cannot monitor applications that have already been deployed. 部署必须通过布鲁克林本身来进行,以监视应用程序,但不能监视已经部署的应用程序。
- Doesn’t provide canary deployment (version deployment). 不提供金丝雀部署(版本部署)。
- Doesn’t provide graphical visualization for the application metrics. 不为应用程序指标提供图形化可视化。
- Doesn’t monitor the in-app events and exceptions but monitors the state of entire entity. 不监视应用内事件和异常,而是监视整个实体的状态。
- Doesn’t provide distributed tracing for application calls. 不为应用程序调用提供分布式跟踪。
- Brooklyn isn’t compatible for Docker swarm and Kubernetes cluster. 布鲁克林与Docker swarm和Kubernetes集群不兼容。
Apache Brooklyn is a remarkable tool despite the cons. The docker and kubernetes incompatibility can be solved using an extension built on top of brooklyn called Clocker developed by Cloudsoft. Hope you guys try out brooklyn in your next projects.
尽管存在弊端,Apache Brooklyn还是一个了不起的工具。 docker和kubernetes的不兼容性可以使用Cloudsoft开发的布鲁克林顶部的名为Clocker的扩展程序来解决。 希望你们在下一个项目中尝试布鲁克林。
This is Vinesh signing-off. Byeee :)
这是Vinesh签字。 Byeee:)
翻译自: https://medium.com/@vinzee/apache-brooklyn-a-step-towards-autonomic-computing-8d5f06e4d9e6
brooklyn mac