lotus-worker: change address flag to listen (#2848)
* lotus-worker: change address flag to listen Clarify the flag on the worker process to be the local address and port the worker will listen on, and not the address of the miner. * fixup! lotus-worker: change address flag to listen Co-authored-by: Travis Person <travisperson@users.noreply.github.com>
This commit is contained in:
parent
e90b52eb8d
commit
ca53bf9097
@ -93,10 +93,14 @@ var runCmd = &cli.Command{
|
|||||||
Usage: "Start lotus worker",
|
Usage: "Start lotus worker",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "address",
|
Name: "listen",
|
||||||
Usage: "locally reachable address",
|
Usage: "host address and port the worker api will listen on",
|
||||||
Value: "0.0.0.0:3456",
|
Value: "0.0.0.0:3456",
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "address",
|
||||||
|
Hidden: true,
|
||||||
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "no-local-storage",
|
Name: "no-local-storage",
|
||||||
Usage: "don't use storageminer repo for sector storage",
|
Usage: "don't use storageminer repo for sector storage",
|
||||||
@ -123,10 +127,20 @@ var runCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "timeout",
|
Name: "timeout",
|
||||||
Usage: "used when address is unspecified. must be a valid duration recognized by golang's time.ParseDuration function",
|
Usage: "used when 'listen' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function",
|
||||||
Value: "30m",
|
Value: "30m",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Before: func(cctx *cli.Context) error {
|
||||||
|
if cctx.IsSet("address") {
|
||||||
|
log.Warnf("The '--address' flag is deprecated, it has been replaced by '--listen'")
|
||||||
|
if err := cctx.Set("listen", cctx.String("address")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
if !cctx.Bool("enable-gpu-proving") {
|
if !cctx.Bool("enable-gpu-proving") {
|
||||||
if err := os.Setenv("BELLMAN_NO_GPU", "true"); err != nil {
|
if err := os.Setenv("BELLMAN_NO_GPU", "true"); err != nil {
|
||||||
@ -268,7 +282,7 @@ var runCmd = &cli.Command{
|
|||||||
|
|
||||||
log.Info("Opening local storage; connecting to master")
|
log.Info("Opening local storage; connecting to master")
|
||||||
const unspecifiedAddress = "0.0.0.0"
|
const unspecifiedAddress = "0.0.0.0"
|
||||||
address := cctx.String("address")
|
address := cctx.String("listen")
|
||||||
addressSlice := strings.Split(address, ":")
|
addressSlice := strings.Split(address, ":")
|
||||||
if ip := net.ParseIP(addressSlice[0]); ip != nil {
|
if ip := net.ParseIP(addressSlice[0]); ip != nil {
|
||||||
if ip.String() == unspecifiedAddress {
|
if ip.String() == unspecifiedAddress {
|
||||||
@ -394,7 +408,7 @@ func watchMinerConn(ctx context.Context, cctx *cli.Context, nodeApi api.StorageM
|
|||||||
fmt.Sprintf("--miner-repo=%s", cctx.String("miner-repo")),
|
fmt.Sprintf("--miner-repo=%s", cctx.String("miner-repo")),
|
||||||
fmt.Sprintf("--enable-gpu-proving=%t", cctx.Bool("enable-gpu-proving")),
|
fmt.Sprintf("--enable-gpu-proving=%t", cctx.Bool("enable-gpu-proving")),
|
||||||
"run",
|
"run",
|
||||||
fmt.Sprintf("--address=%s", cctx.String("address")),
|
fmt.Sprintf("--listen=%s", cctx.String("listen")),
|
||||||
fmt.Sprintf("--no-local-storage=%t", cctx.Bool("no-local-storage")),
|
fmt.Sprintf("--no-local-storage=%t", cctx.Bool("no-local-storage")),
|
||||||
fmt.Sprintf("--precommit1=%t", cctx.Bool("precommit1")),
|
fmt.Sprintf("--precommit1=%t", cctx.Bool("precommit1")),
|
||||||
fmt.Sprintf("--precommit2=%t", cctx.Bool("precommit2")),
|
fmt.Sprintf("--precommit2=%t", cctx.Bool("precommit2")),
|
||||||
|
@ -47,15 +47,15 @@ On the machine that will run `lotus-worker`, set the `MINER_API_INFO` environmen
|
|||||||
Once this is set, run:
|
Once this is set, run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
lotus-worker run --address 192.168.2.10:2345
|
lotus-worker run
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace `192.168.2.10:2345` with the proper IP and port.
|
If you are running multiple workers on the same host, you will need to specify the `--listen` flag and ensure each worker is on a different port.
|
||||||
|
|
||||||
To check that the **Lotus Worker** is connected to your **Lotus Miner**, run `lotus-miner workers list` and check that the remote worker count has increased.
|
To check that the **Lotus Worker** is connected to your **Lotus Miner**, run `lotus-miner sealing workers` and check that the remote worker count has increased.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
why@computer ~/lotus> lotus-miner workers list
|
why@computer ~/lotus> lotus-miner sealing workers
|
||||||
Worker 0, host computer
|
Worker 0, host computer
|
||||||
CPU: [ ] 0 core(s) in use
|
CPU: [ ] 0 core(s) in use
|
||||||
RAM: [|||||||||||||||||| ] 28% 18.1 GiB/62.7 GiB
|
RAM: [|||||||||||||||||| ] 28% 18.1 GiB/62.7 GiB
|
||||||
@ -77,5 +77,5 @@ To do so you have to first __disable all seal task types__ in the miner config.
|
|||||||
You can then run the miner on your local-loopback interface;
|
You can then run the miner on your local-loopback interface;
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
lotus-worker run --address 127.0.0.1:2345
|
lotus-worker run
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user