리눅스

[리눅스] nomad cluster 구성(install nomad cluster)

변군이글루 2023. 1. 27. 13:29
반응형

nomad cluster 구성

테스트 환경

호스트 이름 서버 아이피 Type 비고
control1 192.168.0.51 server  
node1 192.168.0.61 server  
node2 192.168.0.62 server  
node3 192.168.0.63 client  

nomad 설치

- nomad 설치 : https://scbyun.com/1494

 

nomad cluster 구성

nomad.hcl 설정(/etc/nomad.d/nomad.hcl)

vim /etc/nomad.d/nomad.hcl

[control1-nomad.hcl]

data_dir  = "/opt/nomad/data"
bind_addr = "0.0.0.0"
server {
  # license_path is required as of Nomad v1.1.1+
  #license_path = "/opt/nomad/license.hclic"
  enabled          = true
  bootstrap_expect = 3
}
client {
  enabled = true
  #servers = ["127.0.0.1"]
  servers = ["192.168.0.51","192.168.0.61","192.168.0.62"]
}

[node1-nomad.hcl]

data_dir  = "/opt/nomad/data"
bind_addr = "0.0.0.0"
server {
  # license_path is required as of Nomad v1.1.1+
  #license_path = "/opt/nomad/license.hclic"
  enabled          = true
  bootstrap_expect = 3
}
client {
  enabled = true
  #servers = ["127.0.0.1"]
  servers = ["192.168.0.51","192.168.0.61","192.168.0.62"]
}

[node2-nomad.hcl]

data_dir  = "/opt/nomad/data"
bind_addr = "0.0.0.0"
server {
  # license_path is required as of Nomad v1.1.1+
  #license_path = "/opt/nomad/license.hclic"
  enabled          = true
  bootstrap_expect = 3
}
client {
  enabled = true
  #servers = ["127.0.0.1"]
  servers = ["192.168.0.51","192.168.0.61","192.168.0.62"]
}

시스템 데몬 리로드

systemctl daemon-reload
systemctl restart nomad
systemctl status nomad --no-pager

nomad 상태 확인

nomad server members
$ nomad server members
Name             Address       Port  Status  Leader  Raft Version  Build  Datacenter  Region
control1.global  192.168.0.51  4648  alive   true    3             1.4.3  dc1         global
node1.global     192.168.0.61  4648  alive   false   3             1.4.3  dc1         global
node2.global     192.168.0.62  4648  alive   false   3             1.4.3  dc1         global

웹 브라우저

- http://192.168.0.51:8500


nomad 클라이언트 조인(join)

nomad.hcl 설정(/etc/nomad.d/nomad.hcl)

vim /etc/nomad.d/nomad.hcl
data_dir  = "/opt/nomad/data"
bind_addr = "0.0.0.0"
server {
  # license_path is required as of Nomad v1.1.1+
  #license_path = "/opt/nomad/license.hclic"
  enabled          = true
  bootstrap_expect = 1
}
client {
  enabled = true
  #servers = ["127.0.0.1"]
  servers = ["192.168.0.51","192.168.0.61","192.168.0.62"] 
}

시스템 데몬 리로드

systemctl --now enable nomad.service
systemctl restart nomad.service
systemctl status nomad --no-pager

nomad 상태 확인

nomad node status
$ nomad node status
ID        DC   Name      Class   Drain  Eligibility  Status
dd63a4bf  dc1  node3     <none>  false  eligible     ready
891057c0  dc1  node1     <none>  false  eligible     ready
b05fdccc  dc1  node2     <none>  false  eligible     ready
ecbbbd59  dc1  control1  <none>  false  eligible     ready

 

웹 브라우저

- http://192.168.0.51:4646

 


nomad 설치 스크립트

- nomad releases : https://releases.hashicorp.com/nomad

#!/bin/bash

wget -q https://releases.hashicorp.com/nomad/1.4.3/nomad_1.4.3_linux_amd64.zip

unzip nomad_1.4.3_linux_amd64.zip

sudo mv nomad /usr/bin/

cat <<EOF > /etc/nomad.d/nomad.hcl
# Full configuration options can be found at https://www.nomadproject.io/docs/configuration

data_dir  = "/opt/nomad/data"
bind_addr = "0.0.0.0"
log_level = "INFO"

server {
  # license_path is required as of Nomad v1.1.1+
  #license_path = "/opt/nomad/license.hclic"
  enabled          = true
  bootstrap_expect = 1
}

client {
  enabled = true
  #servers = ["127.0.0.1"]
  servers = ["192.168.0.51","192.168.0.61","192.168.0.62"] 
}
EOF

 

 

참고URL

- Nomad Vocabulary : https://developer.hashicorp.com/nomad/tutorials/get-started/get-started-vocab

 

728x90
반응형