cubedro / eth-net-intelligence-api

Ethereum Network Intelligence API
http://tinyurl.com/ofndjbo
GNU General Public License v3.0
324 stars 345 forks source link

how to connect with multiple rpc ip:port ? #257

Open madhuri03 opened 6 years ago

madhuri03 commented 6 years ago

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.

5chdn commented 6 years ago

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"
}
madhuri03 commented 6 years ago

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

5chdn commented 6 years ago

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
madhuri03 commented 6 years ago

Thanks @5chdn, This solution work for me.