nomad 安装(单机)试用

备注:

    nomad  可以实现基础设施的调度管理,类似kubernetes ,但是在多云以及多平台支持上比较好,
    还是hashicrop 工具出品的,很不错,同时本地测试因为使用默认的job需要安装docker 
 
1. 下载
wget -O nomad_0.7.0_linux_amd64.zip https://releases.hashicorp.com/nomad/0.7.0/nomad_0.7.0_linux_amd64.zip?_ga=2.205249360.1319867902.1512021535-577072086.1512021535
unzip nomad_0.7.0_linux_amd64.zip
cp nomad /usr/bin
2. server 配置(server.hcl)
# Increase log verbosity
log_level = "DEBUG"

# Setup data dir
data_dir = "/tmp/server1"

# Enable the server
server {
    enabled = true

    # Self-elect, should be 3 or 5 for production
    bootstrap_expect = 1
}
3. client 配置(client1.hcl)
# Increase log verbosity
log_level = "DEBUG"

# Setup data dir
data_dir = "/tmp/client1"

# Enable the client
client {
    enabled = true

    # For demo assume we are talking to server1. For production,
    # this should be like "nomad.service.consul:4647" and a system
    # like Consul used for service discovery.
    servers = ["127.0.0.1:4647"]
}

# Modify our port to avoid a collision with server1
ports {
    http = 5656
}
4. UI 界面
因为使用的是云服务器,默认配置是127.0.0.1,为了访问所以添加nginx 进行反向代理

yum install -y nginx 

修改nginx.conf 配置文件

 location / {
          proxy_pass http://127.0.0.1:4646;
 }
 
 systemctl restart nginx 
 
5. 提交job
nomad init   生成文件example.nomad
内容比较多,不粘贴了,具体的可以安装查看生成文件
nomad run example.nomad
 
 
6. job 状态查看
nomad status example 
// 输出如下,实际上和图形解决看到的是一样的。
ID            = example
Name          = example
Submit Date   = 11/30/17 15:32:56 CST
Type          = service
Priority      = 50
Datacenters   = dc1
Status        = running
Periodic      = false
Parameterized = false

Summary
Task Group  Queued  Starting  Running  Failed  Complete  Lost
cache       0       0         1        0       0         0

Latest Deployment
ID          = 9e0d9865
Status      = failed
Description = Failed due to unhealthy allocations

Deployed
Task Group  Desired  Placed  Healthy  Unhealthy
cache       1        1       0        1

Allocations
ID        Node ID   Task Group  Version  Desired  Status   Created At
189403f8  e4d9525e  cache       0        run      running  11/30/17 15:36:43 CST

// docker 信息
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                      NAMES
34c065fc3655        d3f696a9f230        "docker-entrypoint..."   6 minutes ago       Up 6 minutes        xxxxx:23070->6379/tcp, zzzz:23070->6379/udp   redis-189403f8-341b-da24-73e1-86cc8291a288
7. 容器管理的几个问题
服务调度,服务发现,容器网络,实际上nomad 处理了服务发现以及调度,对于网络以及其他的它没有关,实际上行业没必要,
服务发现试用的是自家的consul 比较强大的一个工具。在集群安全上做的也是比较好的,可以集成vault 同时也是hashicorp 
自家的产品,功能比较强大,对于paas 平台,多租户
系统的构建实际上大家可以试用。
8. 参考文档
https://www.nomadproject.io/intro/getting-started/install.html
9. 附加docker-ce 快捷安装方式
// 安装
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
// 加速
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://099430a4.m.daocloud.io

posted on 2017-11-30 15:52  荣锋亮  阅读(1372)  评论(0编辑  收藏  举报

导航