NodeManagerRest.apt.vm 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. ~~ Licensed under the Apache License, Version 2.0 (the "License");
  2. ~~ you may not use this file except in compliance with the License.
  3. ~~ You may obtain a copy of the License at
  4. ~~
  5. ~~ http://www.apache.org/licenses/LICENSE-2.0
  6. ~~
  7. ~~ Unless required by applicable law or agreed to in writing, software
  8. ~~ distributed under the License is distributed on an "AS IS" BASIS,
  9. ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. ~~ See the License for the specific language governing permissions and
  11. ~~ limitations under the License. See accompanying LICENSE file.
  12. ---
  13. NodeManager REST API's.
  14. ---
  15. ---
  16. ${maven.build.timestamp}
  17. NodeManager REST API's.
  18. \[ {{{./index.html}Go Back}} \]
  19. %{toc|section=1|fromDepth=0|toDepth=2}
  20. * Overview
  21. The NodeManager REST API's allow the user to get status on the node and information about applications and containers running on that node.
  22. * NodeManager Information API
  23. The node information resource provides overall information about that particular node.
  24. ** URI
  25. Both of the following URI's give you the cluster information.
  26. ------
  27. * http://<nm http address:port>/ws/v1/node
  28. * http://<nm http address:port>/ws/v1/node/info
  29. ------
  30. ** HTTP Operations Supported
  31. ------
  32. * GET
  33. ------
  34. ** Query Parameters Supported
  35. ------
  36. None
  37. ------
  38. ** Elements of the <nodeInfo> object
  39. *---------------+--------------+-------------------------------+
  40. || Item || Data Type || Description |
  41. *---------------+--------------+-------------------------------+
  42. | id | long | The NodeManager id |
  43. *---------------+--------------+-------------------------------+
  44. | nodeHostName | string | The host name of the NodeManager |
  45. *---------------+--------------+-------------------------------+
  46. | totalPmemAllocatedContainersMB | long | The amount of physical memory allocated for use by containers in MB |
  47. *---------------+--------------+-------------------------------+
  48. | totalVmemAllocatedContainersMB | long | The amount of virtual memory allocated for use by containers in MB |
  49. *---------------+--------------+-------------------------------+
  50. | lastNodeUpdateTime | long | The last timestamp at which the health report was received (in ms since epoch)|
  51. *---------------+--------------+-------------------------------+
  52. | healthReport | string | The diagnostic health report of the node |
  53. *---------------+--------------+-------------------------------+
  54. | nodeHealthy | boolean | true/false indicator of if the node is healthy|
  55. *---------------+--------------+-------------------------------+
  56. | nodeManagerVersion | string | Version of the NodeManager |
  57. *---------------+--------------+-------------------------------+
  58. | nodeManagerBuildVersion | string | NodeManager build string with build version, user, and checksum |
  59. *---------------+--------------+-------------------------------+
  60. | nodeManagerVersionBuiltOn | string | Timestamp when NodeManager was built(in ms since epoch) |
  61. *---------------+--------------+-------------------------------+
  62. | hadoopVersion | string | Version of hadoop common |
  63. *---------------+--------------+-------------------------------+
  64. | hadoopBuildVersion | string | Hadoop common build string with build version, user, and checksum |
  65. *---------------+--------------+-------------------------------+
  66. | hadoopVersionBuiltOn | string | Timestamp when hadoop common was built(in ms since epoch) |
  67. *---------------+--------------+-------------------------------+
  68. ** Response Examples
  69. <<JSON response>>
  70. HTTP Request:
  71. ------
  72. GET http://<nm http address:port>/ws/v1/node/info
  73. ------
  74. Response Header:
  75. +---+
  76. HTTP/1.1 200 OK
  77. Content-Type: application/json
  78. Transfer-Encoding: chunked
  79. Server: Jetty(6.1.26)
  80. +---+
  81. Response Body:
  82. +---+
  83. {
  84. "nodeInfo" : {
  85. "hadoopVersionBuiltOn" : "Mon Jan 9 14:58:42 UTC 2012",
  86. "nodeManagerBuildVersion" : "0.23.1-SNAPSHOT from 1228355 by user1 source checksum 20647f76c36430e888cc7204826a445c",
  87. "lastNodeUpdateTime" : 1326222266126,
  88. "totalVmemAllocatedContainersMB" : 17203,
  89. "nodeHealthy" : true,
  90. "healthReport" : "",
  91. "totalPmemAllocatedContainersMB" : 8192,
  92. "nodeManagerVersionBuiltOn" : "Mon Jan 9 15:01:59 UTC 2012",
  93. "nodeManagerVersion" : "0.23.1-SNAPSHOT",
  94. "id" : "host.domain.com:8041",
  95. "hadoopBuildVersion" : "0.23.1-SNAPSHOT from 1228292 by user1 source checksum 3eba233f2248a089e9b28841a784dd00",
  96. "nodeHostName" : "host.domain.com",
  97. "hadoopVersion" : "0.23.1-SNAPSHOT"
  98. }
  99. }
  100. +---+
  101. <<XML response>>
  102. HTTP Request:
  103. -----
  104. Accept: application/xml
  105. GET http://<nm http address:port>/ws/v1/node/info
  106. -----
  107. Response Header:
  108. +---+
  109. HTTP/1.1 200 OK
  110. Content-Type: application/xml
  111. Content-Length: 983
  112. Server: Jetty(6.1.26)
  113. +---+
  114. Response Body:
  115. +---+
  116. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  117. <nodeInfo>
  118. <healthReport/>
  119. <totalVmemAllocatedContainersMB>17203</totalVmemAllocatedContainersMB>
  120. <totalPmemAllocatedContainersMB>8192</totalPmemAllocatedContainersMB>
  121. <lastNodeUpdateTime>1326222386134</lastNodeUpdateTime>
  122. <nodeHealthy>true</nodeHealthy>
  123. <nodeManagerVersion>0.23.1-SNAPSHOT</nodeManagerVersion>
  124. <nodeManagerBuildVersion>0.23.1-SNAPSHOT from 1228355 by user1 source checksum 20647f76c36430e888cc7204826a445c</nodeManagerBuildVersion>
  125. <nodeManagerVersionBuiltOn>Mon Jan 9 15:01:59 UTC 2012</nodeManagerVersionBuiltOn>
  126. <hadoopVersion>0.23.1-SNAPSHOT</hadoopVersion>
  127. <hadoopBuildVersion>0.23.1-SNAPSHOT from 1228292 by user1 source checksum 3eba233f2248a089e9b28841a784dd00</hadoopBuildVersion>
  128. <hadoopVersionBuiltOn>Mon Jan 9 14:58:42 UTC 2012</hadoopVersionBuiltOn>
  129. <id>host.domain.com:8041</id>
  130. <nodeHostName>host.domain.com</nodeHostName>
  131. </nodeInfo>
  132. +---+
  133. * Applications API
  134. With the Applications API, you can obtain a collection of resources, each of which represents an application. When you run a GET operation on this resource, you obtain a collection of Application Objects. See also {{Application API}} for syntax of the application object.
  135. ** URI
  136. ------
  137. * http://<nm http address:port>/ws/v1/node/apps
  138. ------
  139. ** HTTP Operations Supported
  140. ------
  141. * GET
  142. ------
  143. ** Query Parameters Supported
  144. Multiple paramters can be specified.
  145. ------
  146. * state - application state
  147. * user - user name
  148. ------
  149. ** Elements of the <apps> (Applications) object
  150. When you make a request for the list of applications, the information will be returned as a collection of app objects.
  151. See also {{Application API}} for syntax of the app object.
  152. *---------------+--------------+-------------------------------+
  153. || Item || Data Type || Description |
  154. *---------------+--------------+-------------------------------+
  155. | app | array of app objects(JSON)/zero or more app objects(XML) | A collection of application objects |
  156. *---------------+--------------+--------------------------------+
  157. ** Response Examples
  158. <<JSON response>>
  159. HTTP Request:
  160. ------
  161. GET http://<nm http address:port>/ws/v1/node/apps
  162. ------
  163. Response Header:
  164. +---+
  165. HTTP/1.1 200 OK
  166. Content-Type: application/json
  167. Transfer-Encoding: chunked
  168. Server: Jetty(6.1.26)
  169. +---+
  170. Response Body:
  171. +---+
  172. {
  173. "apps" : {
  174. "app" : [
  175. {
  176. "containerids" : [
  177. "container_1326121700862_0003_01_000001",
  178. "container_1326121700862_0003_01_000002"
  179. ],
  180. "user" : "user1",
  181. "id" : "application_1326121700862_0003",
  182. "state" : "RUNNING"
  183. },
  184. {
  185. "user" : "user1",
  186. "id" : "application_1326121700862_0002",
  187. "state" : "FINISHED"
  188. }
  189. ]
  190. }
  191. }
  192. +---+
  193. <<XML response>>
  194. HTTP Request:
  195. ------
  196. GET http://<nm http address:port>/ws/v1/node/apps
  197. Accept: application/xml
  198. ------
  199. Response Header:
  200. +---+
  201. HTTP/1.1 200 OK
  202. Content-Type: application/xml
  203. Content-Length: 400
  204. Server: Jetty(6.1.26)
  205. +---+
  206. Response Body:
  207. +---+
  208. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  209. <apps>
  210. <app>
  211. <id>application_1326121700862_0002</id>
  212. <state>FINISHED</state>
  213. <user>user1</user>
  214. </app>
  215. <app>
  216. <id>application_1326121700862_0003</id>
  217. <state>RUNNING</state>
  218. <user>user1</user>
  219. <containerids>container_1326121700862_0003_01_000002</containerids>
  220. <containerids>container_1326121700862_0003_01_000001</containerids>
  221. </app>
  222. </apps>
  223. +---+
  224. * {Application API}
  225. An application resource contains information about a particular application that was run or is running on this NodeManager.
  226. ** URI
  227. Use the following URI to obtain an app Object, for a application identified by the {appid} value.
  228. ------
  229. * http://<nm http address:port>/ws/v1/node/apps/{appid}
  230. ------
  231. ** HTTP Operations Supported
  232. ------
  233. * GET
  234. ------
  235. ** Query Parameters Supported
  236. ------
  237. None
  238. ------
  239. ** Elements of the <app> (Application) object
  240. *---------------+--------------+-------------------------------+
  241. || Item || Data Type || Description |
  242. *---------------+--------------+-------------------------------+
  243. | id | string | The application id |
  244. *---------------+--------------+--------------------------------+
  245. | user | string | The user who started the application |
  246. *---------------+--------------+--------------------------------+
  247. | state | string | The state of the application - valid states are: NEW, INITING, RUNNING, FINISHING_CONTAINERS_WAIT, APPLICATION_RESOURCES_CLEANINGUP, FINISHED |
  248. *---------------+--------------+--------------------------------+
  249. | containerids | array of containerids(JSON)/zero or more containerids(XML) | The list of containerids currently being used by the application on this node. If not present then no containers are currently running for this application.|
  250. *---------------+--------------+--------------------------------+
  251. ** Response Examples
  252. <<JSON response>>
  253. HTTP Request:
  254. ------
  255. GET http://<nm http address:port>/ws/v1/node/apps/application_1326121700862_0005
  256. ------
  257. Response Header:
  258. +---+
  259. HTTP/1.1 200 OK
  260. Content-Type: application/json
  261. Transfer-Encoding: chunked
  262. Server: Jetty(6.1.26)
  263. +---+
  264. Response Body:
  265. +---+
  266. {
  267. "app" : {
  268. "containerids" : [
  269. "container_1326121700862_0005_01_000003",
  270. "container_1326121700862_0005_01_000001"
  271. ],
  272. "user" : "user1",
  273. "id" : "application_1326121700862_0005",
  274. "state" : "RUNNING"
  275. }
  276. }
  277. +---+
  278. <<XML response>>
  279. HTTP Request:
  280. ------
  281. GET http://<nm http address:port>/ws/v1/node/apps/application_1326121700862_0005
  282. Accept: application/xml
  283. ------
  284. Response Header:
  285. +---+
  286. HTTP/1.1 200 OK
  287. Content-Type: application/xml
  288. Content-Length: 281
  289. Server: Jetty(6.1.26)
  290. +---+
  291. Response Body:
  292. +---+
  293. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  294. <app>
  295. <id>application_1326121700862_0005</id>
  296. <state>RUNNING</state>
  297. <user>user1</user>
  298. <containerids>container_1326121700862_0005_01_000003</containerids>
  299. <containerids>container_1326121700862_0005_01_000001</containerids>
  300. </app>
  301. +---+
  302. * Containers API
  303. With the containers API, you can obtain a collection of resources, each of which represents a container. When you run a GET operation on this resource, you obtain a collection of Container Objects. See also {{Container API}} for syntax of the container object.
  304. ** URI
  305. ------
  306. * http://<nm http address:port>/ws/v1/node/containers
  307. ------
  308. ** HTTP Operations Supported
  309. ------
  310. * GET
  311. ------
  312. ** Query Parameters Supported
  313. ------
  314. None
  315. ------
  316. ** Elements of the <containers> object
  317. When you make a request for the list of containers, the information will be returned as collection of container objects.
  318. See also {{Container API}} for syntax of the container object.
  319. *---------------+--------------+-------------------------------+
  320. || Item || Data Type || Description |
  321. *---------------+--------------+-------------------------------+
  322. | containers | array of container objects(JSON)/zero or more container objects(XML) | A collection of container objects |
  323. *---------------+--------------+-------------------------------+
  324. ** Response Examples
  325. <<JSON response>>
  326. HTTP Request:
  327. ------
  328. GET http://<nm http address:port>/ws/v1/node/containers
  329. ------
  330. Response Header:
  331. +---+
  332. HTTP/1.1 200 OK
  333. Content-Type: application/json
  334. Transfer-Encoding: chunked
  335. Server: Jetty(6.1.26)
  336. +---+
  337. Response Body:
  338. +---+
  339. {
  340. "containers" : {
  341. "container" : [
  342. {
  343. "nodeId" : "host.domain.com:8041",
  344. "totalMemoryNeededMB" : 2048,
  345. "state" : "RUNNING",
  346. "diagnostics" : "",
  347. "containerLogsLink" : "http://host.domain.com:8042/node/containerlogs/container_1326121700862_0006_01_000001/user1",
  348. "user" : "user1",
  349. "id" : "container_1326121700862_0006_01_000001",
  350. "exitCode" : -1000
  351. },
  352. {
  353. "nodeId" : "host.domain.com:8041",
  354. "totalMemoryNeededMB" : 2048,
  355. "state" : "RUNNING",
  356. "diagnostics" : "",
  357. "containerLogsLink" : "http://host.domain.com:8042/node/containerlogs/container_1326121700862_0006_01_000003/user1",
  358. "user" : "user1",
  359. "id" : "container_1326121700862_0006_01_000003",
  360. "exitCode" : -1000
  361. }
  362. ]
  363. }
  364. }
  365. +---+
  366. <<XML response>>
  367. HTTP Request:
  368. ------
  369. GET http://<nm http address:port>/ws/v1/node/containers
  370. Accept: application/xml
  371. ------
  372. Response Header:
  373. +---+
  374. HTTP/1.1 200 OK
  375. Content-Type: application/xml
  376. Content-Length: 988
  377. Server: Jetty(6.1.26)
  378. +---+
  379. Response Body:
  380. +---+
  381. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  382. <containers>
  383. <container>
  384. <id>container_1326121700862_0006_01_000001</id>
  385. <state>RUNNING</state>
  386. <exitCode>-1000</exitCode>
  387. <diagnostics/>
  388. <user>user1</user>
  389. <totalMemoryNeededMB>2048</totalMemoryNeededMB>
  390. <containerLogsLink>http://host.domain.com:8042/node/containerlogs/container_1326121700862_0006_01_000001/user1</containerLogsLink>
  391. <nodeId>host.domain.com:8041</nodeId>
  392. </container>
  393. <container>
  394. <id>container_1326121700862_0006_01_000003</id>
  395. <state>DONE</state>
  396. <exitCode>0</exitCode>
  397. <diagnostics>Container killed by the ApplicationMaster.</diagnostics>
  398. <user>user1</user>
  399. <totalMemoryNeededMB>2048</totalMemoryNeededMB>
  400. <containerLogsLink>http://host.domain.com:8042/node/containerlogs/container_1326121700862_0006_01_000003/user1</containerLogsLink>
  401. <nodeId>host.domain.com:8041</nodeId>
  402. </container>
  403. </containers>
  404. +---+
  405. * {Container API}
  406. A container resource contains information about a particular container that is running on this NodeManager.
  407. ** URI
  408. Use the following URI to obtain a Container Object, from a container identified by the {containerid} value.
  409. ------
  410. * http://<nm http address:port>/ws/v1/node/containers/{containerid}
  411. ------
  412. ** HTTP Operations Supported
  413. ------
  414. * GET
  415. ------
  416. ** Query Parameters Supported
  417. ------
  418. None
  419. ------
  420. ** Elements of the <container> object
  421. *---------------+--------------+-------------------------------+
  422. || Item || Data Type || Description |
  423. *---------------+--------------+-------------------------------+
  424. | id | string | The container id |
  425. *---------------+--------------+-------------------------------+
  426. | state | string | State of the container - valid states are: NEW, LOCALIZING, LOCALIZATION_FAILED, LOCALIZED, RUNNING, EXITED_WITH_SUCCESS, EXITED_WITH_FAILURE, KILLING, CONTAINER_CLEANEDUP_AFTER_KILL, CONTAINER_RESOURCES_CLEANINGUP, DONE|
  427. *---------------+--------------+-------------------------------+
  428. | nodeId | string | The id of the node the container is on|
  429. *---------------+--------------+-------------------------------+
  430. | containerLogsLink | string | The http link to the container logs |
  431. *---------------+--------------+-------------------------------+
  432. | user | string | The user name of the user which started the container|
  433. *---------------+--------------+-------------------------------+
  434. | exitCode | int | Exit code of the container |
  435. *---------------+--------------+-------------------------------+
  436. | diagnostics | string | A diagnostic message for failed containers |
  437. *---------------+--------------+-------------------------------+
  438. | totalMemoryNeededMB | long | Total amout of memory needed by the container (in MB) |
  439. *---------------+--------------+-------------------------------+
  440. ** Response Examples
  441. <<JSON response>>
  442. HTTP Request:
  443. ------
  444. GET http://<nm http address:port>/ws/v1/nodes/containers/container_1326121700862_0007_01_000001
  445. ------
  446. Response Header:
  447. +---+
  448. HTTP/1.1 200 OK
  449. Content-Type: application/json
  450. Transfer-Encoding: chunked
  451. Server: Jetty(6.1.26)
  452. +---+
  453. Response Body:
  454. +---+
  455. {
  456. "container" : {
  457. "nodeId" : "host.domain.com:8041",
  458. "totalMemoryNeededMB" : 2048,
  459. "state" : "RUNNING",
  460. "diagnostics" : "",
  461. "containerLogsLink" : "http://host.domain.com:8042/node/containerlogs/container_1326121700862_0007_01_000001/user1",
  462. "user" : "user1",
  463. "id" : "container_1326121700862_0007_01_000001",
  464. "exitCode" : -1000
  465. }
  466. }
  467. +---+
  468. <<XML response>>
  469. HTTP Request:
  470. ------
  471. GET http://<nm http address:port>/ws/v1/node/containers/container_1326121700862_0007_01_000001
  472. Accept: application/xml
  473. ------
  474. Response Header:
  475. +---+
  476. HTTP/1.1 200 OK
  477. Content-Type: application/xml
  478. Content-Length: 491
  479. Server: Jetty(6.1.26)
  480. +---+
  481. Response Body:
  482. +---+
  483. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  484. <container>
  485. <id>container_1326121700862_0007_01_000001</id>
  486. <state>RUNNING</state>
  487. <exitCode>-1000</exitCode>
  488. <diagnostics/>
  489. <user>user1</user>
  490. <totalMemoryNeededMB>2048</totalMemoryNeededMB>
  491. <containerLogsLink>http://host.domain.com:8042/node/containerlogs/container_1326121700862_0007_01_000001/user1</containerLogsLink>
  492. <nodeId>host.domain.com:8041</nodeId>
  493. </container>
  494. +---+