979
技術社區[雲棲]
集群管理器和調度器 Nomad
Nomad 詳細介紹
Nomad 是一個集群管理器和調度器,專為微服務和批量處理工作流設計。Nomad 是分布式,高可用,可擴展到跨數據中心和區域的數千個節點。
Nomad 提供一個常規工作流跨基礎設施部署應用。開發者使用一個聲明式作業規範來定義應用該如何部署,資源有什麼要求(CPU,內存,硬盤)。Nomad 接收這些作業,查找可用的資源來運行應用。調度算法確保所有的約束都滿足,盡量在一個主機部署盡可能多的應用,優化資源利用。此外,Nomad 支持在所有主流操作係統運行虛擬化,容器化或者是獨立的應用,靈活的支持廣泛的工作流負載。
Nomad 已經在生產環境使用,主要特性:
Docker:Nomad 支持 Docker 作為第一類的工作負載類型
操作簡單
多個數據中心和多個區域
靈活的工作負載
可擴展
代碼示例:
# Define the hashicorp/web/frontend job
job "hashicorp/web/frontend" {
# Run in two datacenters
datacenters = ["us-west-1", "us-east-1"]
# Only run our workload on linux
constraint {
attribute = "$attr.kernel.name"
value = "linux"
}
# Configure the job to do rolling updates
update {
# Stagger updates every 30 seconds
stagger = "30s"
# Update a single task at a time
max_parallel = 1
}
# Define the task group
group "frontend" {
# Ensure we have enough servers to handle traffic
count = 10
task "web" {
# Use Docker to run our server
driver = "docker"
config {
image = "hashicorp/web-frontend:latest"
}
# Ask for some resources
resources {
cpu = 500
memory = 128
network {
mbits = 10
dynamic_ports = ["http"]
}
}
}
}
}
文章轉載自 開源中國社區[https://www.oschina.net]
最後更新:2017-07-08 11:03:31