nomad 설치

1. 환경 요구
      :centos7.2
      :4.8.4
    :yum
    (200G    ):/data
      :4646、4647、4648

2. 설치 파일 다운로드
wget https://releases.hashicorp.com/nomad/0.6.1/nomad_0.6.1_linux_amd64.zip

3. 설치 파일의 압축 해제
unzip nomad_0.6.1_linux_amd64.zip -d /usr/bin

4. 시작 파일 만들기
vim /lib/systemd/system/nomad.service
[Unit]
Description=nomad
[Service]
ExecStart=/usr/bin/nomad agent -config /etc/nomad
KillSignal=SIGTERM

5. 프로필 만들기
        :mkdir /etc/nomad
########################client  ##########################
####  client.hcl#####
client {
  enabled = true
  options {
    "driver.raw_exec.enable" = "1"
    "driver.exec.enable" = "1"
    "driver.exec.java" = "1"
    "docker.volumes.enabled" = "true"
    "max_kill_timeout" = "30s"
  }
  meta {
    "key" = "vaule"
    "key2" = "vaule2"
 }
 }
 ####  consul.hcl#####
 consul {
  address = "consul  IP  :8500"
  server_service_name = "nomad"
  server_auto_join = true
  client_service_name = "nomad-client"
  client_auto_join = true
  auto_advertise = true
  token   = "consul token"
}
 ####  nomad.hcl#####
 log_level = "INFO"
data_dir = "/var/run/nomad"
bind_addr = "0.0.0.0"
leave_on_terminate = true
region = "  "
datacenter = "      "
advertise {
  http = "  IP:4646"
  rpc = "  IP:4647"
  serf = "  IP:4648"
}
telemetry {
  publish_allocation_metrics = true
  publish_node_metrics       = true
}

########################master  ##########################
####  client.hcl#####
client {
  enabled = true
  options {
    "driver.raw_exec.enable" = "1"
    "driver.exec.enable" = "1"
    "driver.exec.java" = "1"
    "docker.volumes.enabled" = "true"
    "max_kill_timeout" = "30s"
  }
  meta {
    "key" = "vaule"
    "key2" = "vaule2"
 }
 }
 ####  consul.hcl#####
 consul {
  address = "consul  IP  :8500"
  server_service_name = "nomad"
  server_auto_join = true
  client_service_name = "nomad-client"
  client_auto_join = true
  auto_advertise = true
  token   = "consul token"
}
 ####  nomad.hcl#####
 log_level = "INFO"
data_dir = "/var/run/nomad"
bind_addr = "0.0.0.0"
leave_on_terminate = true
region = "  "
datacenter = "      "
advertise {
  http = "  IP:4646"
  rpc = "  IP:4647"
  serf = "  IP:4648"
}
telemetry {
  publish_allocation_metrics = true
  publish_node_metrics       = true
}
####  server.hcl#####
server {
  enabled = true
  bootstrap_expect = 3
}

6. 서비스 시작
systemctl start nomad
  Python  json  :nomad run -output .nomad

7. 로그 구성
rm -rf /etc/rsyslog.d/nomad.conf
rm -rf /etc/logrotate.d/nomad
echo ':programname, isequal, "nomad" /var/log/nomad.log' >> /etc/rsyslog.d/nomad.conf
echo '& ~' >> /etc/rsyslog.d/nomad.conf
echo '/var/log/nomad.log' >> /etc/logrotate.d/nomad
echo '{' >> /etc/logrotate.d/nomad
echo '    daily' >> /etc/logrotate.d/nomad
echo '    rotate 7' >> /etc/logrotate.d/nomad
echo '    missingok' >> /etc/logrotate.d/nomad
echo '    dateext' >> /etc/logrotate.d/nomad
echo '    copytruncate' >> /etc/logrotate.d/nomad
echo '    compress' >> /etc/logrotate.d/nomad
echo '}' >> /etc/logrotate.d/nomad
    
/bin/systemctl restart nomad
      
echo "/bin/systemctl start nomad" >> /etc/rc.local

좋은 웹페이지 즐겨찾기