File: clush.1

package info (click to toggle)
clustershell 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,236 kB
  • sloc: python: 12,990; yacc: 2,844; makefile: 7
file content (419 lines) | stat: -rw-r--r-- 12,673 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
.\" Man page generated from reStructeredText.
.
.TH CLUSH 1 "2012-04-01" "1.6" "ClusterShell User Manual"
.SH NAME
clush \- execute shell commands on a cluster
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.SH SYNOPSIS
.sp
\fCclush\fP \fC\-a\fP | \fC\-g\fP \fIgroup\fP | \fC\-w\fP \fInodes\fP  [OPTIONS]
.sp
\fCclush\fP \fC\-a\fP | \fC\-g\fP \fIgroup\fP | \fC\-w\fP \fInodes\fP  [OPTIONS] \fIcommand\fP
.sp
\fCclush\fP \fC\-a\fP | \fC\-g\fP \fIgroup\fP | \fC\-w\fP \fInodes\fP  [OPTIONS] \-\-copy
\fIfile\fP | \fIdir\fP [ \fIfile\fP | \fIdir\fP ...] [ \-\-dest \fIpath\fP ]
.sp
\fCclush\fP \fC\-a\fP | \fC\-g\fP \fIgroup\fP | \fC\-w\fP \fInodes\fP  [OPTIONS] \-\-rcopy
\fIfile\fP | \fIdir\fP [ \fIfile\fP | \fIdir\fP ...] [ \-\-dest \fIpath\fP ]
.SH DESCRIPTION
.sp
\fCclush\fP is a program for executing commands in parallel on a cluster and for
gathering their results. \fCclush\fP executes commands interactively or can be
used within shell scripts and other applications.  It is a partial front\-end
to the ClusterShell library that ensures a light, unified and robust parallel
command execution framework. Thus, it allows traditional shell scripts to
benefit from some of the library features. \fCclush\fP currently makes use of
the Ssh worker of ClusterShell that only requires \fCssh\fP(1) (OpenSSH SSH
client).
.SH INVOCATION
.sp
\fCclush\fP can be started non\-interactively to run a shell \fIcommand\fP, or can
be invoked as an interactive shell. To start a \fCclush\fP interactive session,
invoke the \fCclush\fP command without providing \fIcommand\fP.
.INDENT 0.0
.TP
.B Non\-interactive mode
.
When \fCclush\fP is started non\-interactively, the \fIcommand\fP is executed on
the specified remote hosts in parallel. If option \fC\-b\fP or \fC\-\-dshbak\fP
is specified, \fCclush\fP waits for command completion and then displays
gathered output results.
.sp
The \fC\-w\fP option allows you to specify remote hosts by using ClusterShell
NodeSet syntax, including the node groups \fC@group\fP special syntax and the
\fCExtended Patterns\fP syntax to benefits from NodeSet basic arithmetics
(like \fC@Agroup\e&@Bgroup\fP). See EXTENDED PATTERNS in \fCnodeset\fP(1) and
also \fCgroups.conf\fP(5) for more information.
.sp
Unless option \fC\-\-nostdin\fP is specified, \fCclush\fP detects when its
standard input is connected to a terminal (as determined by \fCisatty\fP(3)).
If actually connected to a terminal, \fCclush\fP listens to standard input
when commands are running, waiting for an \fIEnter\fP key press. Doing so will
display the status of current nodes.  If standard input is not connected
to a terminal, and unless option \fC\-\-nostdin\fP is specified, \fCclush\fP
binds the standard input of the remote commands to its own standard input,
allowing scripting methods like:
.INDENT 7.0
.INDENT 3.5
.nf
# echo foo | clush \-w node[40\-42] \-b cat
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
node[40\-42]
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
foo
.fi
.sp
.UNINDENT
.UNINDENT
.sp
Please see some other great examples in the EXAMPLES section below.
.TP
.B Interactive session
.
If a \fIcommand\fP is not specified, and its standard input is connected to a
terminal, \fCclush\fP runs interactively. In this mode, \fCclush\fP uses the GNU
\fCreadline\fP library to read command lines. Readline provides commands for
searching through the command history for lines containing a specified
string. For instance, type Control\-R to search in the history for the next
entry matching the search string typed so far.  \fCclush\fP also recognizes
special single\-character prefixes that allows the user to see and modify
the current nodeset (the nodes where the commands are executed).
.INDENT 7.0
.TP
.B Single\-character interactive commands are:
.INDENT 7.0
.TP
.B clush> ?
.
show current nodeset
.TP
.B clush> =<NODESET>
.
set current nodeset
.TP
.B clush> +<NODESET>
.
add nodes to current nodeset
.TP
.B clush> \-<NODESET>
.
remove nodes from current nodeset
.TP
.B clush> !COMMAND
.
execute COMMAND on the local system
.TP
.B clush> =
.
toggle the output format (gathered or standard mode)
.UNINDENT
.UNINDENT
.sp
To leave an interactive session, type \fCquit\fP or Control\-D.
.TP
.B File copying mode ( \fC\-\-copy\fP )
.sp
When \fCclush\fP is started with the \fC\-c\fP or \fC\-\-copy\fP option, it will
attempt to copy specified \fIfile\fP and/or \fIdir\fP to the provided target
cluster nodes.  If the \fC\-\-dest\fP option is specified, it will put the
copied files there.
.TP
.B Reverse file copying mode ( \fC\-\-rcopy\fP )
.sp
When \fCclush\fP is started with the \fC\-\-rcopy\fP option, it will attempt to
retrieve specified \fIfile\fP and/or \fIdir\fP from provided cluster nodes. If the
\fC\-\-dest\fP option is specified, it must be a directory path where the files
will be stored with their hostname appended. If the destination path is not
specified, it will take the first \fIfile\fP or \fIdir\fP basename directory as the
local destination.
.UNINDENT
.SH OPTIONS
.INDENT 0.0
.TP
.B \-\-version
.
show \fCclush\fP version number and exit
.TP
.BI \-s \ GROUPSOURCE, \ \-\-groupsource\fB= GROUPSOURCE
.
optional \fCgroups.conf\fP(5) group source to use
.TP
.B \-\-nostdin
.
do not watch for possible input from stdin
.UNINDENT
.INDENT 0.0
.TP
.B Selecting target nodes:
.INDENT 7.0
.TP
.BI \-w \ NODES
.
nodes where to run the command
.TP
.BI \-x \ NODES
.
exclude nodes from the node list
.TP
.B \-a,  \-\-all
.
run command on all nodes
.TP
.BI \-g \ GROUP, \ \-\-group\fB= GROUP
.
run command on a group of nodes
.TP
.BI \-X \ GROUP
.
exclude nodes from this group
.UNINDENT
.TP
.B Output behaviour:
.INDENT 7.0
.TP
.B \-q,  \-\-quiet
.
be quiet, print essential output only
.TP
.B \-v,  \-\-verbose
.
be verbose, print informative messages
.TP
.B \-d,  \-\-debug
.
output more messages for debugging purpose
.TP
.B \-G,  \-\-groupbase
.
do not display group source prefix
.TP
.B \-L
.
disable header block and order output by nodes; additionally, when used in conjunction with \-b/\-B, it will enable "life gathering" of results by line mode, such as the next line is displayed as soon as possible (eg. when all nodes have sent the line)
.TP
.B \-N
.
disable labeling of command line
.TP
.B \-b,  \-\-dshbak
.
display gathered results in a dshbak\-like way
.TP
.B \-B
.
like \-b but including standard error
.TP
.B \-r,  \-\-regroup
.
fold nodeset using node groups
.TP
.B \-S
.
return the largest of command return codes
.TP
.BI \-\-color\fB= WHENCOLOR
.
whether to use ANSI colors to surround node or nodeset prefix/header with escape sequences to display them in color on the terminal. \fIWHENCOLOR\fP is \fCnever\fP, \fCalways\fP or \fCauto\fP (which use color if standard output/error refer to a terminal). Colors are set to [34m (blue foreground text) for stdout and [31m (red foreground text) for stderr, and cannot be modified.
.TP
.B \-\-diff
.
show diff between common outputs (find the best reference output by focusing on largest nodeset and also smaller command return code)
.UNINDENT
.TP
.B File copying:
.INDENT 7.0
.TP
.B \-c,  \-\-copy
.
copy local file or directory to remote nodes
.TP
.B \-\-rcopy
.
copy file or directory from remote nodes
.TP
.BI \-\-dest\fB= DEST_PATH
.
destination file or directory on the nodes
(optional: use the first source directory
path when not specified)
.TP
.B \-p
.
preserve modification times and modes
.UNINDENT
.TP
.B Ssh options:
.INDENT 7.0
.TP
.BI \-f \ FANOUT, \ \-\-fanout\fB= FANOUT
.
use a specified maximum fanout size (ie. do not execute more than FANOUT commands at the same time, useful to limit resource usage)
.TP
.BI \-l \ USER, \ \-\-user\fB= USER
.
execute remote command as user
.TP
.BI \-o \ OPTIONS, \ \-\-options\fB= OPTIONS
.
can be used to give ssh options, eg. \fC\-o "\-oPort=2022"\fP
.TP
.BI \-t \ CONNECT_TIMEOUT, \ \-\-connect_timeout\fB= CONNECT_TIMEOUT
.
limit time to connect to a node
.TP
.BI \-u \ COMMAND_TIMEOUT, \ \-\-command_timeout\fB= COMMAND_TIMEOUT
.
limit time for command to run on the node
.UNINDENT
.UNINDENT
.sp
For a short explanation of these options, see \fC\-h, \-\-help\fP.
.SH EXIT STATUS
.sp
By default, an exit status of zero indicates success of the \fCclush\fP command
but gives no information about the remote commands exit status. However, when
the \fC\-S\fP option is specified, the exit status of \fCclush\fP is the largest
value of the remote commands return codes.
.sp
For failed remote commands whose exit status is non\-zero, and unless the
combination of options \fC\-qS\fP is specified, \fCclush\fP displays messages
similar to:
.INDENT 0.0
.TP
.B clush: node[40\-42]: exited with exit code 1
.UNINDENT
.SH EXAMPLES
.SS Basic
.INDENT 0.0
.TP
.B # clush \-w node[3\-5,62] uname \-r
.
Run command \fIuname \-r\fP in parallel on nodes: node3, node4, node5 and node62
.UNINDENT
.SS Display features
.INDENT 0.0
.TP
.B # clush \-w node[3\-5,62] \-b uname \-r
.
Run command \fIuname \-r\fP on nodes[3\-5,62] and display gathered output results (integrated \fCdshbak\fP\-like).
.TP
.B # clush \-w node[3\-5,62] \-bL uname \-r
.
Line mode: run command \fIuname \-r\fP on nodes[3\-5,62] and display gathered output results without default header block.
.TP
.B # ssh node32 find /etc/yum.repos.d \-type f | clush \-w node[40\-42] \-b xargs ls \-l
.
Search some files on node32 in /etc/yum.repos.d and use clush to list the matching ones on node[40\-42], and use \fC\-b\fP to display gathered results.
.TP
.B # clush \-w node[3\-5,62] \-\-diff dmidecode \-s bios\-version
.
Run this Linux command to get BIOS version on nodes[3\-5,62] and show version differences (if any).
.UNINDENT
.SS All nodes
.INDENT 0.0
.TP
.B # clush \-a uname \-r
.
Run command \fIuname \-r\fP on all cluster nodes, see \fCgroups.conf\fP(5) to setup all cluster nodes (\fIall:\fP field).
.TP
.B # clush \-a \-x node[5,7] uname \-r
.
Run command \fIuname \-r\fP on all cluster nodes except on nodes node5 and node7.
.TP
.B # clush \-a \-\-diff cat /some/file
.
Run command \fIcat /some/file\fP on all cluster nodes and show differences (if any), line by line, between common outputs.
.UNINDENT
.SS Node groups
.INDENT 0.0
.TP
.B # clush \-w @oss modprobe lustre
.
Run command \fImodprobe lustre\fP on nodes from node group named \fIoss\fP, see \fCgroups.conf\fP(5) to setup node groups (\fImap:\fP field).
.TP
.B # clush \-g oss modprobe lustre
.
Same as previous example but using \fC\-g\fP to avoid \fI@\fP group prefix.
.TP
.B # clush \-w @mds,@oss modprobe lustre
.
You may specify several node groups by separating them with commas (please see EXTENDED PATTERNS in \fCnodeset\fP(1) and also \fCgroups.conf\fP(5) for more information).
.UNINDENT
.SS Copy files
.INDENT 0.0
.TP
.B # clush \-w node[3\-5,62] \-\-copy /etc/motd
.
Copy local file \fI/etc/motd\fP to remote nodes node[3\-5,62].
.TP
.B # clush \-w node[3\-5,62] \-\-copy /etc/motd \-\-dest /tmp/motd2
.
Copy local file \fI/etc/motd\fP to remote nodes node[3\-5,62] at path \fI/tmp/motd2\fP.
.TP
.B # clush \-w node[3\-5,62] \-c /usr/share/doc/clustershell
.
Recursively copy local directory \fI/usr/share/doc/clustershell\fP to the same
path on remote nodes node[3\-5,62].
.TP
.B # clush \-w node[3\-5,62] \-\-rcopy /etc/motd \-\-dest /tmp
.
Copy \fI/etc/motd\fP from remote nodes node[3\-5,62] to local \fI/tmp\fP directory, each file having their remote hostname appended, eg. \fI/tmp/motd.node3\fP.
.UNINDENT
.SH FILES
.INDENT 0.0
.TP
.B \fI/etc/clustershell/clush.conf\fP
.sp
System\-wide \fCclush\fP configuration file.
.TP
.B \fI~/.clush.conf\fP
.sp
This is the per\-user \fCclush\fP configuration file.
.TP
.B \fI~/.clush_history\fP
.sp
File in which interactive \fCclush\fP command history is saved.
.UNINDENT
.SH SEE ALSO
.sp
\fCclubak\fP(1), \fCnodeset\fP(1), \fCreadline\fP(3), \fCclush.conf\fP(5), \fCgroups.conf\fP(5).
.SH BUG REPORTS
.INDENT 0.0
.TP
.B Use the following URL to submit a bug report or feedback:
.
\fI\%https://github.com/cea\-hpc/clustershell/issues\fP
.UNINDENT
.SH AUTHOR
Stephane Thiell, CEA DAM  <stephane.thiell@cea.fr>
.SH COPYRIGHT
CeCILL-C V1
.\" Generated by docutils manpage writer.
.\" 
.