Nomad
Traduzione: Copia tutti i comandi
Traduzione: Generare PDF
< >
Comandi e flussi di lavoro completi HashiCorp Nomad per orchestrazione del carico di lavoro, pianificazione del lavoro e gestione dei cluster.
## Installazione e configurazione
| | Command | Description | |
| --- | --- |
| | `nomad version` | Show Nomad version | |
| | `nomad agent -dev` | Start development agent | |
| | `nomad agent -config=nomad.hcl` | Start with configuration | |
| | `nomad server members` | List server members | |
| | `nomad node status` | List client nodes | |
## Gestione del lavoro
### Operazioni di lavoro
| | Command | Description | |
| --- | --- |
| | `nomad job run example.nomad` | Submit job | |
| | `nomad job status` | List all jobs | |
| | `nomad job status example` | Show job details | |
| | `nomad job stop example` | Stop job | |
| | `nomad job stop -purge example` | Stop and purge job | |
### Pianificazione e convalida del lavoro
| | Command | Description | |
| --- | --- |
| | `nomad job plan example.nomad` | Plan job changes | |
| | `nomad job validate example.nomad` | Validate job file | |
| | `nomad job inspect example` | Inspect job configuration | |
| | `nomad job history example` | Show job history | |
### Scala del lavoro
| | Command | Description | |
| --- | --- |
| | `nomad job scale example 5` | Scale job to 5 instances | |
| | `nomad job scale example group 3` | Scale specific group | |
## Gestione dell'allocation
### Operazioni di localizzazione
| | Command | Description | |
| --- | --- |
| | `nomad alloc status` | List allocations | |
| | `nomad alloc status ALLOC_ID` | Show allocation details | |
| | `nomad alloc logs ALLOC_ID` | Show allocation logs | |
| | `nomad alloc logs -f ALLOC_ID` | Follow allocation logs | |
| | `nomad alloc exec ALLOC_ID /bin/bash` | Execute command in allocation | |
### Debug di allocazione
| | Command | Description | |
| --- | --- |
| | `nomad alloc fs ALLOC_ID` | List allocation files | |
| | `nomad alloc fs ALLOC_ID /path/to/file` | Read allocation file | |
| | `nomad alloc restart ALLOC_ID` | Restart allocation | |
| | `nomad alloc stop ALLOC_ID` | Stop allocation | |
## Gestione dei nodi
### Operazioni di nodo
| | Command | Description | |
| --- | --- |
| | `nomad node status` | List all nodes | |
| | `nomad node status NODE_ID` | Show node details | |
| | `nomad node drain NODE_ID` | Drain node | |
| | `nomad node eligibility -disable NODE_ID` | Disable node scheduling | |
| | `nomad node eligibility -enable NODE_ID` | Enable node scheduling | |
### Manutenzione del nodo
| | Command | Description | |
| --- | --- |
| | `nomad node drain -enable -deadline 30m NODE_ID` | Drain with deadline | |
| | `nomad node drain -disable NODE_ID` | Cancel drain | |
| | `nomad node meta apply NODE_ID key=value` | Set node metadata | |
## Gestione del namespace
| | Command | Description | |
| --- | --- |
| | `nomad namespace list` | List namespaces | |
| | `nomad namespace status default` | Show namespace details | |
| | `nomad namespace apply -description="Dev environment" dev` | Create namespace | |
| | `nomad namespace delete dev` | Delete namespace | |
## Gestione ACL
### Operazioni ACL
| | Command | Description | |
| --- | --- |
| | `nomad acl bootstrap` | Bootstrap ACL system | |
| | `nomad acl token create -name="dev-token" -policy=dev-policy` | Create token | |
| | `nomad acl token list` | List tokens | |
| | `nomad acl token info TOKEN_ID` | Show token details | |
### Politiche ACL
| | Command | Description | |
| --- | --- |
| | `nomad acl policy apply dev-policy dev-policy.hcl` | Create/update policy | |
| | `nomad acl policy list` | List policies | |
| | `nomad acl policy info dev-policy` | Show policy details | |
## Monitoraggio e debug
### Informazioni sul sistema
| | Command | Description | |
| --- | --- |
| | `nomad operator raft list-peers` | List Raft peers | |
| | `nomad operator snapshot save backup.snap` | Create snapshot | |
| | `nomad operator snapshot restore backup.snap` | Restore snapshot | |
### Monitoraggio
| | Command | Description | |
| --- | --- |
| | `nomad monitor` | Stream logs | |
| | `nomad monitor -log-level=DEBUG` | Debug level logs | |
| | `nomad status` | Show cluster status | |
## Esempi di specificazione del lavoro
### Servizio web di base
Traduzione:
### Batch Job
Traduzione:
### Lavoro periodico
Traduzione:
### Lavoro di sistema
Traduzione:
## Esempi di configurazione
### Configurazione server
Traduzione:
### Configurazione client
Traduzione:
## Caratteristiche avanzate
### Constraints and Affinities
Traduzione:
### Gestione del volume
Traduzione:
### Integrazione di Service Discovery
Traduzione:
## Migliori Pratiche
### Progettazione del lavoro
1. **Resource Allocation**: Impostare i limiti di CPU e memoria appropriati
2. **La salute controlla**: Esecuzione di controlli sanitari completi
3. **Graceful Shutdown**: Maniglia segnali SIGTERM correttamente
4. **Logging**: Utilizzare logging strutturato con livelli adeguati
5. **Configurazione ** Utilizzare modelli e variabili di ambiente
### Gestione cluster
1. ** Alta disponibilità** Distribuisci più nodi server
2. ** Strategia di backup** snapshot e backup regolari
3. **Monitoring**: Monitorare la salute del cluster e lo stato del lavoro
4. ** Pianificazione della città ** Piano per i requisiti delle risorse
5. **Sicurezza**: Abilitare ACL e utilizzare TLS
### Operazioni
1. ♪Rolling Updates ♪ Utilizzare strategie di aggiornamento per zero downtime
2. **Deployments canary**: Cambiamenti di prova con distribuzioni canarie
3. ** Monitoraggio delle risorse**: Monitorare l'utilizzo delle risorse
4. **Log Aggregation**: Centralize log collection
5. **Alerting**: Impostare avvisi per problemi critici
### Sicurezza
1. ** Politiche ACL**: Implementa l'accesso meno privilegio
2. **Network Security**: Utilizzare mesh di servizio per una comunicazione sicura
3. ** Gestione dei segreti**: Integrare con Vault per i segreti
4. **Image Security**: Scansione delle immagini dei container per vulnerabilità
5. **Audit Logging**: Abilitare la registrazione di audit per la conformità