{"id":1267,"date":"2016-02-29T16:52:20","date_gmt":"2016-02-29T15:52:20","guid":{"rendered":"http:\/\/clark.tipistrani.it\/?p=1267"},"modified":"2016-02-29T17:05:37","modified_gmt":"2016-02-29T16:05:37","slug":"heartbeat-configurazione-per-solo-ip","status":"publish","type":"post","link":"http:\/\/clark.tipistrani.it\/?p=1267","title":{"rendered":"Heartbeat Configurazione per solo IP"},"content":{"rendered":"<p><a href=\"http:\/\/linux-ha.org\/wiki\/Heartbeat\">Heartbeat<\/a> \u00e8 un programma del progetto Linux-HA serve a monitorare il funzionamento dei nodi\u00a0 di un cluster e &#8220;decidere&#8221; cosa fare nel caso del malfunzionamento di uno dei nodi.<br \/>\nDa notarsi che \u00e8 o meglio &#8220;sarebbe&#8221; deprecato in favore di corosynk+pacemaker, ma vista sia la sua facilit\u00e0 di configurazione che la sua stabilit\u00e0 continuer\u00f2 ad usarlo sino a quando sar\u00e0 disponibile.<\/p>\n<p>Al solito su ambo le macchine installiamo il pacchetto heartbeat che si tira dietro tutte le dipendenze necessarie, e quindi nella directory \/etc\/ha.d copiamo da \/usr\/share\/doc\/heartbeat\u00a0 i files authkeys, ha.cf, haresources o se preferiamo scriviamoli da 0 che tanto e&#8217; lo stesso.<br \/>\nI files sono al solito pieni e ben commentati e sono in sostanza:<\/p>\n<p>authkeys il modo di autenticazione dei nodi e puo&#8217; contenere due sole\u00a0 righe come queste:<br \/>\nauth 2<br \/>\n2 sha1 unabellapasswordlungaecomplicata!<br \/>\ndeve essere ovviamente uguale su entrambe le macchine e deve avere obbligatoriamente permessi 600.<\/p>\n<p>Il file ha.cf\u00a0 \u00e8 l&#8217;unico che vista la scelta che ho operato per heartbeat deve essere differente sulle due macchine, l&#8217;unica differenza \u00e8 l&#8217;incrocio degli up per ucast ma e&#8217; fondamentale.<\/p>\n<p>Percui avremo su sangiorgio un ha.cf fatto in questo modo:<\/p>\n<p>#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 File to write debug messages to<br \/>\ndebugfile \/var\/log\/ha-debug<br \/>\n#<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 File to write other messages to<br \/>\n#<br \/>\nlogfile \/var\/log\/ha-log<br \/>\n#<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Facility to use for syslog()\/logger<br \/>\n#<br \/>\nlogfacility\u00a0\u00a0\u00a0\u00a0 local0<br \/>\n##\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 keepalive: how long between heartbeats?<br \/>\n#<br \/>\nkeepalive 2<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deadtime: how long-to-declare-host-dead?<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 If you set this too low you will get the problematic<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 split-brain (or cluster partition) problem.<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 See the FAQ for how to use warntime to tune deadtime.<br \/>\n#<br \/>\ndeadtime 30<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 warntime: how long before issuing &#8220;late heartbeat&#8221; warning?<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 See the FAQ for how to use warntime to tune deadtime.<br \/>\n#<br \/>\nwarntime 10<br \/>\n#<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Very first dead time (initdead)<br \/>\n#<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 On some machines\/OSes, etc. the network takes a while to come up<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 and start working right after you&#8217;ve been rebooted.\u00a0 As a result<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 we have a separate dead time for when things first come up.<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 It should be at least twice the normal dead time.<br \/>\n#<br \/>\ninitdead 60<br \/>\n#udpport 694<br \/>\n##<br \/>\n#<br \/>\nucast eth1 192.168.2.240<br \/>\n###<strong>N.B. SU SANGIORGIO VANNO INSERITI GLI IP DI PERSEO E SU PERSEO QUELLI DI SANGIORGIO<\/strong><br \/>\n<strong> #<\/strong><br \/>\nauto_failback on<br \/>\n#<br \/>\nnode\u00a0\u00a0\u00a0 sangiorgio perseo<br \/>\n#<br \/>\ndebug 1<br \/>\nDa ultimo il file haresourc che in sostanza qui si occupa di generare l&#8217;IP virtuale di cui si necessita<\/p>\n<p>perseo IPaddr::192.168.2.241\/24\/eth1 \\<br \/>\nMailTo::clark@oceano.lan::Transizione_proxy<br \/>\ndare \/etc\/init.d\/heartbeat restart e a fine operazione con un ifconfig vedrete :<\/p>\n<p>eth1:0\u00a0\u00a0\u00a0 Link encap:Ethernet\u00a0 HWaddr 00:15:17:4b:9b:b2<br \/>\ninet addr:192.168.2.241\u00a0 Bcast:192.168.2.255\u00a0 Mask:255.255.255.0<br \/>\nUP BROADCAST RUNNING MULTICAST\u00a0 MTU:1500\u00a0 Metric:1<br \/>\nInterrupt:16 Memory:efcc0000-efce0000<\/p>\n<p>&nbsp;<\/p>\n<div id=\"link64_adl_tabid\" style=\"display: none;\" data-url=\"http:\/\/clark.tipistrani.it\/wp-admin\/post.php?post=1267&amp;action=edit\">635<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Heartbeat \u00e8 un programma del progetto Linux-HA serve a monitorare il funzionamento dei nodi\u00a0 di un cluster e &#8220;decidere&#8221; cosa fare nel caso del malfunzionamento di uno dei nodi. Da notarsi che \u00e8 o meglio &#8220;sarebbe&#8221; deprecato in favore di corosynk+pacemaker, ma vista sia la sua facilit\u00e0 di configurazione che la sua stabilit\u00e0 continuer\u00f2 ad [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,8,14,7],"tags":[],"class_list":["post-1267","post","type-post","status-publish","format-standard","hentry","category-cluster","category-linux","category-networking","category-sistemi-operativi"],"_links":{"self":[{"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/posts\/1267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1267"}],"version-history":[{"count":3,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/posts\/1267\/revisions"}],"predecessor-version":[{"id":1277,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/posts\/1267\/revisions\/1277"}],"wp:attachment":[{"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1267"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}