DBC Bare Metal Node

大约 6 分钟

DBC Bare Metal Node

Introduction

  1. The bare metal node of DBC is only responsible for generating the node id for the bare metal server, and controlling the bare metal server to perform limited operations such as switching on and off.
  2. Bare metal nodes do not support functions related to virtual machines. Because the requirements for the hardware equipment of the machine where the node is deployed are very low, the resources such as memory and hard disk used are very small, as long as the IPMI tool can be used for the bare metal server and the network service is normal.

注意!

The bare metal node of DBC itself has a "node_id", which does not need to be uploaded to the chain, and is only used to generate a "node_id" for the bare metal server.

For example, send a request to add a bare metal server to a bare metal node. The parameter needs to tell the client node which bare metal node to send to, and fill in the information for IPMI control. The request will return a new "node_id", that is the "node_id" of the added bare metal server. This "node_id" needs to be on the chain, and then the user can rent it on the chain, and use it to send the request of switching on and off.

This article mentions two kinds of node_id, which are distinguished here:

  • "The node_id of the bare metal node" refers to the "node_id" field in the "dat/node.dat" file in the node installation directory.
  • "The node_id of the bare metal server" is the "node_id" field returned by sending the request to add the bare metal server.

install node

  1. Download the installation script:http://112.192.16.27:9000/dbc/install_update_script/mainnet/install_baremetal.shopen in new window
  2. run the install script:
sudo bash ./install_baremetal.sh <installation directory>

The installation script will automatically install the IPMI tool, and like the script for installing the DBC client node, you need to enter 2 port numbers.

upgrade node

  1. Download upgrade script:http://112.192.16.27:9000/dbc/install_update_script/mainnet/update_baremetal.shopen in new window
  2. Run the upgrade script:
sudo bash update_baremetal.sh <installation directory>

Add a bare metal server

  • request method:POST

  • request URL:

http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal/add
  • request Body:
{
  "peer_nodes_list": [
    // node_id of bare metal node
    "ccd9a2118ba3c95cd458302601f15281edc39d72dcf11a07527893d97ac1a573"
  ],
  "additional": {
    // Informations of bare metal server
    "bare_metal_nodes": [
      {
        // The unique ID of the machine supplier to identify the bare metal, required.
        "uuid": "3156995b-da18-4268-9734-f8d168e90a7d",
        // The connection method provided by the bare metal server to the user. Required. A fixed IP address is recommended.
        "ip": "175.221.204.110",
        // Operating system of the bare metal server, optional.
        "os": "Ubuntu 20.04.3 LTS (Focal Fossa) 5.4.0-121-generic GNU/Linux",
        // A description customized by the machine owner, not required.
        "desc": "在xxx平台租用的裸金属服务器,用于xxx业务,机房id是9f01ca9c-38bd-46a9-9637-dac92b352a63",
        // The host ID of ipmi, required. A fixed IP address is recommended.
        "ipmi_hostname": "192.168.0.110",
        // ipmi username, required.
        "ipmi_username": "admin",
        // ipmi user password, required.
        "ipmi_password": "dbtu2017",
        // ipmi port,optional. v0.4.0.9 version added.
        "ipmi_port": 623
      }
    ]
  },
  // Generated by the node_id and node_private_key of the bare metal node
  "wallet":"ccd9a2118ba3c95cd458302601f15281edc39d72dcf11a07527893d97ac1a573",
  "nonce":"5tYLiAF9vVP8bRqSfV9DfZnizsDNY7dNeEWrSUAY8f1LKiZqBu8zaVs",
  "sign":"3c680ba745af6695981fe2b30aedf6861749f570d9a6fe949930caf4613c225d4a674c33ec3d4af26c20caf871dd0f3a7cb4e0c045f12c211a345781054fc282"
}
  • return example:
{
  "errcode": 0,
  "message": {
    "bare_metal_nodes": [
      {
        "node_id": "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39",
        "uuid": "3156995b-da18-4268-9734-f8d168e90a7d"
      }
    ]
  }
}

Query the list of bare metal servers

  • request method:POST

  • request URL:

http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal
  • request Body:
{
  "peer_nodes_list": [
    // node_id of bare metal node. When this is empty, it means querying the list of all bare metal servers.
    "ccd9a2118ba3c95cd458302601f15281edc39d72dcf11a07527893d97ac1a573"
  ],
  "additional": {},
  // Generated by the node_id and node_private_key of the bare metal node
  "wallet":"ccd9a2118ba3c95cd458302601f15281edc39d72dcf11a07527893d97ac1a573",
  "nonce":"5tYLiAF9vVP8bRqSfV9DfZnizsDNY7dNeEWrSUAY8f1LKiZqBu8zaVs",
  "sign":"3c680ba745af6695981fe2b30aedf6861749f570d9a6fe949930caf4613c225d4a674c33ec3d4af26c20caf871dd0f3a7cb4e0c045f12c211a345781054fc282"
}
  • return example:
{
  "errcode": 0,
  "message": {
    "bare_metal_nodes": [
      {
        "node_id": "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39",
        "node_private_key": "4c2e7133834d6d7dd35088beda5556215f6f5b15d2cd3c3153f117aaeec2c28b",
        "uuid": "3156995b-da18-4268-9734-f8d168e90a7d",
        "ip": "175.221.204.110",
        "os": "Ubuntu 20.04.3 LTS (Focal Fossa) 5.4.0-121-generic GNU/Linux",
        "description": "在xxx平台租用的裸金属服务器,用于xxx业务,机房id是9f01ca9c-38bd-46a9-9637-dac92b352a63",
        "ipmi_hostname": "192.168.0.110",
        "ipmi_username": "admin",
        "ipmi_password": "dbtu2017",
        "deeplink_device_id": "123456789",
        "deeplink_device_password": "aAbBcC"
      }
    ]
  }
}

When the "peer_nodes_list" array in the request body contains the node_id of the bare metal node, you can also query the specified bare metal server based on the uuid entered when adding the bare metal server.

  • Use http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal/<node_id> to query related information about the bare metal server with the specified node_id.
  • Use http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal/<uuid> to query related information about the bare metal server with the specified uuid.

Bare metal server on-chain

Use the "node_id" and "node_private_key" queried above to upload the bare metal server to the chain. Refer to Machine Onchain stepsopen in new window

After being on-chain, you can rent a bare metal server on the chain just like renting an ordinary computing machine.

注意!

The "node_id" used by the bare metal server on the chain is the "node_id" returned by the request to add the bare metal server, and the "node_private_key" is obtained by querying the bare metal server above.

Use of Bare Metal Servers

By renting a bare metal server on the chain, you can query its machine information, and use the IP and port in the machine information to connect (ssh or Windows remote connection tool) to access.

If the bare metal server is not powered on, you can control its power to be powered on by sending a request.

  • request method:POST

  • request URL:

http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal/power
  • request Body:
{
  "peer_nodes_list": [
    // node_id of bare metal server
    "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39"
  ],
  "additional": {
    // power control command
    // "on"     - power on
    // "off"    - power off
    // "reset"  - power reset
    // "status" - get power status
    "command": "on"
  },
  "session_id": "The session_id distributed by the renter",
  "session_id_sign": "session_id_sign distributed by the renter"
}

For other API interfaces, please refer to Bare Metal Node Operationsopen in new window

Cloud internet cafe

In the cloud Internet cafe scene, after a GPU machine is connected to the chain in the form of a bare metal server, if you want to obtain an e-sports-level gaming experience, you also need to use a low-latency remote control software based on cloud games- DeepLinkopen in new window.

Correspondingly, to use DeepLink remote control, it is necessary to obtain the device code and device verification code of the DeepLink software running on the GPU machine (hereinafter collectively referred to as DeepLink device information). To this end, we add an interface to query DeepLink device information through the dbc node.

To ensure security, it is recommended that the GPU machine in the cloud Internet cafe scenario has a different device verification code each time it is turned on. To ensure that the bare metal node of dbc can obtain the device information and changes of DeepLink, it is necessary to start a LAN TCP service on the bare metal node of dbc to establish a connection with DeepLink. The following configuration can be added to the bare metal node configuration file of dbc dbc_baremetal_node/conf/core.conf:

deeplink_listen_ip=0.0.0.0
deeplink_listen_port=5003

At the same time, in the DeepLink configuration file %appdata%\DeepLink\config.ini, add the LAN TCP service that the bare metal node of dbc just started Service, for example:

[dbc]
bare_metal_ip=192.168.1.159
bare_metal_port=5003

After this setting, DeepLink will automatically connect to the bare metal node of dbc at startup and synchronize the device information of DeepLink.

Note!

The above LAN connection requires dbc 0.4.1.7 and DeepLink 1.0.3.1 and above.

There are two tables in the bare metal node of dbc. One table stores node information. The key is the node_id of the node, and the value is uuid, ip, ipmi_hostname and other information. The other table stores the TCP connection established by DeepLink. The key is the ip address of the TCP connection, and the value is the deeplink_device_id and deeplink_device_password device information received by the TCP connection.

When the bare metal node of dbc receives a query request, it first checks the first table above, finds the ip address through node_id, and then uses the ip address to query the device information of DeepLink in the second table. Therefore, the ip address set when adding a bare metal server must be real and valid, and correspond to the DeepLink device one by one. It is recommended to correctly set the fields such as uuid and ip, otherwise the interface for querying DeepLink device information may report an error.

In addition, you need to modify http_ip=127.0.0.1 in the configuration file dbc_baremetal_node/conf/core.conf of the bare metal node to http_ip=0.0.0.0, so that the bare metal node can directly accept HTTP requests.

When the GPU machine and the bare metal node of dbc are in the same network, you can directly use the HTTP service of the bare metal node to get/set device information, and the request at this time does not need session_id and session_id_sign parameters. When the renter queries the device information through the HTTP service of the client node, it must have session_id and session_id_sign parameters.

The specific usage process is as follows:

  1. After the GPU machine is powered on, query the DeepLink device information.
  • request method:POST

  • request URL:

http://{{dbc_baremetal_ip}}:{{dbc_baremetal_port}}/api/v1/deeplink
  • request Body:
{
  "peer_nodes_list": [
    // The node_id corresponding to the GPU machine
    "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39"
  ],
  "additional": {},
  // Generated by the node_id and node_private_key of the GPU machine
  "wallet":"fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39",
  "nonce":"3bxrsXVW2z2ELH7G9RvF7BMUQkEGkBfQhd8YD5r8somf3UdNWcEYAFa",
  "sign":"e096764ac7462220bc9b8fa223b81cfb9a501eaea9ea355c0d561b6fe61cb729abed61e5d8488178856e198d9cde51c37e2aac8886cb5e7b674591b1eca8108f"
}
  • return example:
{
  "errcode": 0,
  "message": {
    "device_id": "123456789",
    "device_password": "aAbBcC"
  }
}

Similarly, at this time, the renter can also use session_id and session_id_sign to call http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/deeplink to query the device information of the bare metal node.

  1. The renter modifies the DeepLink device information.
  • request method:POST

  • request URL:

http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/deeplink/set
  • request Body:
{
  "peer_nodes_list": [
    // The node_id corresponding to the GPU machine
    "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39"
  ],
  "additional": {
    // The device id can only be generated by DeepLink's server and cannot be set arbitrarily.
    // "device_id": "123456789",
    "device_password": "aAbBcC"
  },
  "session_id": "The session_id distributed by the renter",
  "session_id_sign": "session_id_sign distributed by the renter"
}
  • return example:
{
  "errcode": 0,
  "message": "ok"
}
Loading...