druid/docs/content/Rule-Configuration.md

125 lines
3.3 KiB
Markdown
Raw Normal View History

---
2013-09-26 19:22:28 -04:00
layout: doc_page
---
2014-01-16 18:37:07 -05:00
# Configuring Rules for Coordinator Nodes
2014-10-21 19:08:56 -04:00
Rules indicate how segments should be assigned to different historical node tiers and how many replicas of a segment should exist in each tier. Rules may also indicate when segments should be dropped entirely from the cluster. The coordinator loads a set of rules from the metadata storage. Rules may be specific to a certain datasource and/or a default set of rules can be configured. Rules are read in order and hence the ordering of rules is important. The coordinator will cycle through all available segments and match each segment with the first rule that applies. Each segment may only match a single rule.
Note: It is recommended that the coordinator console is used to configure rules. However, the coordinator node does have HTTP endpoints to programmatically configure rules.
2013-09-13 18:20:39 -04:00
2014-10-21 19:08:56 -04:00
2013-09-13 18:20:39 -04:00
Load Rules
----------
2014-10-21 19:08:56 -04:00
Load rules indicate how many replicas of a segment should exist in a server tier.
### Forever Load Rule
Forever load rules are of the form:
```json
{
"type" : "loadForever",
"tieredReplicants": {
"hot": 1,
"_default_tier" : 1
}
}
```
* `type` - this should always be "loadByInterval"
* `tieredReplicants` - A JSON Object where the keys are the tier names and values are the number of replicas for that tier.
2013-09-13 18:20:39 -04:00
### Interval Load Rule
Interval load rules are of the form:
```json
{
"type" : "loadByInterval",
2014-10-21 19:08:56 -04:00
"interval": "2012-01-01/2013-01-01",
"tieredReplicants": {
"hot": 1,
"_default_tier" : 1
}
}
```
* `type` - this should always be "loadByInterval"
* `interval` - A JSON Object representing ISO-8601 Intervals
2014-10-21 19:08:56 -04:00
* `tieredReplicants` - A JSON Object where the keys are the tier names and values are the number of replicas for that tier.
2013-09-13 18:20:39 -04:00
### Period Load Rule
Period load rules are of the form:
```json
{
"type" : "loadByPeriod",
"period" : "P1M",
2014-10-21 19:08:56 -04:00
"tieredReplicants": {
"hot": 1,
"_default_tier" : 1
}
}
```
2013-09-13 18:20:39 -04:00
* `type` - this should always be "loadByPeriod"
* `period` - A JSON Object representing ISO-8601 Periods
2014-10-21 19:08:56 -04:00
* `tieredReplicants` - A JSON Object where the keys are the tier names and values are the number of replicas for that tier.
2013-09-13 18:20:39 -04:00
The interval of a segment will be compared against the specified period. The rule matches if the period overlaps the interval.
Drop Rules
----------
Drop rules indicate when segments should be dropped from the cluster.
2014-10-21 19:08:56 -04:00
### Forever Drop Rule
Forever drop rules are of the form:
```json
{
"type" : "dropForever"
}
```
* `type` - this should always be "dropByPeriod"
All segments that match this rule are dropped from the cluster.
2013-09-13 18:20:39 -04:00
### Interval Drop Rule
Interval drop rules are of the form:
```json
{
"type" : "dropByInterval",
"interval" : "2012-01-01/2013-01-01"
}
```
2013-09-13 18:20:39 -04:00
* `type` - this should always be "dropByInterval"
* `interval` - A JSON Object representing ISO-8601 Periods
2013-09-13 18:20:39 -04:00
A segment is dropped if the interval contains the interval of the segment.
### Period Drop Rule
Period drop rules are of the form:
```json
{
"type" : "dropByPeriod",
"period" : "P1M"
}
```
2013-09-13 18:20:39 -04:00
* `type` - this should always be "dropByPeriod"
* `period` - A JSON Object representing ISO-8601 Periods
2013-09-13 18:20:39 -04:00
The interval of a segment will be compared against the specified period. The period is from some time in the past to the current time. The rule matches if the period contains the interval.