Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.13 KB | None | 0 0
  1. Создал дефолтный job
  2.  
  3. andrew@monster:~/atuko/cluster$ nomad init
  4. Example job file written to example.nomad
  5.  
  6. Поправил update
  7.  
  8. update {
  9. max_parallel = 1
  10. min_healthy_time = "10s"
  11. healthy_deadline = "3m"
  12. auto_revert = true
  13. canary = 1
  14. }
  15.  
  16. Запустил
  17.  
  18. andrew@monster:~/atuko/cluster$ nomad run example.nomad
  19. ==> Monitoring evaluation "9d93d6b3"
  20. Evaluation triggered by job "example"
  21. Allocation "0bd15c0d" created: node "6b9acd5a", group "cache"
  22. Evaluation within deployment: "476d5a8d"
  23. Evaluation status changed: "pending" -> "complete"
  24. ==> Evaluation "9d93d6b3" finished with status "complete"
  25.  
  26.  
  27. andrew@monster:~/atuko/cluster$ nomad status example
  28. ID = example
  29. Name = example
  30. Submit Date = 01/23/18 20:39:53 MSK
  31. Type = service
  32. Priority = 50
  33. Datacenters = dc1
  34. Status = running
  35. Periodic = false
  36. Parameterized = false
  37.  
  38. Summary
  39. Task Group Queued Starting Running Failed Complete Lost
  40. cache 0 0 1 0 0 0
  41.  
  42. Latest Deployment
  43. ID = 476d5a8d
  44. Status = running
  45. Description = Deployment is running
  46.  
  47. Deployed
  48. Task Group Auto Revert Desired Placed Healthy Unhealthy
  49. cache true 1 1 0 0
  50.  
  51. Allocations
  52. ID Node ID Task Group Version Desired Status Created Modified
  53. 0bd15c0d 6b9acd5a cache 0 run running 15s ago 2s ago
  54.  
  55.  
  56. В consul сервис зарегался
  57.  
  58. andrew@monster:~/atuko/cluster$ consul catalog services
  59. consul
  60. global-redis-check
  61. nomad
  62. nomad-client
  63.  
  64.  
  65. andrew@monster:~/atuko/cluster$ dig @127.0.0.1 -p 8600 global-redis-check.service.consul. SRV
  66. ;; ANSWER SECTION:
  67. global-redis-check.service.consul. 0 IN SRV 1 1 21471 monster.node.dc1.consul.
  68.  
  69. ;; ADDITIONAL SECTION:
  70. monster.node.dc1.consul. 0 IN A 127.0.0.1
  71. monster.node.dc1.consul. 0 IN TXT "consul-network-segment="
  72.  
  73.  
  74. Поменял image
  75.  
  76. andrew@monster:~/atuko/cluster$ nomad plan example.nomad
  77. +/- Job: "example"
  78. +/- Task Group: "cache" (1 canary, 1 ignore)
  79. +/- Task: "redis" (forces create/destroy update)
  80. +/- Config {
  81. +/- image: "redis:3.2" => "redis:4.0"
  82. port_map[0][db]: "6379"
  83. }
  84.  
  85. Scheduler dry-run:
  86. - All tasks successfully allocated.
  87.  
  88. Job Modify Index: 11
  89. To submit the job with version verification run:
  90.  
  91. nomad run -check-index 11 example.nomad
  92.  
  93.  
  94. Запустил
  95.  
  96. andrew@monster:~/atuko/cluster$ nomad run -check-index 11 example.nomad
  97. ==> Monitoring evaluation "10591c5d"
  98. Evaluation triggered by job "example"
  99. Allocation "a492b4d2" created: node "6b9acd5a", group "cache"
  100. Evaluation within deployment: "69006ac8"
  101. Evaluation status changed: "pending" -> "complete"
  102. ==> Evaluation "10591c5d" finished with status "complete"
  103.  
  104.  
  105. andrew@monster:~/atuko/cluster$ nomad status example
  106. ID = example
  107. Name = example
  108. Submit Date = 01/23/18 20:42:24 MSK
  109. Type = service
  110. Priority = 50
  111. Datacenters = dc1
  112. Status = running
  113. Periodic = false
  114. Parameterized = false
  115.  
  116. Summary
  117. Task Group Queued Starting Running Failed Complete Lost
  118. cache 0 0 2 0 0 0
  119.  
  120. Latest Deployment
  121. ID = 69006ac8
  122. Status = running
  123. Description = Deployment is running but requires promotion
  124.  
  125. Deployed
  126. Task Group Auto Revert Promoted Desired Canaries Placed Healthy Unhealthy
  127. cache true false 1 1 1 0 0
  128.  
  129. Allocations
  130. ID Node ID Task Group Version Desired Status Created Modified
  131. a492b4d2 6b9acd5a cache 1 run running 17s ago 12s ago
  132. 0bd15c0d 6b9acd5a cache 0 run running 2m48s ago 2m22s ago
  133.  
  134.  
  135. В consul появилась вторая запись
  136.  
  137. andrew@monster:~/atuko/cluster$ dig @127.0.0.1 -p 8600 global-redis-check.service.consul. SRV
  138. ;; ANSWER SECTION:
  139. global-redis-check.service.consul. 0 IN SRV 1 1 21471 monster.node.dc1.consul.
  140. global-redis-check.service.consul. 0 IN SRV 1 1 22312 monster.node.dc1.consul.
  141.  
  142. ;; ADDITIONAL SECTION:
  143. monster.node.dc1.consul. 0 IN A 127.0.0.1
  144. monster.node.dc1.consul. 0 IN TXT "consul-network-segment="
  145. monster.node.dc1.consul. 0 IN A 127.0.0.1
  146. monster.node.dc1.consul. 0 IN TXT "consul-network-segment="
  147.  
  148.  
  149. Фэйлю последний деплоймент
  150.  
  151. andrew@monster:~/atuko/cluster$ nomad deployment fail 69006ac8
  152. Deployment "69006ac8-ed65-369d-1405-2918d494a948" failed. Auto-reverted to job version 0.
  153.  
  154. ==> Monitoring evaluation "88eec8d4"
  155. Evaluation triggered by job "example"
  156. Evaluation within deployment: "69006ac8"
  157. Allocation "0bd15c0d" modified: node "6b9acd5a", group "cache"
  158. Evaluation status changed: "pending" -> "complete"
  159. ==> Evaluation "88eec8d4" finished with status "complete"
  160.  
  161.  
  162. andrew@monster:~/atuko/cluster$ nomad status example
  163. ID = example
  164. Name = example
  165. Submit Date = 01/23/18 20:39:53 MSK
  166. Type = service
  167. Priority = 50
  168. Datacenters = dc1
  169. Status = running
  170. Periodic = false
  171. Parameterized = false
  172.  
  173. Summary
  174. Task Group Queued Starting Running Failed Complete Lost
  175. cache 0 0 1 0 1 0
  176.  
  177. Latest Deployment
  178. ID = 7df5508d
  179. Status = successful
  180. Description = Deployment completed successfully
  181.  
  182. Deployed
  183. Task Group Auto Revert Desired Placed Healthy Unhealthy
  184. cache true 1 1 1 0
  185.  
  186. Allocations
  187. ID Node ID Task Group Version Desired Status Created Modified
  188. a492b4d2 6b9acd5a cache 1 stop complete 17m31s ago 39s ago
  189. 0bd15c0d 6b9acd5a cache 2 run running 20m2s ago 29s ago
  190.  
  191.  
  192. и в consul остаётся одна запись
  193.  
  194. andrew@monster:~/atuko/cluster$ dig @127.0.0.1 -p 8600 global-redis-check.service.consul. SRV
  195. ;; ANSWER SECTION:
  196. global-redis-check.service.consul. 0 IN SRV 1 1 21471 monster.node.dc1.consul.
  197.  
  198. ;; ADDITIONAL SECTION:
  199. monster.node.dc1.consul. 0 IN A 127.0.0.1
  200. monster.node.dc1.consul. 0 IN TXT "consul-network-segment="
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement