Statistics
| Branch: | Tag: | Revision:

root / README @ 2fe61f87

History | View | Annotate | Download (4.2 kB)

1 9256e36a Iustin Pop
Ganeti Cluster tools (ganeti-htools)
2 9256e36a Iustin Pop
====================================
3 e4f08c46 Iustin Pop
4 9256e36a Iustin Pop
These are some simple cluster tools for fixing common allocation
5 9256e36a Iustin Pop
problems on Ganeti 2.0 clusters.
6 e4f08c46 Iustin Pop
7 9256e36a Iustin Pop
Note that these tools are most useful for bigger cluster sizes
8 9256e36a Iustin Pop
(e.g. more than five or ten machines); at lower sizes, the
9 9256e36a Iustin Pop
computations they do can also be done manually.
10 9256e36a Iustin Pop
11 5ac3214f Iustin Pop
Most of the tools revolve around the concept of keeping the cluster
12 5ac3214f Iustin Pop
N+1 compliant: this means that in case of failure of any node, the
13 5ac3214f Iustin Pop
instances affected can be failed over (via ``gnt-node failover`` or
14 5ac3214f Iustin Pop
``gnt-instance failover``) to their secondary node, and there is
15 5ac3214f Iustin Pop
enough memory reserved for this operation without needing to shutdown
16 5ac3214f Iustin Pop
other instances or rebalance the cluster.
17 5ac3214f Iustin Pop
18 61d67afe Iustin Pop
**Quick start** (see the installation section for more details):
19 61d67afe Iustin Pop
20 61d67afe Iustin Pop
- (have the ghc compiler and the prerequisite libraries installed)
21 61d67afe Iustin Pop
- make
22 61d67afe Iustin Pop
- ./hbal -m $cluster -C -p
23 61d67afe Iustin Pop
- look at the original and final cluster layout, and if acceptable,
24 61d67afe Iustin Pop
  execute the given commands
25 61d67afe Iustin Pop
26 61d67afe Iustin Pop
27 9256e36a Iustin Pop
Available tools
28 9256e36a Iustin Pop
---------------
29 e4f08c46 Iustin Pop
30 80276b9e Iustin Pop
Cluster rebalancer
31 9256e36a Iustin Pop
~~~~~~~~~~~~~~~~~~
32 80276b9e Iustin Pop
33 9256e36a Iustin Pop
The rebalancer uses a simple algorithm to try to get the nodes of the
34 9256e36a Iustin Pop
cluster as equal as possible in their resource usage. It tries to
35 9256e36a Iustin Pop
repeatedly move each instance one step, so that the cluster score
36 80276b9e Iustin Pop
becomes better. We stop when no further move can improve the score.
37 80276b9e Iustin Pop
38 80276b9e Iustin Pop
For algorithm details and usage, see the man page hbal(1).
39 80276b9e Iustin Pop
40 80276b9e Iustin Pop
IAllocator plugin
41 9256e36a Iustin Pop
~~~~~~~~~~~~~~~~~
42 e4f08c46 Iustin Pop
43 80276b9e Iustin Pop
The ``hail`` iallocator plugin can be used for allocations of mirrored
44 80276b9e Iustin Pop
and non-mirrored instances and for relocations of mirrored
45 80276b9e Iustin Pop
instances. It needs to be installed in Ganeti's iallocator search
46 80276b9e Iustin Pop
path—usually ``/usr/lib/ganeti/iallocators`` or
47 61d67afe Iustin Pop
``/usr/local/lib/ganeti/iallocators``, and after that it can be used
48 61d67afe Iustin Pop
via ganeti's ``--iallocator`` option (in various gnt-node/gnt-instance
49 61d67afe Iustin Pop
commands). See the man page hail(1) for more details.
50 e4f08c46 Iustin Pop
51 5ac3214f Iustin Pop
Cluster capacity estimator
52 5ac3214f Iustin Pop
~~~~~~~~~~~~~~~~~~~~~~~~~~
53 5ac3214f Iustin Pop
54 5ac3214f Iustin Pop
The ``hspace`` program will, given an input instance specification,
55 5ac3214f Iustin Pop
estimate how many instances of those type can be place on the cluster
56 5ac3214f Iustin Pop
before it will become full (as in any new allocation would fail N+1
57 5ac3214f Iustin Pop
checks). For more details, see the man page hspace(1).
58 5ac3214f Iustin Pop
59 5ac3214f Iustin Pop
60 e4f08c46 Iustin Pop
Integration with Ganeti
61 e4f08c46 Iustin Pop
-----------------------
62 e4f08c46 Iustin Pop
63 266aea94 Iustin Pop
The ``hbal`` and ``hspace`` programs can either get their input from
64 b9017fa7 Iustin Pop
text files, locally from the master daemon (when run on the master
65 b9017fa7 Iustin Pop
node of a cluster), or remote from a cluster via RAPI. The "-L"
66 b9017fa7 Iustin Pop
argument enables local collection (with an optional path to the unix
67 b9017fa7 Iustin Pop
socket). For online collection via RAPI, the "-m" argument should
68 b9017fa7 Iustin Pop
specify the cluster or master node name. Only ``hbal`` and ``hspace``
69 b9017fa7 Iustin Pop
use these arguments, ``hail`` uses the standard iallocator API and
70 b9017fa7 Iustin Pop
thus doesn't need any special setup (just needs to be installed in the
71 b9017fa7 Iustin Pop
right directory).
72 6ef35e3c Iustin Pop
73 61d67afe Iustin Pop
For generating the text files, a separate tool (``hscan``) is provided
74 61d67afe Iustin Pop
to automate their gathering if RAPI is available, which is better
75 61d67afe Iustin Pop
since it can extract more precise information. In case RAPI is not
76 61d67afe Iustin Pop
usable for whatever reason, the following two commands should be run::
77 e4f08c46 Iustin Pop
78 b9017fa7 Iustin Pop
    gnt-node list -oname,mtotal,mnode,mfree,dtotal,dfree,ctotal,offline \
79 e4f08c46 Iustin Pop
      --separator '|' --no-headers > nodes
80 d752eb39 Iustin Pop
    gnt-instance list -oname,be/memory,sda_size,be/vcpus,status,pnode,snodes \
81 e4f08c46 Iustin Pop
      --separator '|' --no-head > instances
82 e4f08c46 Iustin Pop
83 80276b9e Iustin Pop
These two files should be saved under the names of *nodes* and
84 80276b9e Iustin Pop
*instances*.
85 6ef35e3c Iustin Pop
86 61d67afe Iustin Pop
The ``hail`` program gets its data automatically from Ganeti when used
87 61d67afe Iustin Pop
as described in its section.
88 61d67afe Iustin Pop
89 6ef35e3c Iustin Pop
Installation
90 6ef35e3c Iustin Pop
------------
91 6ef35e3c Iustin Pop
92 6ef35e3c Iustin Pop
If installing from source, you need a working ghc compiler (6.8 at
93 6ef35e3c Iustin Pop
least) and some extra Haskell libraries which usually need to be
94 6ef35e3c Iustin Pop
installed manually:
95 e4f08c46 Iustin Pop
96 2fe61f87 Iustin Pop
- json (http://hackage.haskell.org/package/json)
97 2fe61f87 Iustin Pop
- curl (http://hackage.haskell.org/package/curl)
98 2fe61f87 Iustin Pop
- network (http://hackage.haskell.org/package/network)
99 d53264c0 Iustin Pop
100 61d67afe Iustin Pop
Once these are installed, just typing *make* in the top-level
101 80276b9e Iustin Pop
directory should be enough.
102 e4f08c46 Iustin Pop
103 61d67afe Iustin Pop
Only the ``hail`` program needs to be installed in a specific place,
104 61d67afe Iustin Pop
the other tools are not location-dependent.
105 61d67afe Iustin Pop
106 61d67afe Iustin Pop
For running the (admittedly small) unittest suite (via *make check*),
107 61d67afe Iustin Pop
the QuickCheck version 1 library is needed.
108 61d67afe Iustin Pop
109 6ef35e3c Iustin Pop
Internal (implementation) documentation is available in the ``apidoc``
110 6ef35e3c Iustin Pop
directory.
111 9256e36a Iustin Pop
112 9256e36a Iustin Pop
.. Local Variables:
113 9256e36a Iustin Pop
.. mode: rst
114 9256e36a Iustin Pop
.. End: