标签:row hostname efault table node user debug system inf
比较简单的集群搭建
一个server 三个client (单机) 参考代码 https://github.com/rongfengliang/nomad-cluster-demo
# Increase log verbosity
log_level = "DEBUG"
# Setup data dir 实际配置参考自己的配置路径,必须是绝对路径
data_dir = "/Users/dalong/mylearning/nomad-cluster/server/node1/data"
# Enable the server
server {
enabled = true
# Self-elect, should be 3 or 5 for production
bootstrap_expect = 1
}
三个
- client1
# Increase log verbosity
log_level = "DEBUG"
# Setup data dir
data_dir = "/Users/dalong/mylearning/nomad-cluster/client/client1"
# Give the agent a unique name. Defaults to hostname
name = "client1"
# Enable the client
client {
enabled = true
# For demo assume we are talking to server1. For production,
# this should be like "nomad.service.consul:4647" and a system
# like Consul used for service discovery.
servers = ["127.0.0.1:4647"]
}
# Modify our port to avoid a collision with server1
ports {
http = 5656
}
* client2
```code
# Increase log verbosity
log_level = "DEBUG"
# Setup data dir
data_dir = "/Users/dalong/mylearning/nomad-cluster/client/client2"
# Give the agent a unique name. Defaults to hostname
name = "client2"
# Enable the client
client {
enabled = true
# For demo assume we are talking to server1. For production,
# this should be like "nomad.service.consul:4647" and a system
# like Consul used for service discovery.
servers = ["127.0.0.1:4647"]
}
# Modify our port to avoid a collision with server1
ports {
http = 5657
}
# Increase log verbosity
log_level = "DEBUG"
# Setup data dir
data_dir = "/Users/dalong/mylearning/nomad-cluster/client/client3"
# Give the agent a unique name. Defaults to hostname
name = "client3"
# Enable the client
client {
enabled = true
# For demo assume we are talking to server1. For production,
# this should be like "nomad.service.consul:4647" and a system
# like Consul used for service discovery.
servers = ["127.0.0.1:4647"]
}
# Modify our port to avoid a collision with server1
ports {
http = 5658
}
测试,使用单
consul agent --dev
nomad agent -config server.hcl
按照实际,进入目录进行启动
nomad agent -config client(1、2、3).hcl
nomad server
client
nomad init
实际代码可以参考github
group "cache" {
count = 5
nomad run example.nomad
实际环境中我们使用集群环境,同时结合coredns 可以实现一些比较强大的功能。
https://www.nomadproject.io/intro/getting-started/cluster.html
https://github.com/rongfengliang/nomad-cluster-demo
标签:row hostname efault table node user debug system inf
原文地址:https://www.cnblogs.com/rongfengliang/p/9280186.html