Github user drigodwin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-docs/pull/231#discussion_r149114860
  
    --- Diff: guide/blueprints/_elect-primary-policies.md ---
    @@ -0,0 +1,149 @@
    +
    +There are a collection of policies, enrichers, and effectors to assist 
with common
    +failover scenarios and more general anything which wants a primary elected 
and
    +re-elected.
    +
    +These can be used for:
    +
    +* Nominating one child among many to be noted as a primary via a sensor 
(simply add the `ElectPrimaryPolicy`)
    +* Allowing preferences for such children to be specified  (via 
`ha.primary.weight`)
    +* Causing the primary to change if the current primary goes down or away
    +* Causing `promote` and `demote` effectors to be invoked on the 
appropriate nodes when the primary is elected/changed
    +  (with the parent reset to `STARTING` while this occurs)
    +* Mirroring sensors and optionally effectors from the primary to the parent
    +
    +A simple example is as follows, deploying two `item` entities with one 
designated as primary
    +and its `main.uri` sensor published at the root. If "Preferred Item" 
fails, "Failover Item"
    +will be become the primary. Any `demote` effector on "Preferred Item" and 
any `promote` effector
    +on "Failover Item" will be invoked on failover.
    +
    +```
    +brooklyn.policies:
    +- type: org.apache.brooklyn.policy.ha.ElectPrimaryPolicy
    +  brooklyn.config:
    +    # `best` will cause failback to occur automatically when possible; 
could use `failover` instead
    +    primary.selection.mode: best
    +    propagate.primary.sensors: [ main.uri ]
    +
    +brooklyn.enrichers:
    +- # this enricher will cause the parent to report as failed if there is no 
primary
    +  type: org.apache.brooklyn.policy.ha.PrimaryRunningEnricher
    +
    +services:
    +- type: item
    +  name: Preferred Item
    +  brooklyn.config:
    +    ha.primary.weight: 1
    +- type: item
    +  name: Failover Item
    +```
    +
    +
    +#### ElectPrimary Policy
    +
    +- org.apache.brooklyn.policy.ha.ElectPrimaryPolicy
    +
    +The ElectPrimaryPolicy acts to keep exactly one of its children or members 
as primary, promoting and demoting them when required.
    +
    +A simple use case is where we have two children, call them North and 
South, and we wish for North to be primary.  If North fails, however, we want 
to promote and fail over to South.  This can be done by:
    +
    +* adding this policy at the parent
    +* setting ` ha.primary.weight` on North
    --- End diff --
    
    erroneous space before ha


---

Reply via email to