Statistics
| Branch: | Tag: | Revision:

root / README @ 61d67afe

History | View | Annotate | Download (4.4 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
Cluster N+1 solver
41
~~~~~~~~~~~~~~~~~~
42

    
43
This program runs a very simple brute force algorithm over the instance
44
placement space in order to determine the shortest number of replace-disks
45
needed to fix the cluster. Note this means we won't get a balanced cluster,
46
just one that passes N+1 checks.
47

    
48
For algorithm details and usage, see the man page hn1(1).
49

    
50
.. note:: This program is deprecated, hbal should be used instead.
51

    
52
IAllocator plugin
53
~~~~~~~~~~~~~~~~~
54

    
55
The ``hail`` iallocator plugin can be used for allocations of mirrored
56
and non-mirrored instances and for relocations of mirrored
57
instances. It needs to be installed in Ganeti's iallocator search
58
path—usually ``/usr/lib/ganeti/iallocators`` or
59
``/usr/local/lib/ganeti/iallocators``, and after that it can be used
60
via ganeti's ``--iallocator`` option (in various gnt-node/gnt-instance
61
commands). See the man page hail(1) for more details.
62

    
63
Cluster capacity estimator
64
~~~~~~~~~~~~~~~~~~~~~~~~~~
65

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

    
71

    
72
Integration with Ganeti
73
-----------------------
74

    
75
The ``hbal``, ``hspace`` and ``hn1`` programs can either get their
76
input from text files, or online from a cluster via RAPI. For online
77
collection via RAPI, the "-m" argument to both hn1 and hbal should
78
specify the cluster or master node name. ``hail`` uses the standard
79
iallocator API and thus doesn't need any special setup (just needs to
80
be installed in the right directory).
81

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

    
87
    gnt-node list -oname,mtotal,mnode,mfree,dtotal,dfree,offline \
88
      --separator '|' --no-headers > nodes
89
    gnt-instance list -oname,be/memory,sda_size,status,pnode,snodes \
90
      --separator '|' --no-head > instances
91

    
92
These two files should be saved under the names of *nodes* and
93
*instances*.
94

    
95
The ``hail`` program gets its data automatically from Ganeti when used
96
as described in its section.
97

    
98
Installation
99
------------
100

    
101
If installing from source, you need a working ghc compiler (6.8 at
102
least) and some extra Haskell libraries which usually need to be
103
installed manually:
104

    
105
- json (http://hackage.haskell.org/cgi-bin/hackage-scripts/package/json)
106
- curl (http://hackage.haskell.org/cgi-bin/hackage-scripts/package/curl)
107

    
108
Once these are installed, just typing *make* in the top-level
109
directory should be enough.
110

    
111
Only the ``hail`` program needs to be installed in a specific place,
112
the other tools are not location-dependent.
113

    
114
For running the (admittedly small) unittest suite (via *make check*),
115
the QuickCheck version 1 library is needed.
116

    
117
Internal (implementation) documentation is available in the ``apidoc``
118
directory.
119

    
120
.. Local Variables:
121
.. mode: rst
122
.. End: