synechron-finlabs / quorum-maker

Utility to create and monitor Quorum nodes
Apache License 2.0
196 stars 97 forks source link

How do I remove a node from the network? #58

Closed Eithcowich closed 5 years ago

Eithcowich commented 5 years ago

I have a network with several nodes and one of them is permanently inactive, and would never come back. How do I remove it? There's no need for it to be in /getNodeList.

dhyansraj commented 5 years ago

Right now this is not implemented in Quorum Maker. But you can do this manually by two steps. run raft.removePeer(peerid) from each of the geth consoles (you need to geth attach to each peer). Also you need to remove the peer from NetworkManagerContract.sol so that /getNodeList wont return this node. But currently there are no functions in the contract to do that. You can add a deleteNode function in the contract and build the a new docker image, and then execute the function on the contract address. Happy to accept your pull request if you can volunteer. Else we will add this feature in a future release.

Eithcowich commented 5 years ago

How do I geth attach? Where is geth in your directory structure?

dhyansraj commented 5 years ago

you will have to run 'docker exec -it bash' to get into the respective node. From there you can run 'geth attach <path to .ipc file>'

Eithcowich commented 5 years ago

docker exec -it back is a usage error. I get docker requires at least two arguments. What's the exact command, assuming I'm on the node's ssh shell?

dhyansraj commented 5 years ago

its bash, not back.

Eithcowich commented 5 years ago

Yeah, it was a typo in my comment. I run sudo docker exec -it bash which results in

"docker exec" requires at least 2 arguments. 
See 'docker exec --help'.
Usage:  docker exec [OPTIONS] CONTAINER COMMAND [ARG...] [flags]
Run a command in a running container
dhyansraj commented 5 years ago

docker exec -it bash

Eithcowich commented 5 years ago

The actual command is sudo docker exec -it <container name> bash. In my case the container name was simply the node name.

How do I now call raft.removePeer()? Which is the node id? Is it listed in /getNodeList?

For example where is it here:

[{"nodeName":"node6","role":"Unassigned","publicKey":"o84AQZmRX3ezMBN3RFkFpxNJyh3Q5gMxXsrHL8KTShk=","enode":"b20cd16833396c7767dd4ac7c3510185218f57026f485fbb6c316efc834d0bffb6825e0325124274356a50a0af144adfc1b614a65cd9bddfddb8dfb0c4d39ba2","ip":"23.101.115.159","id":"6","self":"false","active":"false"}]

Is it the enode? Or the id?

Again, a full command would be appreciated.

Eithcowich commented 5 years ago

To finish this issue, it works with the node id. Like this

> raft.removePeer(6)
> null
>

To my understanding once it's done on one node, raft syncs it with all the others.

@dhyansraj thank you very much for you help. I looked at the NetworkManagerContract and it looks like removing a peer is one simple method. Not sure if the company I'm doing this for would authorize adding it but if it works out I'll gladly do it.