Statistics
| Branch: | Tag: | Revision:

root / README @ 2fe61f87

History | View | Annotate | Download (4.2 kB)

1
Ganeti Cluster tools (ganeti-htools)
2
====================================
3

    
4
These are some simple cluster tools for fixing common allocation
5
problems on Ganeti 2.0 clusters.
6

    
7
Note that these tools are most useful for bigger cluster sizes
8
(e.g. more than five or ten machines); at lower sizes, the
9
computations they do can also be done manually.
10

    
11
Most of the tools revolve around the concept of keeping the cluster
12
N+1 compliant: this means that in case of failure of any node, the
13
instances affected can be failed over (via ``gnt-node failover`` or
14
``gnt-instance failover``) to their secondary node, and there is
15
enough memory reserved for this operation without needing to shutdown
16
other instances or rebalance the cluster.
17

    
18
**Quick start** (see the installation section for more details):
19

    
20
- (have the ghc compiler and the prerequisite libraries installed)
21
- make
22
- ./hbal -m $cluster -C -p
23
- look at the original and final cluster layout, and if acceptable,
24
  execute the given commands
25

    
26

    
27
Available tools
28
---------------
29

    
30
Cluster rebalancer
31
~~~~~~~~~~~~~~~~~~
32

    
33
The rebalancer uses a simple algorithm to try to get the nodes of the
34
cluster as equal as possible in their resource usage. It tries to
35
repeatedly move each instance one step, so that the cluster score
36
becomes better. We stop when no further move can improve the score.
37

    
38
For algorithm details and usage, see the man page hbal(1).
39

    
40
IAllocator plugin
41
~~~~~~~~~~~~~~~~~
42

    
43
The ``hail`` iallocator plugin can be used for allocations of mirrored
44
and non-mirrored instances and for relocations of mirrored
45
instances. It needs to be installed in Ganeti's iallocator search
46
path—usually ``/usr/lib/ganeti/iallocators`` or
47
``/usr/local/lib/ganeti/iallocators``, and after that it can be used
48
via ganeti's ``--iallocator`` option (in various gnt-node/gnt-instance
49
commands). See the man page hail(1) for more details.
50

    
51
Cluster capacity estimator
52
~~~~~~~~~~~~~~~~~~~~~~~~~~
53

    
54
The ``hspace`` program will, given an input instance specification,
55
estimate how many instances of those type can be place on the cluster
56
before it will become full (as in any new allocation would fail N+1
57
checks). For more details, see the man page hspace(1).
58

    
59

    
60
Integration with Ganeti
61
-----------------------
62

    
63
The ``hbal`` and ``hspace`` programs can either get their input from
64
text files, locally from the master daemon (when run on the master
65
node of a cluster), or remote from a cluster via RAPI. The "-L"
66
argument enables local collection (with an optional path to the unix
67
socket). For online collection via RAPI, the "-m" argument should
68
specify the cluster or master node name. Only ``hbal`` and ``hspace``
69
use these arguments, ``hail`` uses the standard iallocator API and
70
thus doesn't need any special setup (just needs to be installed in the
71
right directory).
72

    
73
For generating the text files, a separate tool (``hscan``) is provided
74
to automate their gathering if RAPI is available, which is better
75
since it can extract more precise information. In case RAPI is not
76
usable for whatever reason, the following two commands should be run::
77

    
78
    gnt-node list -oname,mtotal,mnode,mfree,dtotal,dfree,ctotal,offline \
79
      --separator '|' --no-headers > nodes
80
    gnt-instance list -oname,be/memory,sda_size,be/vcpus,status,pnode,snodes \
81
      --separator '|' --no-head > instances
82

    
83
These two files should be saved under the names of *nodes* and
84
*instances*.
85

    
86
The ``hail`` program gets its data automatically from Ganeti when used
87
as described in its section.
88

    
89
Installation
90
------------
91

    
92
If installing from source, you need a working ghc compiler (6.8 at
93
least) and some extra Haskell libraries which usually need to be
94
installed manually:
95

    
96
- json (http://hackage.haskell.org/package/json)
97
- curl (http://hackage.haskell.org/package/curl)
98
- network (http://hackage.haskell.org/package/network)
99

    
100
Once these are installed, just typing *make* in the top-level
101
directory should be enough.
102

    
103
Only the ``hail`` program needs to be installed in a specific place,
104
the other tools are not location-dependent.
105

    
106
For running the (admittedly small) unittest suite (via *make check*),
107
the QuickCheck version 1 library is needed.
108

    
109
Internal (implementation) documentation is available in the ``apidoc``
110
directory.
111

    
112
.. Local Variables:
113
.. mode: rst
114
.. End: