请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册
搜索

本文来自

安全运维工具

安全运维工具

人已关注

请添加对本版块的简短描述

精选帖子

阿里云CDN计费
阿里云CDN计费
0阅读|29人阅读
信用卡空当接龙
信用卡空当接龙
0阅读|228人阅读
HTTP/1.0和HTTP/1.1、HTTP/2请求对比
HTTP/1.0和HTTP/1.1、HTTP/2请求对比
3阅读|626人阅读
Kubernetes 多集群管理平台 Wayne
Kubernetes 多集群管理平台 Wayne
0阅读|655人阅读

nomad安装

[复制链接]
1250 abc 发表于 2019-4-22 10:28:32
  1. 一、环境要求

  2. 操作系统版本:centos7.2
  3. 操作系统内核:4.8.4
  4. 系统工具:yum
  5. 数据分区(200G容量以上):/data
  6. 默认启用端口:4646、4647、4648
  7. 二、下载安装文件

  8. wget https://releases.hashicorp.com/nomad/0.6.1/nomad_0.6.1_linux_amd64.zip
  9. 三、解压安装文件

  10. unzip nomad_0.6.1_linux_amd64.zip -d /usr/bin
  11. 四、创建启动文件

  12. vim /lib/systemd/system/nomad.service
  13. [Unit]
  14. Description=nomad
  15. [Service]
  16. ExecStart=/usr/bin/nomad agent -config /etc/nomad
  17. KillSignal=SIGTERM
  18. 五、创建配置文件

  19. 创建文件存放路径:mkdir /etc/nomad
  20. ########################client节点##########################
  21. ####文件client.hcl#####
  22. client {
  23.   enabled = true
  24.   options {
  25.     "driver.raw_exec.enable" = "1"
  26.     "driver.exec.enable" = "1"
  27.     "driver.exec.java" = "1"
  28.     "docker.volumes.enabled" = "true"
  29.     "max_kill_timeout" = "30s"
  30.   }
  31.   meta {
  32.     "key" = "vaule"
  33.     "key2" = "vaule2"
  34. }
  35. }
  36. ####文件consul.hcl#####
  37. consul {
  38.   address = "consul主机IP地址:8500"
  39.   server_service_name = "nomad"
  40.   server_auto_join = true
  41.   client_service_name = "nomad-client"
  42.   client_auto_join = true
  43.   auto_advertise = true
  44.   token   = "consul的token"
  45. }
  46. ####文件nomad.hcl#####
  47. log_level = "INFO"
  48. data_dir = "/var/run/nomad"
  49. bind_addr = "0.0.0.0"
  50. leave_on_terminate = true
  51. region = "区域"
  52. datacenter = "数据中心名称"
  53. advertise {
  54.   http = "主机IP:4646"
  55.   rpc = "主机IP:4647"
  56.   serf = "主机IP:4648"
  57. }
  58. telemetry {
  59.   publish_allocation_metrics = true
  60.   publish_node_metrics       = true
  61. }

  62. ########################master节点##########################
  63. ####文件client.hcl#####
  64. client {
  65.   enabled = true
  66.   options {
  67.     "driver.raw_exec.enable" = "1"
  68.     "driver.exec.enable" = "1"
  69.     "driver.exec.java" = "1"
  70.     "docker.volumes.enabled" = "true"
  71.     "max_kill_timeout" = "30s"
  72.   }
  73.   meta {
  74.     "key" = "vaule"
  75.     "key2" = "vaule2"
  76. }
  77. }
  78. ####文件consul.hcl#####
  79. consul {
  80.   address = "consul主机IP地址:8500"
  81.   server_service_name = "nomad"
  82.   server_auto_join = true
  83.   client_service_name = "nomad-client"
  84.   client_auto_join = true
  85.   auto_advertise = true
  86.   token   = "consul的token"
  87. }
  88. ####文件nomad.hcl#####
  89. log_level = "INFO"
  90. data_dir = "/var/run/nomad"
  91. bind_addr = "0.0.0.0"
  92. leave_on_terminate = true
  93. region = "区域"
  94. datacenter = "数据中心名称"
  95. advertise {
  96.   http = "主机IP:4646"
  97.   rpc = "主机IP:4647"
  98.   serf = "主机IP:4648"
  99. }
  100. telemetry {
  101.   publish_allocation_metrics = true
  102.   publish_node_metrics       = true
  103. }
  104. ####文件server.hcl#####
  105. server {
  106.   enabled = true
  107.   bootstrap_expect = 3
  108. }
  109. 六、启动服务

  110. systemctl start nomad
  111. 查找Python  json格式:nomad run -output <job>.nomad
  112. 七、日志配置

  113. rm -rf /etc/rsyslog.d/nomad.conf
  114. rm -rf /etc/logrotate.d/nomad
  115. echo ':programname, isequal, "nomad" /var/log/nomad.log' >> /etc/rsyslog.d/nomad.conf
  116. echo '& ~' >> /etc/rsyslog.d/nomad.conf
  117. echo '/var/log/nomad.log' >> /etc/logrotate.d/nomad
  118. echo '{' >> /etc/logrotate.d/nomad
  119. echo '    daily' >> /etc/logrotate.d/nomad
  120. echo '    rotate 7' >> /etc/logrotate.d/nomad
  121. echo '    missingok' >> /etc/logrotate.d/nomad
  122. echo '    dateext' >> /etc/logrotate.d/nomad
  123. echo '    copytruncate' >> /etc/logrotate.d/nomad
  124. echo '    compress' >> /etc/logrotate.d/nomad
  125. echo '}' >> /etc/logrotate.d/nomad
  126. 重启服务
  127. /bin/systemctl restart nomad
  128. 配置开机启动
  129. echo "/bin/systemctl start nomad" >> /etc/rc.local
  130. 本文转自 aaron428 51CTO博客,原文链接:http://blog.51cto.com/aaronsa/2064884
复制代码
https://yq.aliyun.com/articles/517778

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表