1 环境

操作系统版本:centos8
系统工具:yum
默认启用端口:4646、4647、4648

2 下载 安装

wget https://releases.hashicorp.com/nomad/0.6.1/nomad_0.6.1_linux_amd64.zip--2022-04-18 10:08:10--  https://releases.hashicorp.com/nomad/0.6.1/nomad_0.6.1_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.109.183, 2a04:4e42:11::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.109.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10577708 (10M) [application/zip]
Saving to: ‘nomad_0.6.1_linux_amd64.zip’nomad_0.6.1_linux_amd64.zip                         100%[==================================================================================================================>]  10.09M  6.18MB/s    in 1.6s2022-04-18 10:08:12 (6.18 MB/s) - ‘nomad_0.6.1_linux_amd64.zip’ saved [10577708/10577708]#解压
unzip nomad_0.6.1_linux_amd64.zip -d /usr/binArchive:  nomad_0.6.1_linux_amd64.zipinflating: /usr/bin/nomad

3 创建启动文件

vim /lib/systemd/system/nomad.service[Unit]
Description=nomad
[Service]
ExecStart=/usr/bin/nomad agent -config /etc/nomad
killSignal=SIGTERM:wq

4 开始

#开发者模式
nomad agent -devNo configuration files loaded
==> Starting Nomad agent...
==> Nomad agent configuration:Client: trueLog Level: DEBUGRegion: global (DC: dc1)Server: trueVersion: 0.6.1==> Nomad agent started! Log data will stream in below:…………

server和client都为true,表示同时开启了server和client。

新开一个终端,查看状态

nomad node-status
ID        DC   Name        Class   Drain  Status
288cf1d8  dc1  controller  <none>  false  ready
ID,它是随机生成的UUIDDC,数据中心Name,节点名称Class 节点类别Drain 漏斗模式Status 当前状态
nomad server-membersName               Address    Port  Status  Leader  Protocol  Build  Datacenter  Region
controller.global  127.0.0.1  4648  alive   true    2         0.6.1  dc1         global

停止
CTRL + C

5 Nomad Job

Job是Nomad主要交互的内容

示例Job

cd /etc/nomad/nomad init
#输出,这是一个示例的nomad job配置文件。
Example job file written to example.nomad

运行这个job

[root@controller nomad]# nomad run example.nomad
==> Monitoring evaluation "f2915eb4"Evaluation triggered by job "example"Evaluation within deployment: "3d4565e9"Evaluation status changed: "pending" -> "complete"
==> Evaluation "f2915eb4" finished with status "complete" but failed to place all allocations:Task Group "cache" (failed to place 1 allocation):* Constraint "missing drivers" filtered 1 nodesEvaluation "3a4f267c" waiting for additional capacity to place remainder

报错,原因是未开启Docker

systemctl start docker
[root@controller ~]# nomad run example.nomad
==> Monitoring evaluation "46df41a2"Evaluation triggered by job "example"Evaluation within deployment: "637faa61"Evaluation status changed: "pending" -> "complete"
==> Evaluation "46df41a2" finished with status "complete"

查看job状态

[root@controller nomad]# nomad status example
ID            = example
Name          = example
Submit Date   = 04/22/22 11:57:22 CST
Type          = service
Priority      = 50
Datacenters   = dc1
Status        = running
Periodic      = false
Parameterized = falseSummary
Task Group  Queued  Starting  Running  Failed  Complete  Lost
cache       0       0         1        0       0         0Latest Deployment
ID          = 637faa61
Status      = successful
Description = Deployment completed successfullyDeployed
Task Group  Desired  Placed  Healthy  Unhealthy
cache       1        1       1        0Allocations
ID        Node ID   Task Group  Version  Desired  Status   Created At
d4595003  288cf1d8  cache       2        run      running  04/22/22 11:59:18 CST

检查job的分配情况。

[root@controller ~]# nomad alloc-status d4595003
ID                  = d4595003
Eval ID             = f218342a
Name                = example.cache[0]
Node ID             = 288cf1d8
Job ID              = example
Job Version         = 2
Client Status       = running
Client Description  = <none>
Desired Status      = run
Desired Description = <none>
Created At          = 04/22/22 11:59:18 CST
Deployment ID       = 637faa61
Deployment Health   = healthyTask "redis" is "running"
Task Resources
CPU        Memory           Disk     IOPS  Addresses
4/500 MHz  924 KiB/256 MiB  300 MiB  0     db: 127.0.0.1:22788Task Events:
Started At     = 04/22/22 03:59:47 UTC
Finished At    = N/A
Total Restarts = 0
Last Restart   = N/ARecent Events:
Time                   Type        Description
04/22/22 11:59:47 CST  Started     Task started by client
04/22/22 11:59:18 CST  Driver      Downloading image redis:3.2
04/22/22 11:59:18 CST  Task Setup  Building Task Directory
04/22/22 11:59:18 CST  Received    Task received by client

Logs打印

[root@controller ~]# nomad logs dab3f690 redis

修改job

vim example.nomad...
count = 3
...:wqnomad plan example.nomad# nomad run -check-index 7 example.nomad

停止job

[root@controller ~]# nomad stop example
==> Monitoring evaluation "a3883687"Evaluation triggered by job "example"Evaluation within deployment: "264c07db"Evaluation status changed: "pending" -> "complete"
==> Evaluation "a3883687" finished with status "complete"

建立Nomad集群

测试环境:

192.168.143.203(server)
192.168.143.194(server)
192.168.143.192(client)

配置

分别配置一次

mkdir /etc/nomad/
cd /etc/nomad/vim nomad_test.hcl
-----
datacenter = "dc1"
data_dir = "/root/nomad/data"server {enabled = truebootstrap_expect = 3
}client {enabled = trueservers = ["192.168.143.203:4647"]  #此处写本机ip
}

新开终端,加入集群

[root@controller ~]# nomad server-join "192.168.143.192:4648"
Joined 1 servers successfully

查看成员

root@controller ~]# nomad server-members
Name               Address       Port  Status  Leader  Protocol  Build  Datacenter  Region
compute.global     10.10.20.192  4648  alive   false   2         0.6.1  dc1         global
controller.global  127.0.0.1     4648  alive   false   2         0.6.1  dc1         global
stone.global       10.10.20.194  4648  alive   false   2         0.6.1  dc1         global

CentOS8 Nomad安装(2)相关推荐

  1. 在Centos8上安装漏洞扫描软件Nessus

    本文摘要:简单叙述了在Centos8上安装Nessus扫描器的过程 Nessus 是目前全世界最多人使用的系统漏洞扫描与分析软件,Nessus的用户界面是基于Web界面来访问Nessus漏洞扫描器的, ...

  2. centos8 yum 安装mysql8

    centos8 yum 安装mysql8 获取官方下载地址 https://dev.mysql.com/downloads/repo/yum/ 下载mysql安装包 :wget https://rep ...

  3. 【Centos8 MYSQL安装、卸载教程】

    Centos8 MYSQL安装.卸载教程 1. MYSQL相关命令 2. 卸载MYSQL 2.1 停止MYSQL服务 2.2 查看已安装的MYSQL相关软件 2.3 执行删除命令 2.4 查看是否有安 ...

  4. centos8.0 安装 podman 与配置阿里云加速

    前言 podman与docker命令大部分相同,安装比docker简单. 第一步: 执行以下四个命令中的一个,效果都一样. yum install -y docker(dnf install -y d ...

  5. CentOS8.3安装时报错: DFN error:Error in POSTTRANS scriptlet in rpm package kernel-core

    CentOS8.3安装时报错: DFN error:Error in POSTTRANS scriptlet in rpm package kernel-core 解决办法: 重新安装,在手动分区时, ...

  6. 全网最全无坑!!! Centos8环境 安装MySQL8 (单机版详细部署及问题汇总)

    Centos8 环境 安装MySQL8 详细部署 文章目录 检查是否已安装(强力卸载) 安装MySQL8.0 查看MySQL是否安装成功 设置MySQL服务为开机自启动项 启动MySQL服务 相关安装 ...

  7. Centos8 linux安装oracle 19c rpm

    Centos8 linux安装oracle 19c rpm 1.下载 1)官方网址:oracle官网 2)选择 RPM 包下载 2.安装一些依赖包 1)安装方法: 安装以下依赖包时,可能会遇到依赖包本 ...

  8. virtualbox的下载和centos8的安装

    virtualbox的下载和centos8的安装 1.项目背景 2.VirtualBox的下载与安装 2.1 下载地址 2.2 官网下载 2.3 安装 3. centos8的下载 4.在virtual ...

  9. 在CentOS8下安装docker遇到的containerd.io >= 1.4.1解决方法

    官方的CentOS 8 安装 docker 步骤: # 1.yum 包更新到最新 yum update# 2.安装需要的软件包, yum-util 提供yum-config-manager功能,另外两 ...

最新文章

  1. 【前沿技术】“中国天眼”观测到宇宙极端爆炸起源证据
  2. LiveData学习
  3. jquery ajax xml attribute,获得jQuery ajax和asp.net webmethod xml响应工作
  4. mysql去重的最方便的两种方法_mysql去重的最方便的两种方法
  5. 程序员硬核吃瓜宋慧乔宋仲基离婚、范冰冰李晨分手!
  6. 查找python矩阵中最大元素_一种快速查找numpy数组中最大N个元素的方法
  7. 12306的数据库设计
  8. 录游戏用什么软件,录制游戏视频哪个软件好
  9. 手把手教你构建 C 语言编译器(1)- 设计
  10. Linux命令行设置行数,Linux设置history命令显示行数以及时间
  11. 2021触摸精灵之问道脚本教学
  12. Web API数据传输加密
  13. 《果然新鲜》电商项目(44)- 利用Logstash自动同步数据库内容到ES
  14. PPT差点被对手盗用?教你9种方法,打上你的个人信息!
  15. 格式塔心理学5项法则的学习与思考
  16. java new jsonparser_JsonParser is deprecated
  17. TM1637+stm32 HAL库
  18. 学计算机的电脑用i5还是i7好,大学生用i5还是i7 i5和i7该怎么选择
  19. Java基础之IO流(二)
  20. 机器语言、汇编语言和高级语言之间的关系

热门文章

  1. 【python】创建目录/文件夹
  2. AI面部修复项目:GFP-GAN
  3. com.101tec.zkclient使用
  4. Unity转微信小游戏与JS交互
  5. Python实现简易版学生信息管理系统,包含源码及相关实现说明~
  6. epoch和iteration的区别
  7. 将页面中的指定 div 下载为图片
  8. 更换ruby源----RubyGems 镜像 - 淘宝网
  9. Altium设置菜单之PCB编辑菜单
  10. 后端返回数据中的换行符,在标签中不显示换行的解决方法