Skip to content

Configuration tutorial of MassGrid Docker Administration Node

MassGrid edited this page Jul 12, 2019 · 1 revision

MassGrid docker管理节点配置教程v1.3.3.1

准备 1台配置好的主节点服务器

配置主节点教程

额外开放服务器端口:

TCP port 2377为集群管理通信

TCP and UDP port 7946 为节点间通信

UDP port 4789 为网络间流量

TCP port 8999 N2N 默认消息转发端口

1、安装docker

1)使用ubuntu masternode一键脚本安装docker
wget https://raw.githubusercontent.com/wanyvic/DockerImageBase/master/masternode_docker_install.sh
chmod +x masternode_docker_install.sh
sudo ./masternode_docker_install.sh

##执行成功则可以看到具体的docker信息
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:24:56 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:23:21 2018
  OS/Arch:          linux/amd64
  Experimental:     false
2)开放docker api
sudo vim /lib/systemd/system/docker.service
#添加一行 
ExecStart=/usr/bin/dockerd -H unix://var/run/docker.sock -H tcp://127.0.0.1:2375
#重启docker
sudo systemctl daemon-reload
sudo systemctl restart docker.service
3)创建docker swarm token

以主节点 49.234.37.251为例

sudo docker swarm init --advertise-addr 49.234.37.251:2377

2、 配置 dockerprice.conf

dockerprice.conf 在钱包数据目录下

注意区分大小写, 需要和 本地 通过 dockerConfig.py 生成的文件保持一致

cpu intel_i7 10
mem ddr 1.5
gpu NVIDIA_P102_100_5G 10.1
cpu intel_i3 9.8
gpu NVIDIA_P104_100_4G 40
cpu intel_i3 9.8
gpu NVIDIA_P106_400_6G 60
gpu NVIDIA_P106_400_3G 30

3、启动添加

启动钱包并添加参数

-dockernode

4、在线更改配置

1)更改定价

调用massgrid-cli 进行在线更改价格

massgrid-cli docker listprice #查看价格单
massgrid-cli docker setprice cpu intel_i3 9.8
massgrid-cli docker setprice NVIDIA_P104_100_4G 40
2)更改主节点租用手续费率
massgrid-cli docker setdockerfee 0.01 #1%

5、更多管理

使用massgrid-cli docker命令

具体可参见rpc docker命令文档

help docker


docker "command"...
Set of commands to execute docker related actions

Arguments:
1. "command"        (string or set of strings, required) The command to execute

Available commands:
   getdndata      - - get infomation from dockernode Arguments: 
       1. "dockernode (IP:Port)" (string, required)  Print number of all of yours docker services
   connect        - Connect to docker network
       1. "localAddress (IP)" (string, required)
       2. "netmask (netmask)" (string, required)
       3. "snAddress (IP:Port)" (string, required)
   disconnect     - Disconnect to docker network
   create         - create a docker service Arguments: 
       1. "dockernode (IP:Port)" (string, required)
       2. "service name" (string, required)
       3. "Image"(string, required)
       4. "CPU name"(string, required)
       5. "CPU thread count"(int, required)
       6. "Memory name"(string, required)
       7. "Memory GByte"(int, required)
       8. "GPU Kind"(string, required)
       9. "GPU count"(int, required)
       10. "NetWork Community"(string, required)
       11. "SSH_PUBKEY"(string, required)
       12. "persistentStore"(bool, optional)
       13. "environment"(string,string , optional)
       14. {
               "ENV1": "value1"   (string,string, optional)               "ENV2": "value2"   (string,string, optional)               ...
           }
   delete         - delete a docker service Arguments: 
       1. "dockernode (IP:Port)" (string, required)
       2. "txid" (string, required)
sendtomasternode  - send to masternode address: 
       1. "dockernode (IP:Port)" (string, required)
       2. "MassGrid address"(string, required)
       3. "amount"(int, required)
dockernode command:  settlement        - set tlement a txid
       1. "txid" (string, required)
setpersistentstore        - set tlement a txid
       1. "status" (bool, optional)
setdefaultimage        - set default engine image
       1. "image" (string, optional)
listuntlementtx   - list all untlement transactions
listprice         - list all service items price
setprice          - set item price
       1. "type" (string, required)
       2. "name"(string, required)
       3. "price"(double, required)
setdockerfee      - set docker masternode fee (0.01):
       1. "price" (percent(double), required)
> massgrid-cli docker create "119.3.66.159:19443" "b5f53c3e9884d23620f1c5b6f027a32e92d9c68a123ada86c55282acd326fde9" "MassGrid" "massgrid/10.0-base-ubuntu16.04" intel_i3 1 ddr 1 "nvidia_p104_100_4g" 1 "massgridn2n" "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPEBGcs6VnDI89aVZHBCoDVq57qh7WamwXW4IbaIMWPeYIXQGAaYt83tCmJAcVggM176KELueh7+d1VraYDAJff9V5CxVoMhdJf1AmcIHGCyEjHRf12+Lme6zNVa95fI0h2tsryoYt1GAwshM6K1jUyBBWeVUdITAXGmtwco4k12QcDhqkfMlYD1afKjcivwaXVawaopdNqUVY7+0Do5ct4S4DDbx6Ka3ow71KyZMh2HpahdI9XgtzE3kTvIcena9GwtzjN+bf0+a8+88H6mtSyvKVDXghbGjunj55SaHZEwj+Cyv6Q/3EcZvW8q0jVuJu2AAQDm7zjgUfPF1Fwdv/ MassGrid" false "{\"ENV1\":\"value1\"}"
> massgrid-cli docker delete "119.3.66.159:19443" "b5f53c3e9884d23620f1c5b6f027a32e92d9c68a123ada86c55282acd326fde9"
> massgrid-cli docker sendtomasternode "119.3.66.159:19443" "mfb4XJGyaBwNK2Lf4a7r643U3JotRYNw2T" 6.4
> massgrid-cli docker settlement "b5f53c3e9884d23620f1c5b6f027a32e92d9c68a123ada86c55282acd326fde9"
> massgrid-cli docker setpersistentstore "1"
> massgrid-cli docker listuntlementtx
> massgrid-cli docker listprice
> massgrid-cli docker setprice "cpu intel_i3 0.8"
> massgrid-cli docker setdockerfee 0.01
> massgrid-cli docker getdndata "119.3.66.159:19443"
> massgrid-cli docker gettransaction "119.3.66.159:19443" "b5f53c3e9884d23620f1c5b6f027a32e92d9c68a123ada86c55282acd326fde9"
> massgrid-cli docker connect "10.1.1.4" "255.0.0.0" "119.3.66.159"
> massgrid-cli docker disconnect