eth-net-intelligence-api icon indicating copy to clipboard operation
eth-net-intelligence-api copied to clipboard

how to connect with multiple rpc ip:port ?

Open madhuri03 opened this issue 6 years ago • 4 comments

i have three nodes which running on 3 different server. I want to list all 3 node on my eth-netstat app for example

  1. enode://pubkey1@ip1:port1
  2. enode://pubkey2@ip2:port2
  3. enode://pubkey3@ip3:port3 how can I achive this?

right now I can attach with one node by setting env in app.json.

{ "NODE_ENV" : "production", "RPC_HOST" : "ip1", "RPC_PORT" : "port1", "LISTENING_PORT" : "30303", "INSTANCE_NAME" : "my_node", "CONTACT_DETAILS" : "", "WS_SERVER" : "ws://localhost:3000", "WS_SECRET" : "ChangeWsSecret", "VERBOSITY" : "2" }

my goal is to list multiple node.

madhuri03 avatar Jun 25 '18 11:06 madhuri03

Just create 3 json files like this

{
"NODE_ENV" : "production1",
"RPC_HOST" : "ip1",
"RPC_PORT" : "port1",
"LISTENING_PORT" : "lis_port1",
"INSTANCE_NAME" : "my_node1",
"CONTACT_DETAILS" : "",
"WS_SERVER" : "ws://localhost:3000",
"WS_SECRET" : "ChangeWsSecret",
"VERBOSITY" : "2"
}
{
"NODE_ENV" : "production2",
"RPC_HOST" : "ip2",
"RPC_PORT" : "port2",
"LISTENING_PORT" : "lis_port2",
"INSTANCE_NAME" : "my_node2",
"CONTACT_DETAILS" : "",
"WS_SERVER" : "ws://localhost:3000",
"WS_SECRET" : "ChangeWsSecret",
"VERBOSITY" : "2"
}
{
"NODE_ENV" : "production3",
"RPC_HOST" : "ip3",
"RPC_PORT" : "port3",
"LISTENING_PORT" : "lis_port3",
"INSTANCE_NAME" : "my_node3",
"CONTACT_DETAILS" : "",
"WS_SERVER" : "ws://localhost:3000",
"WS_SECRET" : "ChangeWsSecret",
"VERBOSITY" : "2"
}

5chdn avatar Jun 25 '18 12:06 5chdn

where can I address these file in app? sorry I didn't understand the solution could you please explain?

madhuri03 avatar Jun 25 '18 12:06 madhuri03

copy app.json to node1.json, node2.json, node3.json, edit them as stated above and then start all of them

pm2 start node1.json
pm2 start node2.json
pm2 start node3.json

5chdn avatar Jun 25 '18 12:06 5chdn

Thanks @5chdn, This solution work for me.

madhuri03 avatar Jun 25 '18 13:06 madhuri03