From 4cf960e45b7b8715ecc078549a23a12777c4be53 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Mon, 26 Jul 2021 13:36:19 +0300 Subject: [PATCH 1/8] add notes regarding exporting/importing market data with lotus-shed --- docs/mine/lotus/split-markets-miners.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/mine/lotus/split-markets-miners.md b/docs/mine/lotus/split-markets-miners.md index 40bb264a8..5d0003e25 100644 --- a/docs/mine/lotus/split-markets-miners.md +++ b/docs/mine/lotus/split-markets-miners.md @@ -140,8 +140,6 @@ LOTUS_MINER_PATH=~/markets-repo-location ./lotus-miner run ## Rollback to `lotus-miner` monolith process -> Warning: after rollback, your miner won't be able to serve any storage deals that were made to it while the system was running in multi-process architecture (i.e. with a split `markets` service) - If you want to revert the changes listed above and go back to running `lotus-miner` as a single process, run the following: 1. Make sure that the `mining/sealing/proving` node is publicly exposed, as we will be enabling the markets subsystem on it. @@ -155,25 +153,33 @@ If you want to revert the changes listed above and go back to running `lotus-min EnableMarkets = true ``` -1. Move back the DAG store directory to the monolith miner node repository +3. Move back the DAG store directory to the monolith miner node repository ```shell mv ~/markets-repo-location/dagStore ~/.lotusminer/ ``` -1. Restart the `mining/sealing/proving` node (with the default LOTUS_MINER_PATH, which should point to your `mining/sealing/proving` node repo). Note that `lotus-miner` interacts with a given repository depending on the `LOTUS_MINER_PATH` environment variable! +4. Backup and restore the metadata related to storage deals from the `markets` instance back to the monolith miner instance. Given that storage deals metadata would have changed on the `markets` instance in case you accepted storage deals while running multi-services architecture, we have to copy it back to the monolith miner instance. + +```shell +./lotus-shed market export-datastore --repo ~/markets-repo-location --backup-dir /tmp/deals-backup + +./lotus-shed market import-datastore --repo ~/.lotusminer --backup-path /tmp/deals-backup/markets.datastore.backup +``` + +5. Restart the `mining/sealing/proving` node (with the default LOTUS_MINER_PATH, which should point to your `mining/sealing/proving` node repo). Note that `lotus-miner` interacts with a given repository depending on the `LOTUS_MINER_PATH` environment variable! ```shell ./lotus-miner run ``` -1. Fetch the node identity. This is necessary as you have to update your miner's peer identity on-chain, as it was changed to the identity of the markets node during the initialising of the markets service repository. +6. Fetch the node identity. This is necessary as you have to update your miner's peer identity on-chain, as it was changed to the identity of the markets node during the initialising of the markets service repository. ```shell ./lotus-miner net id ``` -1. Update the miner's peer id on-chain with the result from the previous step. +7. Update the miner's peer id on-chain with the result from the previous step. ```shell ./lotus-miner actor set-peer-id 12D3XXXXX From e5a575381e9eafce45b917062ee288e4dae40f50 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 27 Jul 2021 12:21:09 +0300 Subject: [PATCH 2/8] add section on how to interact with different processes --- docs/mine/lotus/split-markets-miners.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/mine/lotus/split-markets-miners.md b/docs/mine/lotus/split-markets-miners.md index 5d0003e25..079145b7d 100644 --- a/docs/mine/lotus/split-markets-miners.md +++ b/docs/mine/lotus/split-markets-miners.md @@ -138,6 +138,27 @@ mv ~/.lotusminer/dagStore ~/markets-repo-location/ LOTUS_MINER_PATH=~/markets-repo-location ./lotus-miner run ``` +## Interacting with the different miner instances with CLI over JSON RPC + +> In case you run more than one miner instance on the same machine, make sure that you have `MINER_API_INFO` environment variable `unset`. If you have it set, you will always be interacting with only one miner process, because it has precedence over `LOTUS_MINER_PATH`. + +Now that you have both a `markets` miner process and a `mining/sealing/proving` miner process running, you can confirm that you can interact with each respective process with the following: + +1. Get the peer identity of the `markets` miner process +```shell +LOTUS_MINER_PATH=~/markets-repo-location ./lotus-miner net id +``` + +2. Get a list of storage deals from the `markets` miner process +```shell +LOTUS_MINER_PATH=~/markets-repo-location ./lotus-miner storage-deals list +``` + +3. Get a list of sectors from the `mining/sealing/proving` miner process +```shell +LOTUS_MINER_PATH=~/.lotusminer ./lotus-miner sectors list +``` + ## Rollback to `lotus-miner` monolith process If you want to revert the changes listed above and go back to running `lotus-miner` as a single process, run the following: From d07337fcbc29f6a08e74c41104ed63402d6d7434 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 27 Jul 2021 14:18:52 +0300 Subject: [PATCH 3/8] better docs on the config.toml creation for the markets service --- docs/mine/lotus/split-markets-miners.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/mine/lotus/split-markets-miners.md b/docs/mine/lotus/split-markets-miners.md index 079145b7d..d14d8f332 100644 --- a/docs/mine/lotus/split-markets-miners.md +++ b/docs/mine/lotus/split-markets-miners.md @@ -73,21 +73,23 @@ export LOTUS_BACKUP_BASE_PATH=~/lotus-backup-location lotus-miner backup ~/lotus-backup-location/backupfile ``` -## Copy config.toml for the markets service +## Create config.toml for the markets service -You need to generate a `config.toml` for the markets node, and have them ready for the next step. For more information see [configuration usage page](https://docs.filecoin.io/get-started/lotus/configuration-and-advanced-usage/) and the [custom storage layout page](https://docs.filecoin.io/mine/lotus/custom-storage-layout/). +You need to create a `config.toml` for the markets node, and have it ready for the next step. For more information see [configuration usage page](https://docs.filecoin.io/get-started/lotus/configuration-and-advanced-usage/) and the [custom storage layout page](https://docs.filecoin.io/mine/lotus/custom-storage-layout/). -If you intend to run the `mining/sealing/proving` node on the same machine as the `markets` node, make sure that their listeners do not clash: +In the example commands below, we have placed the `config.toml` in the `~/.lotusmarket` directory. We are using the following `config.toml`: ```toml [API] ListenAddress = "/ip4/127.0.0.1/tcp/8787/http" RemoteListenAddress = "127.0.0.1:8787" -``` -By default the `lotus-miner` API server listens to port 2345, so in the example configuration above, we change the configuration for the `markets` node to listen to `127.0.0.1:8787`. +[Libp2p] + ListenAddresses = ["/ip4/127.0.0.1/tcp/24001", "/ip6/::/tcp/24001"] + AnnounceAddresses = ["/ip4/12.34.56.78/tcp/24001"] +``` -In the example commands below, we have placed the `config.toml` in the `~/.lotusmarket` directory. +If you intend to run the `mining/sealing/proving` node on the same machine as the `markets` node, make sure that their listeners do not clash. By default the `lotus-miner` API server listens to port 2345, so in the example configuration above, we change the configuration for the `markets` node to listen to `127.0.0.1:8787`. Make sure you adjust the `[Libp2p]` section on the `markets` node accordingly - it needs to be publicly accessible, so that clients can make storage and retrieval deals with your system. From 0edce7a368a709b99aca3120f564d4b9f2c1c001 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 27 Jul 2021 14:20:32 +0300 Subject: [PATCH 4/8] fixup --- docs/mine/lotus/split-markets-miners.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/mine/lotus/split-markets-miners.md b/docs/mine/lotus/split-markets-miners.md index d14d8f332..4c6e0ed57 100644 --- a/docs/mine/lotus/split-markets-miners.md +++ b/docs/mine/lotus/split-markets-miners.md @@ -77,7 +77,7 @@ lotus-miner backup ~/lotus-backup-location/backupfile You need to create a `config.toml` for the markets node, and have it ready for the next step. For more information see [configuration usage page](https://docs.filecoin.io/get-started/lotus/configuration-and-advanced-usage/) and the [custom storage layout page](https://docs.filecoin.io/mine/lotus/custom-storage-layout/). -In the example commands below, we have placed the `config.toml` in the `~/.lotusmarket` directory. We are using the following `config.toml`: +In the example commands below, we have placed the `config.toml` in the `~/.lotusmarket` directory, which is not the repository directory for the `markets` instance. The repository directory which we use is `~/markets-repo-location`. We are using the following `config.toml`: ```toml [API] From 4dbc4c72f0d0c81184e771e6f30c87c2ae243d7a Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 27 Jul 2021 14:40:26 +0300 Subject: [PATCH 5/8] fixup --- docs/mine/lotus/split-markets-miners.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/mine/lotus/split-markets-miners.md b/docs/mine/lotus/split-markets-miners.md index 4c6e0ed57..34ff79b6d 100644 --- a/docs/mine/lotus/split-markets-miners.md +++ b/docs/mine/lotus/split-markets-miners.md @@ -85,7 +85,7 @@ In the example commands below, we have placed the `config.toml` in the `~/.lotus RemoteListenAddress = "127.0.0.1:8787" [Libp2p] - ListenAddresses = ["/ip4/127.0.0.1/tcp/24001", "/ip6/::/tcp/24001"] + ListenAddresses = ["/ip4/0.0.0.0/tcp/24001", "/ip6/::/tcp/24001"] AnnounceAddresses = ["/ip4/12.34.56.78/tcp/24001"] ``` From 786cd055db1979bae87ed0a38f14e14d38edf2c9 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 27 Jul 2021 18:13:13 +0300 Subject: [PATCH 6/8] explicitly say to run init command on markets host --- docs/mine/lotus/split-markets-miners.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/mine/lotus/split-markets-miners.md b/docs/mine/lotus/split-markets-miners.md index 34ff79b6d..4dbc51d8d 100644 --- a/docs/mine/lotus/split-markets-miners.md +++ b/docs/mine/lotus/split-markets-miners.md @@ -106,7 +106,9 @@ export APISECTORINDEX=`./lotus-miner auth api-info --perm=admin` 2. Initialise the `market` node. This performs a one-time setup of the markets node. Part of that setup includes updating the `Peer ID` and the `Multiaddr` in the miner actor by submitting a message on chain. This is necessary so that storage and retrieval clients know that this miner's **deal-making** endpoint is now publicly dialable/reachable on a new address (the new `market` node). - Note that `lotus-miner` interacts with one repository or another depending on the `LOTUS_MINER_PATH` environment variable! +Note that `lotus-miner` interacts with one repository or another depending on the `LOTUS_MINER_PATH` environment variable! + +This command should be run on the `markets` miner instance host, as it is creating the `markets` miner instance repository, among other actions. ```shell export LOTUS_MINER_PATH=~/markets-repo-location From 03ff700bc5c7d62bd856bd0e1cf37f3a68e93073 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 27 Jul 2021 18:25:01 +0300 Subject: [PATCH 7/8] add a note about updating the multiaddr of the miner --- docs/mine/lotus/split-markets-miners.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/mine/lotus/split-markets-miners.md b/docs/mine/lotus/split-markets-miners.md index 4dbc51d8d..4937f5893 100644 --- a/docs/mine/lotus/split-markets-miners.md +++ b/docs/mine/lotus/split-markets-miners.md @@ -104,7 +104,7 @@ export APISEALER=`./lotus-miner auth api-info --perm=admin` export APISECTORINDEX=`./lotus-miner auth api-info --perm=admin` ``` -2. Initialise the `market` node. This performs a one-time setup of the markets node. Part of that setup includes updating the `Peer ID` and the `Multiaddr` in the miner actor by submitting a message on chain. This is necessary so that storage and retrieval clients know that this miner's **deal-making** endpoint is now publicly dialable/reachable on a new address (the new `market` node). +2. Initialise the `market` node. This performs a one-time setup of the markets node. Part of that setup includes updating the `peer id` in the miner actor by submitting a message on chain. This is necessary so that storage and retrieval clients know that this miner's **deal-making** endpoint is now publicly dialable/reachable on a new address (the new `market` node). Note that `lotus-miner` interacts with one repository or another depending on the `LOTUS_MINER_PATH` environment variable! @@ -120,6 +120,12 @@ export LOTUS_MINER_PATH=~/markets-repo-location ~/lotus-backup-location/backupfile ``` +3. Optionally update your miner's `multiaddr` on-chain - in case your `markets` instance is publicly exposed at a different location compared to your exiting monolith miner, you also need to update your `multiaddr` on-chain and advertise the correct one to clients: + +```shell +./lotus-miner actor set-addrs +``` + ## Move the DAG store directory to the markets node repository ```shell From bbae1d56d8f38f2cd7742982899e03c20452b7c1 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 27 Jul 2021 18:31:01 +0300 Subject: [PATCH 8/8] group sections into one bigger section --- docs/mine/lotus/split-markets-miners.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/mine/lotus/split-markets-miners.md b/docs/mine/lotus/split-markets-miners.md index 4937f5893..0374f409a 100644 --- a/docs/mine/lotus/split-markets-miners.md +++ b/docs/mine/lotus/split-markets-miners.md @@ -66,14 +66,16 @@ export LOTUS_BACKUP_BASE_PATH=~/lotus-backup-location lotus-miner run ``` -## Creating a backup +## Splitting the `lotus-miner` monolith + +### 1. Creating a backup ```shell export LOTUS_BACKUP_BASE_PATH=~/lotus-backup-location lotus-miner backup ~/lotus-backup-location/backupfile ``` -## Create config.toml for the markets service +### 2. Create `config.toml` for the markets service You need to create a `config.toml` for the markets node, and have it ready for the next step. For more information see [configuration usage page](https://docs.filecoin.io/get-started/lotus/configuration-and-advanced-usage/) and the [custom storage layout page](https://docs.filecoin.io/mine/lotus/custom-storage-layout/). @@ -95,7 +97,7 @@ Make sure you adjust the `[Libp2p]` section on the `markets` node accordingly - The `[Libp2p]` section on the `mining/sealing/proving` node can be removed because this node will no longer be running a Libp2p node. -## Initialising a markets service repository +### 3. Initialising a `markets` service repository 1. Create authentication tokens for the `markets` node @@ -126,13 +128,13 @@ export LOTUS_MINER_PATH=~/markets-repo-location ./lotus-miner actor set-addrs ``` -## Move the DAG store directory to the markets node repository +### 4. Move the DAG store directory to the markets node repository ```shell mv ~/.lotusminer/dagStore ~/markets-repo-location/ ``` -## Start the `mining/sealing/proving` miner process without the markets subsystem +### 5. Start the `mining/sealing/proving` miner process without the markets subsystem 1. Update your `config.toml` and set `EnableMarkets` option to `false`. @@ -142,7 +144,7 @@ mv ~/.lotusminer/dagStore ~/markets-repo-location/ ./lotus-miner run ``` -## Start the `markets` miner process with the markets subsystem +### 6. Start the `markets` miner process with the markets subsystem ```shell LOTUS_MINER_PATH=~/markets-repo-location ./lotus-miner run