分散サーバの運用管理ツールとしてpdshの続き

やりたいこと。
pdsh の -a オプションと -gオプションを使えるようにする。

この前のやり方だと、-aは有効になるけど、-gが有効にならない。

モジュールは

pdsh -L 

で確認できる。

で上記オプションを有効にする為にいろいろfedora13のRPM使ってみたり、debian系のパッケージだと、先のバージョンだったりしたので、alienでパッケージにして動かしてみたりしたけど、どうもいろいろ問題が出てくる。。。

failed to install module options for "misc/dshgroup"

や、

Unable to open genders file: genders file parse error

なんてエラーが出ていて嫌だったので、いろいろ調べてみました。

SRPMRPMは一度忘れて、ソースコンパイルでまず調査。(基本だろおぃ。。。)

とりあえず、pdshのconfigureのオプションの確認

./configure --help
`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --infodir=DIR          info documentation [PREFIX/info]
  --mandir=DIR           man documentation [PREFIX/man]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  --target=TARGET   configure for building compilers for TARGET [HOST]

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-maintainer-mode  enable make rules and dependencies not useful
                          (and sometimes confusing) to the casual installer
  --disable-dependency-tracking  speeds up one-time build
  --enable-dependency-tracking   do not reject slow dependency extractors
  --enable-debug          enable debugging code for development
  --enable-shared[=PKGS]
                          build shared libraries [default=yes]
  --enable-static[=PKGS]
                          build static libraries [default=yes]
  --enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  --disable-libtool-lock  avoid locking (might break parallel builds)
  --enable-ltdl-install   install libltdl
  --enable-static-modules Build static modules
  --disable-largefile     omit support for large files

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  --with-pic              try to use only PIC/non-PIC objects [default=use
                          both]
  --with-tags[=TAGS]
                          include additional configurations [automatic]
  --with-fanout=N         Specify default fanout
  --with-timeout=N        Specify default connect timeout (secs)
  --without-rsh           Do not include the standard rsh module
  --with-xcpu             Build xcpu module
  --with-ssh              Build ssh module
  --with-ssh-connect-timeout-option=OPT
                          SSH option for connect timeout
  --with-exec             Build exec module
  --without-pam           Do not build qshell/mqshell with pam support
  --with-qshell           Build qsh module and qshd daemon
  --with-machines(=PATH)  Specify a flat file list of all nodes
  --with-nodeattr(=PATH)  Build nodeattr module (PATH=program location)
  --with-genders          Build genders module for libgenders support
  --with-nodeupdown       Build nodeupdown module
  --with-mrsh             Build mrsh module
  --with-mqshell          Build mqshell module and mqshd daemon
  --with-rms              support running pdsh under RMS allocation
  --with-slurm            support running pdsh under SLURM allocation
  --with-dshgroups        Build dshgroup module for dsh group file support
  --with-netgroup         Build netgroup module for netgroups support
  --with-readline         compile with readline support
  --with-dmalloc          compile using Gray Watson's dmalloc

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  CXXCPP      C++ preprocessor
  F77         Fortran 77 compiler command
  FFLAGS      Fortran 77 compiler flags

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

フーム。。。わからない部分はGoogle先生に伺いましょう。

とりあえず

--with-qshell

はAS系のshellだから必要ない。(多分)

--with-xcpu

ん??なんだこれ?http://d.hatena.ne.jp/oraccha/20061005/1159976454
これだと思うから、必要ないよねきっと。。。

あとは、

  --with-mrsh             Build mrsh module

がよくわからないけど、たぶんこれのことだよね?http://freshmeat.net/projects/mrsh
ということで、除外する。

あとは、このへんが分からない。。。

  --with-nodeattr(=PATH)  Build nodeattr module (PATH=program location)
  --with-genders          Build genders module for libgenders support
  --with-nodeupdown       Build nodeupdown module

よく分からない。。。

で、pdshのREADMEに以下の記載を発見

Note that a number of the above configurations options may "conflict"
with each other because they perform identical operations.  For
example, genders and nodeattr both support the -g option.  If several
modules are installed that support identical options, the options will
default to one particular module.  Static compilation of modules will
fail if conflicting modules are selected.  See the man page in this
directory for details on which modules conflict.

-gオプションを使うのに、使うみたい。。。
でも、dsh形式のgroupでいいので、両方いらないと(思っている)
正直よく分かっていない。。。どなたかご教授いただけると幸いです。

なので、以下のオプションでconfigureしてみた。

./configure --with-ssh --with-machines=/etc/machines --with-dshgroups --with-rms --with-slurm --with-readline

あとは、make make install。

モジュールは/usr/local/bin/配下

/usr/local/bin/pdsh -L

でモジュールのロード関係のエラーは無い。。。

-aオプションの確認

/etc/machines

作って、そこにIPとかを記載する。

pdsh -l root -R ssh -a ls
・・・

動く×2♪♪

-gオプション

/etc/dsh/group/groupname

/etc/dsh/group/配下にグループ名を書いてそこに記載をするとグループ分けできるようになる。

pdsh -l root -R ssh -g groupname ls
・・・

おぉー動く×2♪♪

基本的にグループがあれば何でも対応できるんだろうけど、使い分けると便利かと。これで、学習コスト少なくてもいろいろ運用できそう。。。

さて、これをRPM化して、配布しやすくしなくては。。。pdsh Debian系のパッケージにはjapanese.poがあったんだけど、入れると日本語になるのかな?一緒に出来れば、他の人にも便利かなぁーとか思うんだけど、それをどうやってこちらに上手くまとめれるのか、知りたいです。。。はっきりいうとレベルが低いので。。。m(_ _)m