Skip to content

Commit 4ef2a71

Browse files
author
Denis Shevchenko
committed
cardano-tracer: improve documentation
1 parent 2be07bb commit 4ef2a71

File tree

3 files changed

+78
-57
lines changed

3 files changed

+78
-57
lines changed

cardano-tracer/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ For more details please [read its documentation](https://github.com/input-output
1313
## Developers
1414

1515
Benchmarking team is responsible for this service. The primary developer is [@denisshevchenko](https://github.com/denisshevchenko).
16+
17+
## Feedback
18+
19+
Your bug reports and/or Feature Requests are welcome! Feel free to open a ticket in [this repository](https://github.com/input-output-hk/cardano-node/issues) with labels `RTView` and `tracing`.

cardano-tracer/docs/cardano-rtview.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ Now, open your node's configuration file (if you took it from [Hydra](https://hy
7979
"TraceOptionNodeName": "relay-1"
8080
```
8181

82+
Please make sure you specified the _real name_ of your node in `TraceOptionNodeName` field.
83+
8284
Finally, run the node with this configuration file and add tracer's CLI-parameter like this:
8385

8486
```
@@ -87,6 +89,16 @@ $ ./cardano-node run --tracer-socket-path-connect /tmp/forwarder.sock
8789

8890
That's it. Now you can open [https://127.0.0.1:3300](https://127.0.0.1:3300/) in your browser.
8991

92+
### Important
93+
94+
Please note that the node has another CLI-parameter for the socket:
95+
96+
```
97+
--socket-path FILEPATH Path to a cardano-node socket
98+
```
99+
100+
But `--socket-path` is **not** for working with `cardano-tracer`. The only CLI-parameters you need to specify the path to the socket for working with `cardano-tracer` are `--tracer-socket-path-connect` (if your node should _initiate_ connection) or `--tracer-socket-path-accept` (if your node should _accept_ connection). They are **not** related to `--socket-path`, so you can use these CLI-parameters independently from each other.
101+
90102
# Configuration
91103

92104
Since RTView is a part of `cardano-tracer`, the only thing you need to do is to enable RTView (because it's disabled by default). To do it, please add the following lines to `cardano-tracer`'s configuration file.
@@ -108,7 +120,7 @@ hasRTView:
108120
  epPort: 3300
109121
```
110122

111-
Here `epHost` and `epPort` specify the host and the port for RTView web page.
123+
Here `epHost` and `epPort` specify the host and the port for RTView web page. Also, you can find examples of configuration files in [configuration directory](https://github.com/input-output-hk/cardano-node/tree/master/cardano-tracer/configuration).
112124

113125
That's it. Now run `cardano-tracer` and open [127.0.0.1:3300](https://127.0.0.1:3300) in your browser.
114126

cardano-tracer/docs/cardano-tracer.md

Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Distributed scenario is for real-life case: for example, you have `N` nodes work
7575

7676
Local scenario is for testing case: for example, you want to try your new infrastructure from scratch, so you run `N` nodes and one `cardano-tracer` process on your machine.
7777

78-
**IMPORTANT NOTICE**: Please note that `cardano-tracer` **does not** support connection via IP-address and port, to avoid unauthorized connections. The **only** way to establish connection with the node is a local socket (Unix sockets or Windows named pipes).
78+
**IMPORTANT NOTICE**: Please note that `cardano-tracer` **does not** support connection via IP-address and port, to avoid unauthorized connections. The **only** way to establish connection with the node is the local socket (Unix sockets or Windows named pipes).
7979

8080
## Distributed Scenario
8181

@@ -103,7 +103,7 @@ The minimalistic configuration file for `cardano-tracer` would be:
103103
"networkMagic": 764824073,
104104
"network": {
105105
"tag": "AcceptAt",
106-
"contents": "/tmp/cardano-tracer.sock"
106+
"contents": "/tmp/forwarder.sock"
107107
},
108108
"logging": [
109109
{
@@ -115,80 +115,85 @@ The minimalistic configuration file for `cardano-tracer` would be:
115115
}
116116
```
117117

118-
The `network` field specifies the way how `cardano-tracer` will be connected to your nodes. Here you see `AcceptAt` tag, which means that `cardano-tracer` works as a server: it _accepts_ network connections by listening the local socket `/tmp/cardano-tracer.sock`. Your nodes work as clients: they _initiate_ network connections using their local sockets. It can be shown like this:
118+
The `network` field specifies the way how `cardano-tracer` will be connected to your nodes. Here you see `AcceptAt` tag, which means that `cardano-tracer` works as a server: it _accepts_ network connections by listening the local socket `/tmp/forwarder.sock`. Your nodes work as clients: they _initiate_ network connections using their local sockets. It can be shown like this:
119119

120120
```
121-
machine A machine B machine C
122-
+-----------------+ +-----------------+ +-----------------+
123-
| node 1 | | node 2 | | node 3 |
124-
| \ | | \ | | \ |
125-
| v | | v | | v |
126-
| local socket | | local socket | | local socket |
127-
+-----------------+ +-----------------+ +-----------------+
121+
machine A machine B machine C
122+
+----------------------+ +----------------------+ +----------------------+
123+
| node 1 | | node 2 | | node 3 |
124+
| \ | | \ | | \ |
125+
| v | | v | | v |
126+
| /tmp/forwarder.sock | | /tmp/forwarder.sock | | /tmp/forwarder.sock |
127+
+----------------------+ +----------------------+ +----------------------+
128128
129129
130130
131131
132132
133-
+---------------------+
134-
| local socket |
135-
| ^ |
136-
| \ |
137-
| cardano-tracer |
138-
+---------------------+
139-
machine D
133+
+---------------------+
134+
| /tmp/forwarder.sock |
135+
| ^ |
136+
| \ |
137+
| cardano-tracer |
138+
+---------------------+
139+
machine D
140140
```
141141

142142
To establish the real network connections between your machines, you need SSH forwarding:
143143

144144
```
145-
machine A machine B machine C
146-
+-----------------+ +-----------------+ +-----------------+
147-
| node 1 | | node 2 | | node 3 |
148-
| \ | | \ | | \ |
149-
| v | | v | | v |
150-
| local socket | | local socket | | local socket |
151-
+-----------------+ +-----------------+ +-----------------+
152-
^ ^ ^
153-
\ | /
154-
SSH SSH SSH
155-
\ | /
156-
v v v
157-
+---------------------+
158-
| local socket |
159-
| ^ |
160-
| \ |
161-
| cardano-tracer |
162-
+---------------------+
163-
machine D
145+
machine A machine B machine C
146+
+----------------------+ +----------------------+ +----------------------+
147+
| node 1 | | node 2 | | node 3 |
148+
| \ | | \ | | \ |
149+
| v | | v | | v |
150+
| /tmp/forwarder.sock | | /tmp/forwarder.sock | | /tmp/forwarder.sock |
151+
+----------------------+ +----------------------+ +----------------------+
152+
^ ^ ^
153+
\ | /
154+
SSH SSH SSH
155+
\ | /
156+
v v v
157+
+---------------------+
158+
| /tmp/forwarder.sock |
159+
| ^ |
160+
| \ |
161+
| cardano-tracer |
162+
+---------------------+
163+
machine D
164164
```
165165

166166
The idea of SSH forwarding is simple: we do connect not the processes directly, but their network endpoints instead. You can think of it as a network channel from the local socket on one machine to the local socket on another machine:
167167

168168
```
169-
machine A machine D
170-
+----------------------------+ +------------------------------------+
171-
| node 1 ---> local socket <-|---SSH channel---|-> local socket <--- cardano-tracer |
172-
+----------------------------+ +------------------------------------+
169+
machine A machine D
170+
+----------------------------------+ +------------------------------------------+
171+
| node 1 --> /tmp/forwarder.sock <-|---SSH channel---|-> /tmp/forwarder.sock <-- cardano-tracer |
172+
+----------------------------------+ +------------------------------------------+
173173
```
174174

175175
So neither your nodes nor `cardano-tracer` know anything about SSH, they only know about their local sockets. But because of SSH forwarding mechanism they work together from different machines. And since you already have your SSH credentials, the connection between your nodes and `cardano-tracer` will be secure.
176176

177+
Please note that the path `/tmp/forwarder.sock` is just an example. You can use any other name in any other directory where you have read/write permissions.
178+
177179
So, to connect `cardano-node` working on machine `A` with `cardano-tracer` working on machine `D`, run this command on machine `A`:
178180

179181
```
180-
ssh -nNT -L /tmp/cardano-tracer.sock:/tmp/cardano-node.sock -o "ExitOnForwardFailure yes" [email protected]
182+
ssh -nNT -L /tmp/forwarder.sock:/tmp/forwarder.sock -o "ExitOnForwardFailure yes" [email protected]
181183
```
182184

183185
where:
184186

185-
- `/tmp/cardano-tracer.sock` is a path to the local socket on machine `A`,
186-
- `/tmp/cardano-node.sock` is a path to the local socket on machine `D`,
187-
- `john` is a user you use to login on machine `D`,
187+
- `/tmp/forwarder.sock` is a path to the local socket on machine `A` _and_ a path to the local socket on machine `D`,
188+
- `john` is a user name you use to login on machine `D`,
188189
- `109.75.33.121` is an IP-adress of machine `D`.
189190

190191
Run the same command on machines `B` and `C` to connect corresponding nodes with the same `cardano-tracer` working on machine `D`.
191192

193+
### Important
194+
195+
Please make sure you run `ssh`-command **before** you start your node. Since `ssh` creates the channel and `cardano-node` uses that channel, you should _create_ it before _using_ it.
196+
192197
## Local Scenario
193198

194199
As was mentioned above, local scenario is for testing, when your nodes and `cardano-tracer` are working on the same machine. In this case all these processes can see the same local sockets directly, so we don't need `ssh`. The configuration file for 3 local nodes would look like this:
@@ -198,7 +203,7 @@ As was mentioned above, local scenario is for testing, when your nodes and `card
198203
"networkMagic": 764824073,
199204
"network": {
200205
"tag": "AcceptAt",
201-
"contents": "/tmp/cardano-tracer.sock"
206+
"contents": "/tmp/forwarder.sock"
202207
},
203208
"logging": [
204209
{
@@ -210,7 +215,7 @@ As was mentioned above, local scenario is for testing, when your nodes and `card
210215
}
211216
```
212217

213-
As you see, it is the same configuration file: the `cardano-tracer` works as a server: it _accepts_ network connections by listening the local socket `/tmp/cardano-tracer.sock`. Your local nodes work as clients: they _initiate_ network connections using the _same_ local socket `/tmp/cardano-tracer.sock`.
218+
As you see, it is the same configuration file: the `cardano-tracer` works as a server: it _accepts_ network connections by listening the local socket `/tmp/forwarder.sock`. Your local nodes work as clients: they _initiate_ network connections using the _same_ local socket `/tmp/forwarder.sock`.
214219

215220
There is another way to connect `cardano-tracer` to your nodes: the `cardano-tracer` can work as _initiator_, this is an example of configuration file:
216221

@@ -223,7 +228,7 @@ There is another way to connect `cardano-tracer` to your nodes: the `cardano-tra
223228
"/tmp/cardano-node-1.sock"
224229
"/tmp/cardano-node-2.sock"
225230
"/tmp/cardano-node-3.sock"
226-
]
231+
]
227232
},
228233
"logging": [
229234
{
@@ -237,13 +242,13 @@ There is another way to connect `cardano-tracer` to your nodes: the `cardano-tra
237242

238243
As you see, the tag in `network` field is `ConnectTo` now, which means that `cardano-tracer` works as a client: it _establishes_ network connections with your local nodes via the local sockets `/tmp/cardano-node-*.sock`. In this case each socket is used by a particular node.
239244

240-
Please use `ConnectTo`-based scenario only if you really need it. Otherwise, it is **highly recommended** to use `AcceptAt`-based scenario.
245+
Please use `ConnectTo`-based scenario only if you really need it. Otherwise, it is **highly recommended** to use `AcceptAt`-based scenario. The reason is easier maintainance. Suppose you have 3 working nodes, and they are connected to the same `cardano-tracer`. And then you want to connect 4-th node to it. If `cardano-tracer` is configured using `AcceptAt`, you shouldn't change its configuration - you just connect your 4-th node to it. But if `cardano-tracer` is configured using `ConnectTo`, you should add path to 4-th socket in its configuration file and then restart `cardano-tracer` process.
241246

242247
## Network Magic
243248

244249
The field `networkMagic` specifies the value of network magic. It is an integer constant from the genesis file, the node uses this value for the network handshake with peers. Since `cardano-tracer` should be connected to the node, it needs that network magic.
245250

246-
The value from the example above, `764824073`, is taken from the Shelley genesis file for Mainnet. Please take this value from the genesis file your nodes are launched with.
251+
The value from the example above, `764824073`, is taken from the Shelley genesis file for [Mainnet](https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/index.html). Please take this value from the genesis file your nodes are launched with.
247252

248253
## Requests
249254

@@ -340,9 +345,9 @@ Here the web page is available at `http://127.0.0.1:3000`. Please note that if y
340345
After you open `http://127.0.0.1:3000` in your browser, you will see the list of identifiers of connected nodes (or the warning message, if there are no connected nodes yet), for example:
341346

342347
```
343-
* tmp-cardano-tracer.sock@0
344-
* tmp-cardano-tracer.sock@1
345-
* tmp-cardano-tracer.sock@2
348+
* tmp-forwarder.sock@0
349+
* tmp-forwarder.sock@1
350+
* tmp-forwarder.sock@2
346351
```
347352

348353
Each identifier is a hyperlink to the page where you will see the **current** list of metrics received from the corresponding node, in such a format:
@@ -368,7 +373,7 @@ The optional field `hasEKG` specifies the hosts and ports of two web pages:
368373
1. the list of identifiers of connected nodes,
369374
2. EKG monitoring page.
370375

371-
For example:
376+
For example, if you use JSON configuration file:
372377

373378
```
374379
"hasEKG": [
@@ -386,9 +391,9 @@ For example:
386391
The page with the list of identifiers of connected nodes will be available at `http://127.0.0.1:3100`, for example:
387392

388393
```
389-
* tmp-cardano-tracer.sock@0
390-
* tmp-cardano-tracer.sock@1
391-
* tmp-cardano-tracer.sock@2
394+
* tmp-forwarder.sock@0
395+
* tmp-forwarder.sock@1
396+
* tmp-forwarder.sock@2
392397
```
393398

394399
Each identifier is a hyperlink, after clicking to it you will be redirected to `http://127.0.0.1:3101` where you will see EKG monitoring page for corresponding node.

0 commit comments

Comments
 (0)