Run hashicorp nomad in localhost steps

Nomad is a tool of deploy cluster scheduler. Sometimes we need to install localhost to try how to use it,here are some steps for linux ubuntu18.04 installation:

1) Download nomad with binary version Download nomad,then need to add bin path to execute.

2) Then we need to a server config file to start nomad server, below examples and comments:

# Increase log verbosity
log_level = "DEBUG"

# Setup data dir
# to store status data
data_dir = "/tmp/server1"


advertise {
        #used for more agents
	rpc = "127.0.0.1:4647"
	serf = "127.0.0.1:4648"
}

# Enable the server
server {
    #server mode
    enabled = true

    # Self-elect, should be 3 or 5 for production
    bootstrap_expect = 1
}

#if you have not install vault, please comment all configs
vault {
        # unseal
	enabled = true
        #vault server address
	address = "http://127.0.0.1:8200"
	#token generated by vault to access api
	token = "2cc25b79-b39e-e821-3e22-6d3d4d7ae7fe"
}

Saved and name nserver.hcl

3) And we also need a agent with a client config, here below examples:

# Increase log verbosity
log_level = "DEBUG"

# Setup data dir
# store the agent status data
data_dir = "/tmp/client1"

# Give the agent a unique name. Defaults to hostname
name = "client1"

# Enable the client
client {
    #enable client
    enabled = true
    # report to nomad server
    servers = ["127.0.0.1:4647"]
}

Saved and name nclient.hcl

4) Then we can start nomad server and agent
Open a new terminal

#start nomad as server
nomad agent -config server.hcl

5) Start nomad client
Open a new terminal

# Note -network-interface=lo means use internal interface 
nomad agent -config nclient.hcl -network-interface=lo

Then we can check http://localhost:4646 to check gui works…

Attachment inlcude nomad hcl config file (nserver.hcl, nclient.hcl)

Leave a Reply

Your email address will not be published. Required fields are marked *