KANIF(1)
π KANIF β kanif(1) π
okay bestie, sit DOWN, because we're about to talk about kanif β a TakTuk wrapper for cluster management. yes, that kanif. the one your sysadmin bestie has been gatekeeping. let's get into it β¨
πΈ NAME πΈ
kanif β a TakTuk wrapper for cluster management. that's it, that's the whole name section, slay.
β¨ SYNOPSIS β¨
kash|kaget|kaput [-aFHhimqsV] [-f conf-file] [-l login] [-M
machines-list] [-n|-w nodes] [-o options] [-p level] [-r command] [-T
options] [-t timeout] [-u timeout] [-x nodes] [machines specifications]
[command body]
no cap, that's the whole vibe right there π
π¦ DESCRIPTION π¦
so kanif is a tool for cluster management and administration. it's giving "I took the best parts of c3, pdsh and dsh" β it combines the main features of those well-known cluster management tools and it mimics their syntax, because your fave could never make you relearn everything. for the effective cluster management it relies on TakTuk, a tool for large scale remote execution deployment. iconic behavior honestly π«Ά
and like, here's the tea: for simple parallel tasks that have to be executed on regular machines such as clusters, the TakTuk syntax is too complicated. so the goal of kanif is to provide an easier and familiar syntax to cluster administrators while still taking advantage of TakTuk characteristics and features β that's adaptivity, scalability, portability, autopropagation and information redirection. periodt. π
to work, kanif needs to find the "taktuk" command (version 3.3 and above) in the user path. the other requirements are the same as TakTuk: it requires, on all the nodes of the cluster, a working Perl interpreter (version 5.8 and above) and a command to log without password (such as "ssh" with proper rsa keys installed). no shortcuts bestie, get those keys set up π
kanif provides three simple commands for clusters administration and management:
kash: runs the same command on multiple nodeskaput: broadcasts the copy of files or directories to several nodeskaget: gathers several remote files or directories
kanif combines the advantages of several cluster management tools. its main features can be summarized as follows:
- C3-style configuration file for static clusters setups ποΈ
- pdsh-like options such as nodes ranges and timeouts β±οΈ
- dshbak-like gathering, sorting and merging of output π¦
as with "pdsh", kanif deployment can be monitored and controlled by signals. when kanif receives a SIGINT (usually sent by typing Ctrl-C), it displays a brief summary of its deployment state and commands execution progress. after this first SIGINT, if kanif receives a second signal within one second:
- it terminates its execution (cancelling any ongoing task) if this is a
SIGINT - it cancels any ongoing connections and start executions on the already deployed nodes if this is a
SIGTSTP(usually sent by typingCtrl-Z)
π bestie the double-signal thing is real, so don't just mash Ctrl-C and expect nothing to happen. second signal within a second = big mood, big consequences.
at the end of executions, kanif also reports a quick summary of failures: connections and commands execution. so you'll know exactly what ate and what flopped π
π OPTIONS π
to help administrators in their task, kanif options syntax is as close as possible to C3/pdsh/dsh well known tools. so if you already know those, you're lowkey already fluent π
-a,--allβ Deploys on all nodes of all configured clusters. the whole squad, no one left out β¨-fconf-file,--fileconf-file β Uses"conf-file"as configuration file instead of default. Several possibilities are examined for default configuration file, in order:"$HOME/.kanif.conf","/etc/kanif.conf","/etc/c3.conf". it's giving "I'll find my own way home" π-F,--flat-deploymentβ Deploys all remote execution from the root node (which executeskanif). Useful when remote nodes cannot log on each other. flat hierarchy, very demure, very mindful π¦-H,--headβ Deploys only on clusters"head"node (using local interface) for all specified clusters. just the main character of each cluster π-h,--helpβ Prints a short help text and exits. the "help me bestie" button π«Ά-i,--interactiveβ Asks confirmation before any action. An action is either the execution of one command on all the hosts (default) or the execution of one command on one host (sequential mode, see-sswitch). consent before action, as it should be π-llogin,--loginlogin β Uses the given"login"to connect to remote hosts. who are you logging in as, bestie? π-Mmachines-list,--listmachines-list β Adds to the remote hosts the names contained in the file named"machines-list".kanifaccepts as many-Moptions as you wish. stack 'em like friendship bracelets π-m,--monitoringβ Makeskanifmore verbose about whats happening during deployment commands execution. it's giving narrator voiceover π£οΈ-nnodes,--nodesnodes β Adds the given"nodes"to the deployment. See section"HOSTNAMES SPECIFICATION"for more information about"nodes"syntax.kanifaccepts as many-noptions as you wish. yes bestie, as many as you want β¨-ooptions,--remote-optsoptions β Sets additional options to be passed to the remote shell command. little extra sprinkle on top πΈ-plevel,--postprocesslevel β Sets the level of output formatting made inkanif. The general idea is: the higher the level, the more sorted, merged and human readable the output. Default is 4. different levels are:- 0 β No processing at all: raw commands output is printed to stdout and raw commands error is printed to stderr. Connections and executions errors are not reported. feral mode, no filter π
- 1 β Same as
0except that the name of the host which produced the output is prepended before each line. now with name tags π·οΈ - 2 β Same as
1except that the output is sorted by command (one complete command execution is outputed entirely before another one). Connections and executions errors are summarized at the end to stderr. organized queen π - 3 β Same as
2except that the hostname is printed once, formatted as a title, before its output. title card energy π¬ - 4 β Same as
3except that identical output produced by multiple nodes is printed once with all the hosts summarized in the title. the "you're all saying the same thing" merger π
-q,--dry-runβ When this option is given,kanifdoes nothing and prints its configuration, the remote nodes it would have tried to contact and the TakTuk command that would have been executed. manifesting without doing, honestly iconic π¦-rcommand,--remote-cmdcommand β Sets the name of the"command"used to contact remote hosts (default is"ssh -o StrictHostKeyChecking=no -o BatchMode=yes"). the way that default is SO specific, I'm obsessed π-s,--sequentialβ Each command is executed sequentially on remote hosts (using the order given on the command line as hosts order). one at a time, patient bestie π§-Toptions,--taktuk-optionsoptions β Allows power users to pass some options to the TakTuk command executed.
β οΈ caution: always include-swhich is the default unless you really know what you are doing. fr fr, do not skip the-sunless you're built different. π₯
-ttimeout,--timeouttimeout β Gives a timeout value for connection attempts. At expiration, connection is canceled and deployment on the remote host is aborted. ghosted by the host, respectfully π»-utimeout,--upper-limittimeout β Gives a timeout value for commands execution. At expiration the command is killed with aTERMsignal. time's up bestie π°οΈ-V,--versionβ Printskanifversion and exits. the "who even am I" check β¨-w,-wcollβ Synonym to-n. just a little nickname, iykyk π-xnodes,--excludenodes β Excludes some nodes from the ones given using-nor-w. Applies to all hosts sets that do not already contain an exclusion part. Does not apply to host given with-Moption. the "not you bestie" list π
π ENVIRONMENT π
usually all kanif options can be set by environment variables. the rationale is that boolean options have 0/1 value and environment settings are overridden by command line switches. so CLI always wins, as it should π
the name of an environment variable used by kanif is made of the long option name capitalized with dashes replaced by underscores and "KANIF_" prepended (for instance "KANIF_ALL", "KANIF_HEAD", and so on). this rule admits the following exceptions (that have been chosen to mimic C3/dsh behavior):
KANIF_CONFβ Instead ofKANIF_FILEfor configuration file. plot twist πKANIF_USERβ Instead ofKANIF_LOGINfor login name. another plot twist β¨
notice also that the variable KANIF_WCOLL has no meaning to kanif. it's giving "I'm here but I do nothing" π
π¦ HOSTNAMES SPECIFICATION π¦
hostnames given to kanif might be simple machine name or complex hosts lists specifications. in its general form, an hostname is made of an host set and an optional exclusion set separated by a slash. each of those sets is a comma separated list of host templates. each of these templates is made of constant parts (characters outside brackets) and optional range parts (characters inside brackets). each range part is a comma separated list of intervals or single values. each interval is made of two single values separated by a dash. this is true for all hostnames given to kanif (both with -M or -n/-w options). okay so basically it's a whole grammar and honestly? she ate πΈ
in other words, the following expressions are valid host specifications:
node1
node[19]
node[1-3]
node[1-3],otherhost/node2
node[1-3,5]part[a-b]/node[3-5]parta,node1partb
they respectively expand to:
node1
node19
node1 node2 node3
node1 node3 otherhost
node1parta node2parta node2partb node3partb node5partb
notice that these list of values are not regular expressions ("node[19]" is "node19" and not "node1, node2, ...., node9"). this trips people up EVERY time, bestie, so read it twice π
intervals are implemented using the perl magical auto increment feature, thus you can use alphanumeric values as interval bounds (see perl documentation, operator ++ for limitations of this auto increment). magical indeed β¨
π MACHINES SPECIFICATIONS π
with kanif, you can specify the remote nodes on which you want to do some stuff using the command line switches (-n and -x, pdsh/dsh style), using machines specifications (C3 style) or both. thus, this part of the documentation might be ignored if you do not want to use C3 style nodes management. no pressure, bestie, skip it if it's not your era π«Ά
to use machines specification you must describe your cluster in a configuration file (see -f option and kanif.conf(5)). machines specifications are nodes intervals taken from clusters defined in this file. so like, the config file is the blueprint π
a machine specification is an optional cluster name followed by a colon and an optional range. the default cluster is taken if no cluster name is given. all the nodes of the cluster are taken if no range is given. notice that if none of -n/-w, -M or machine specification is given on the command line, the remote hosts are assumed to be all the nodes of the default cluster. default behavior, default cluster, default everything β very "going with the flow" of her π
β¨ COMMAND BODY β¨
okay so depending on the name you used to call it β kash, kaput or kaget β kanif is doing a completely different job. it's giving three separate main character eras, and here's what each one does:
kash
kash [options] [command line]
runs the last part of the command line on all the remote hosts. if that last part is empty, it drops into interactive mode where kanif waits for a command (one per line) on stdin. in interactive mode, just send an EOF character (Ctrl-D) to exit kash. π
kaput
kaput [options] src1 [src2 ...] dest
copies one or more files or directories to all the remote hosts. the last argument is the path to the destination file or directory on the remote machine. the other arguments are local files or directories to copy. its behavior and limitations are similar to the command cp(1). π«Ά
kaget
kaget [options] src1 [src2 ...] dest
downloads one or more files or directories from all the remote hosts. the last argument is the path to the destination directory on the local machine. the other arguments are paths to files or directories on remote hosts. each source must be present on all the remote hosts. sources are copied to the destination directory having the originating host appended to their name. πΈ
notice that when usingkagetorkaputeach file or directory is completely copied before proceeding to the next one. no cutting corners, bestie. β¨
π EXAMPLES π
when a configuration file exists on the system or is given on the command line (see option -f), remote machines can be specified via clusters names. for instance, the simple execution of the command "ls -l" on all the nodes of the cluster named "megacluster" can be written:
kash megacluster: ls -l
intervals can also be given. the following command copies the local .cshrc file to the login directory of a subset of the default cluster and another subset of the "megacluster":
kaput :3-6 megacluster:2-5 $HOME/.cshrc .
finally, one can take advantage of the default behavior to gather a file named "results.txt" placed in the /tmp directory on all the nodes of the default cluster to the local directory "results":
kaget /tmp/results.txt results
when a user does not want to write a configuration file or just wants to deploy on some other nodes, it is possible to give remote hosts on the command line:
kash -n localhost,supernode uptime
this last command will just execute "uptime" on "localhost" and "supernode". giving intervals and exclusion lists is also possible on the command line. the following command copies the file /tmp/temporary.txt to the remote /tmp directories of node1 and node5:
kaput -n node[1-6] -x node[2-4],node6 /tmp/temporary.txt /tmp
finally, without entering into the details of each option, the final command illustrates the -u option. it executes during 5 seconds a "ping" to "gateway" from 5 nodes:
kash -n node[1-2],node[4-6] -u 5 ping gateway
π BUGS π
missing features:
- indirect clusters not supported (see C3 documentation about such clusters)
- when there are no machine to deploy and kanif runs in interactive mode, kanif still waits for a command (or eof) before exiting
performance issues:
- the algorithm used by
kaputis not very efficient for transferring large files. although the precise limit depends on the machine, it should not scale well above a few hundreds of megabytes.
π SEE ALSO π
π AUTHOR π
the author of kanif and current maintainer of the package is Guillaume Huard. acknowledgements to Lucas Nussbaum for the idea of the name "kanif".
π COPYRIGHT π
kanif is provided under the terms of the GNU General Public License version 2 or later.
this page came from perl v5.34.0 and is dated 2022-07-28. mwah, go slay some remote hosts π β¨
π¦ where this page comes from
- debian bookworm: kanif 1.2.2-4 Β· GPL-2.0-or-later
- debian trixie: kanif 1.2.2-4 Β· GPL-2.0-or-later
- ubuntu noble: kanif 1.2.2-4 Β· GPL-2.0-or-later
- ubuntu questing: kanif 1.2.2-4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms