node_getNodes

获取节点信息。

Parameters

Returns

  1. [<PeerInfo>] - PeerInfo对象字段如下
  • id: <number> - 该节点id。
  • ip: <string> - 该节点IP地址。
  • port: <number> - 该节点的grpc端口号。
  • namespace: <string> - 该节点所在分区。
  • hash: <string> - 该节点哈希值。
  • hostname: <string> - 节点主机名。
  • isPrimary: <bool> - 表示该节点是否为主节点。
  • isvp: <bool> - 表示该节点是否为VP节点。
  • status: <number> - 表示该节点的状态,值为0表示节点处于Alive状态,值为1表示节点处于Pending状态,值为2表示节点处于Stop状态。
  • delay: <number> - 表示该节点与本节点的延迟时间(单位ns),若为0,则为本节点。

Example

  1. # Request
  2. curl -X POST --data '{"jsonrpc": "2.0", "namespace":"global", "method": "node_getNodes", "params": [],"id":1}'
  3.  
  4. # Response
  5. {
  6. "jsonrpc": "2.0",
  7. "namespace": "global",
  8. "id": 1,
  9. "code": 0,
  10. "message": "SUCCESS",
  11. "result": [
  12. {
  13. "id": 1,
  14. "ip": "127.0.0.1",
  15. "port": "50011",
  16. "namespace": "global",
  17. "hash": "fa34664ec14727c34943045bcaba9ef05d2c48e06d294c15effc900a5b4b663a",
  18. "hostname": "node1",
  19. "isPrimary": true,
  20. "isvp": true,
  21. "status": 0,
  22. "delay": 0
  23. },
  24. {
  25. "id": 2,
  26. "ip": "127.0.0.1",
  27. "port": "50012",
  28. "namespace": "global",
  29. "hash": "c82a71a88c58540c62fc119e78306e7fdbe114d9b840c47ab564767cb1c706e2",
  30. "hostname": "node2",
  31. "isPrimary": false,
  32. "isvp": true,
  33. "status": 0,
  34. "delay": 347529
  35. },
  36. {
  37. "id": 3,
  38. "ip": "127.0.0.1",
  39. "port": "50013",
  40. "namespace": "global",
  41. "hash": "0c89dc7d8bdf45d1fed89fdbac27463d9f144875d3d73795f64f35dc204480fd",
  42. "hostname": "node3",
  43. "isPrimary": false,
  44. "isvp": true,
  45. "status": 0,
  46. "delay": 369554
  47. },
  48. {
  49. "id": 4,
  50. "ip": "127.0.0.1",
  51. "port": "50014",
  52. "namespace": "global",
  53. "hash": "34d299742260716bab353995fe98727004b5c27bde52489f61de093176e82088",
  54. "hostname": "node4",
  55. "isPrimary": false,
  56. "isvp": true,
  57. "status": 0,
  58. "delay": 430356
  59. }
  60. ]
  61. }