mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Begin
This commit is contained in:
parent
86b20d897e
commit
a4388b06ba
1 changed files with 42 additions and 41 deletions
|
|
@ -1,6 +1,15 @@
|
||||||
---
|
---
|
||||||
title: Setting up private network or local cluster
|
title: Setting up private network or local cluster
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> In the first link, the first section "Setting up multiple nodes" does not necessarily imply that those nodes will be connected in any way. They could literally be separate nodes that have no knowledge of each other. Perhaps serving as an array of nodes for some local testers, for example.
|
||||||
|
>
|
||||||
|
> It seems that it is trying to describe how to run multiple nodes locally, without those nodes treading on each other's toes and corrupting each other's accounts.
|
||||||
|
>
|
||||||
|
> This does not mean they will know about each other and 'form a p2p network'
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
This page describes how to set up a local cluster of nodes, advise how to make it private, and how to hook up your nodes on the eth-netstat network monitoring app.
|
This page describes how to set up a local cluster of nodes, advise how to make it private, and how to hook up your nodes on the eth-netstat network monitoring app.
|
||||||
A fully controlled ethereum network is useful as a backend for network integration testing (core developers working on issues related to networking/blockchain synching/message propagation, etc or DAPP developers testing multi-block and multi-user scenarios).
|
A fully controlled ethereum network is useful as a backend for network integration testing (core developers working on issues related to networking/blockchain synching/message propagation, etc or DAPP developers testing multi-block and multi-user scenarios).
|
||||||
|
|
||||||
|
|
@ -9,22 +18,22 @@ We assume you are able to build `geth` following the [build instructions](../ins
|
||||||
## Setting up multiple nodes
|
## Setting up multiple nodes
|
||||||
|
|
||||||
In order to run multiple ethereum nodes locally, you have to make sure:
|
In order to run multiple ethereum nodes locally, you have to make sure:
|
||||||
- each instance has a separate data directory (`--datadir`)
|
|
||||||
- each instance runs on a different port (both eth and rpc) (`--port and --rpcport`)
|
- each instance has a separate data directory (`--datadir`)
|
||||||
- in case of a cluster the instances must know about each other
|
- each instance runs on a different port (both eth and rpc) (`--port and --rpcport`)
|
||||||
- the ipc endpoint is unique or the ipc interface is disabled (`--ipcpath or --ipcdisable`)
|
- in case of a cluster the instances must know about each other
|
||||||
|
- the ipc endpoint is unique or the ipc interface is disabled (`--ipcpath or --ipcdisable`)
|
||||||
|
|
||||||
You start the first node (let's make port explicit and disable ipc interface)
|
You start the first node (let's make port explicit and disable ipc interface)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
geth --datadir="/tmp/eth/60/01" -verbosity 6 --ipcdisable --port 30301 --rpcport 8101 console 2>> /tmp/eth/60/01.log
|
geth --datadir="/tmp/eth/60/01" -verbosity 6 --ipcdisable --port 30301 --rpcport 8101 console 2>> /tmp/eth/60/01.log
|
||||||
```
|
```
|
||||||
|
|
||||||
We started the node with the console, so that we can grab the enode url for instance:
|
We started the node with the console, so that we can grab the enode url for instance:
|
||||||
|
|
||||||
```
|
> admin.nodeInfo.enode
|
||||||
> admin.nodeInfo.enode
|
enode://8c544b4a07da02a9ee024def6f3ba24b2747272b64e16ec5dd6b17b55992f8980b77938155169d9d33807e501729ecb42f5c0a61018898c32799ced152e9f0d7@9[::]:30301
|
||||||
enode://8c544b4a07da02a9ee024def6f3ba24b2747272b64e16ec5dd6b17b55992f8980b77938155169d9d33807e501729ecb42f5c0a61018898c32799ced152e9f0d7@9[::]:30301
|
|
||||||
```
|
|
||||||
|
|
||||||
`[::]` will be parsed as localhost (`127.0.0.1`). If your nodes are on a local network check each individual host machine and find your ip with `ifconfig` (on Linux and MacOS):
|
`[::]` will be parsed as localhost (`127.0.0.1`). If your nodes are on a local network check each individual host machine and find your ip with `ifconfig` (on Linux and MacOS):
|
||||||
|
|
||||||
|
|
@ -55,6 +64,8 @@ true
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
## Local cluster
|
## Local cluster
|
||||||
|
|
||||||
As an extention of the above, you can spawn a local cluster of nodes easily. It can also be scripted including account creation which is needed for mining.
|
As an extention of the above, you can spawn a local cluster of nodes easily. It can also be scripted including account creation which is needed for mining.
|
||||||
|
|
@ -62,58 +73,48 @@ See [`gethcluster.sh`](https://github.com/ethersphere/eth-utils) script, and the
|
||||||
|
|
||||||
## Private network
|
## Private network
|
||||||
|
|
||||||
See [[the Private Network Page|Private network]] for more information.
|
See \[[the Private Network Page|Private network]] for more information.
|
||||||
|
|
||||||
### Setup bootnode
|
### Setup bootnode
|
||||||
|
|
||||||
The first time a node connects to the network it uses one of the predefined [bootnodes](https://github.com/ethereum/go-ethereum/blob/master/params/bootnodes.go). Through these bootnodes a node can join the network and find other nodes. In the case of a private cluster these predefined bootnodes are not of much use. Therefore go-ethereum offers a bootnode implementation that can be configured and run in your private network.
|
The first time a node connects to the network it uses one of the predefined [bootnodes](https://github.com/ethereum/go-ethereum/blob/master/params/bootnodes.go). Through these bootnodes a node can join the network and find other nodes. In the case of a private cluster these predefined bootnodes are not of much use. Therefore go-ethereum offers a bootnode implementation that can be configured and run in your private network.
|
||||||
|
|
||||||
It can be run through the command.
|
It can be run through the command.
|
||||||
```
|
|
||||||
> bootnode
|
> bootnode
|
||||||
Fatal: Use -nodekey or -nodekeyhex to specify a private key
|
Fatal: Use -nodekey or -nodekeyhex to specify a private key
|
||||||
```
|
|
||||||
|
|
||||||
As can be seen the bootnode asks for a key. Each ethereum node, including a bootnode is identified by an enode identifier. These identifiers are derived from a key. Therefore you will need to give the bootnode such key. Since we currently don't have one we can instruct the bootnode to generate a key (and store it in a file) before it starts.
|
As can be seen the bootnode asks for a key. Each ethereum node, including a bootnode is identified by an enode identifier. These identifiers are derived from a key. Therefore you will need to give the bootnode such key. Since we currently don't have one we can instruct the bootnode to generate a key (and store it in a file) before it starts.
|
||||||
|
|
||||||
```
|
> bootnode -genkey bootnode.key
|
||||||
> bootnode -genkey bootnode.key
|
I0216 09:53:08.076155 p2p/discover/udp.go:227] Listening, enode://890b6b5367ef6072455fedbd7a24ebac239d442b18c5ab9d26f58a349dad35ee5783a0dd543e4f454fed22db9772efe28a3ed6f21e75674ef6203e47803da682@[::]:30301
|
||||||
I0216 09:53:08.076155 p2p/discover/udp.go:227] Listening, enode://890b6b5367ef6072455fedbd7a24ebac239d442b18c5ab9d26f58a349dad35ee5783a0dd543e4f454fed22db9772efe28a3ed6f21e75674ef6203e47803da682@[::]:30301
|
|
||||||
```
|
|
||||||
|
|
||||||
(exit with CTRL-C)
|
(exit with CTRL-C)
|
||||||
|
|
||||||
The stored key can be seen with:
|
The stored key can be seen with:
|
||||||
```
|
|
||||||
> cat bootnode.key
|
> cat bootnode.key
|
||||||
dc90f8f7324f1cc7ba52c4077721c939f98a628ed17e51266d01c9cd0294033a
|
dc90f8f7324f1cc7ba52c4077721c939f98a628ed17e51266d01c9cd0294033a
|
||||||
```
|
|
||||||
|
|
||||||
To instruct geth nodes to use our own bootnode(s) use the `--bootnodes` flag. This is a comma separated list of bootnode enode identifiers.
|
To instruct geth nodes to use our own bootnode(s) use the `--bootnodes` flag. This is a comma separated list of bootnode enode identifiers.
|
||||||
|
|
||||||
```
|
geth --bootnodes "enode://890b6b5367ef6072455fedbd7a24ebac239d442b18c5ab9d26f58a349dad35ee5783a0dd543e4f454fed22db9772efe28a3ed6f21e75674ef6203e47803da682@[::]:30301"
|
||||||
geth --bootnodes "enode://890b6b5367ef6072455fedbd7a24ebac239d442b18c5ab9d26f58a349dad35ee5783a0dd543e4f454fed22db9772efe28a3ed6f21e75674ef6203e47803da682@[::]:30301"
|
|
||||||
```
|
|
||||||
(what [::] means is explained previously)
|
(what [::] means is explained previously)
|
||||||
|
|
||||||
Since it is convenient to start the bootnode each time with the same enode we can give the bootnode program the just generated key on the next time it is started.
|
Since it is convenient to start the bootnode each time with the same enode we can give the bootnode program the just generated key on the next time it is started.
|
||||||
|
|
||||||
```
|
bootnode -nodekey bootnode.key
|
||||||
bootnode -nodekey bootnode.key
|
I0216 10:01:19.125600 p2p/discover/udp.go:227] Listening, enode://890b6b5367ef6072455fedbd7a24ebac239d442b18c5ab9d26f58a349dad35ee5783a0dd543e4f454fed22db9772efe28a3ed6f21e75674ef6203e47803da682@[::]:30301
|
||||||
I0216 10:01:19.125600 p2p/discover/udp.go:227] Listening, enode://890b6b5367ef6072455fedbd7a24ebac239d442b18c5ab9d26f58a349dad35ee5783a0dd543e4f454fed22db9772efe28a3ed6f21e75674ef6203e47803da682@[::]:30301
|
|
||||||
```
|
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```
|
bootnode -nodekeyhex dc90f8f7324f1cc7ba52c4077721c939f98a628ed17e51266d01c9cd0294033a
|
||||||
bootnode -nodekeyhex dc90f8f7324f1cc7ba52c4077721c939f98a628ed17e51266d01c9cd0294033a
|
I0216 10:01:40.094089 p2p/discover/udp.go:227] Listening, enode://890b6b5367ef6072455fedbd7a24ebac239d442b18c5ab9d26f58a349dad35ee5783a0dd543e4f454fed22db9772efe28a3ed6f21e75674ef6203e47803da682@[::]:30301
|
||||||
I0216 10:01:40.094089 p2p/discover/udp.go:227] Listening, enode://890b6b5367ef6072455fedbd7a24ebac239d442b18c5ab9d26f58a349dad35ee5783a0dd543e4f454fed22db9772efe28a3ed6f21e75674ef6203e47803da682@[::]:30301
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Monitoring your nodes
|
## Monitoring your nodes
|
||||||
|
|
||||||
[This page](https://github.com/ethereum/wiki/wiki/Network-Status) describes how to use the [The Ethereum (centralised) network status monitor (known sometimes as "eth-netstats")](http://stats.ethdev.com) to monitor your nodes.
|
[This page](https://github.com/ethereum/wiki/wiki/Network-Status) describes how to use the [The Ethereum (centralised) network status monitor (known sometimes as "eth-netstats")](http://stats.ethdev.com) to monitor your nodes.
|
||||||
|
|
||||||
[This page](../doc/setting-up-monitoring-on-local-cluster) or [this README](https://github.com/ethersphere/eth-utils)
|
[This page](Setting-up-monitoring-on-local-cluster) or [this README](https://github.com/ethersphere/eth-utils)
|
||||||
describes how you set up your own monitoring service for a (private or public) local cluster.
|
describes how you set up your own monitoring service for a (private or public) local cluster.
|
||||||
Loading…
Reference in a new issue