2020-03-24 22:26:34 +00:00
|
|
|
---
|
|
|
|
layout: docs
|
|
|
|
page_title: scaling Stanza - Job Specification
|
2020-04-07 18:22:13 +00:00
|
|
|
sidebar_title: scaling <sup>Beta</sup>
|
2020-03-24 22:26:34 +00:00
|
|
|
description: The "scaling" stanza allows specifying scaling policy for a task group
|
|
|
|
---
|
|
|
|
|
|
|
|
# `scaling` Stanza
|
|
|
|
|
|
|
|
<Placement groups={['job', 'group']} />
|
|
|
|
|
|
|
|
The `scaling` stanza allows configuring scaling options for a task group, for the purpose
|
2020-07-10 14:07:29 +00:00
|
|
|
of supporting external autoscalers like the [Nomad Autoscaler](https://github.com/hashicorp/nomad-autoscaler)
|
2020-07-24 08:05:38 +00:00
|
|
|
and scaling via the Nomad UI. This stanza is not supported within jobs of type `system`.
|
2020-03-24 22:26:34 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
job "example" {
|
|
|
|
datacenters = ["dc1"]
|
|
|
|
group "cache" {
|
|
|
|
task "redis" {
|
|
|
|
driver = "docker"
|
|
|
|
config {
|
|
|
|
image = "redis:3.2"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scaling {
|
|
|
|
enabled = true
|
|
|
|
min = 0
|
|
|
|
max = 10
|
|
|
|
policy {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## `scaling` Parameters
|
|
|
|
|
2020-04-23 14:38:08 +00:00
|
|
|
- `min` - <code>(int: nil)</code> - The minimum acceptable count for the task group.
|
2020-03-24 22:26:34 +00:00
|
|
|
This should be honored by the external autoscaler. It will also be honored by Nomad
|
|
|
|
during job updates and scaling operations. Defaults to the specified task group [count][].
|
|
|
|
|
2020-04-23 14:38:08 +00:00
|
|
|
- `max` - <code>(int: <required>)</code> - The maximum acceptable count for the task group.
|
2020-03-24 22:26:34 +00:00
|
|
|
This should be honored by the external autoscaler. It will also be honored by Nomad
|
|
|
|
during job updates and scaling operations.
|
|
|
|
|
|
|
|
- `enabled` - <code>(bool: false)</code> - Whether the scaling policy is enabled.
|
|
|
|
This is intended to allow temporarily disabling an autoscaling policy, and should be
|
|
|
|
honored by the external autoscaler.
|
|
|
|
|
|
|
|
- `policy` - <code>(map<string|...>: nil)</code> - The autoscaling policy. This is
|
2020-03-26 20:21:24 +00:00
|
|
|
opaque to Nomad, consumed and parsed only by the external autoscaler. Therefore,
|
|
|
|
its contents are specific to the autoscaler; see autoscaler documentation.
|
2020-03-24 22:26:34 +00:00
|
|
|
|
2020-03-26 20:21:24 +00:00
|
|
|
[count]: /docs/job-specification/group/#count 'Nomad Task Group specification'
|