Nomad是一种部署cluster scheduler工具,有时我们需要在本地localhost搭建环境学习怎样使用,
如下步骤是安装在ubuntu18.04下
1) 下载nomad 二进制版本 下载Nomad,并把nomad程序加入到bin目录下
2) 然后我们需要一个启动server配置文件, 如下并注意里面的注释:
then need to add bin path to execute.
# Increase log verbosity log_level = "DEBUG" # Setup data dir # to store status data data_dir = "/tmp/server1" advertise { #used for more agents rpc = "127.0.0.1:4647" serf = "127.0.0.1:4648" } # Enable the server server { #server mode enabled = true # Self-elect, should be 3 or 5 for production bootstrap_expect = 1 } #if you have not install vault, please comment all configs vault { # unseal enabled = true #vault server address address = "http://127.0.0.1:8200" #token generated by vault to access api token = "2cc25b79-b39e-e821-3e22-6d3d4d7ae7fe" }
可以保存文件名为server.hcl
3) 并且我们也需要一个带有client配置文件作为agent, 例子如下:
# Increase log verbosity log_level = "DEBUG" # Setup data dir # store the agent status data data_dir = "/tmp/client1" # Give the agent a unique name. Defaults to hostname name = "client1" # Enable the client client { #enable client enabled = true # report to nomad server servers = ["127.0.0.1:4647"] }
保存并命名为nclient.hcl
4) 之后我们就可以启动 nomad server 和 agent
打开新的命令行窗口
#start nomad as server nomad agent -config server.hcl
5) Start nomad client
打开新的命令行窗口
# Note -network-interface=lo means use internal interface nomad agent -config nclient.hcl -network-interface=lo
Then we can check http://localhost:4646 to check gui works…
附件 nomad hcl file 包括 (nserver.hcl, nclient.hcl)