{"id":677,"date":"2015-07-09T13:59:19","date_gmt":"2015-07-09T12:59:19","guid":{"rendered":"http:\/\/www.1st-setup.nl\/wordpress\/?page_id=677"},"modified":"2015-07-09T14:05:06","modified_gmt":"2015-07-09T13:05:06","slug":"corosync-and-stonith-via-vcenter","status":"publish","type":"page","link":"http:\/\/www.1st-setup.nl\/wordpress\/usefull\/corosync-and-stonith-via-vcenter\/","title":{"rendered":"Corosync and STONITH via vCenter"},"content":{"rendered":"<p>I had to make a configuration of corosync, pacemaker and stonith via vCenter working on a Ubuntu 14.04 LTS server.<\/p>\n<p>Following is just a reminder for myself so I will not forget:<\/p>\n<ul>\n<li>Download &#8220;VMware-vSphere-Perl-SDK&#8221;. Version 5.5.0 works for me. <a href=\"https:\/\/my.vmware.com\/web\/vmware\/details?productId=353&amp;downloadGroup=SDKPERL550\" target=\"_blank\">VMWare-vSphere-Perl-SDK<\/a><\/li>\n<li>Extract the file: tar -zxvpf VMware-vSphere-Perl-SDK-5.5.0-1384587.x86_64.tar.gz<\/li>\n<li>Change directory to &#8220;vmware-vsphere-cli-distrib&#8221;<\/li>\n<li>Install: .\/vmware-install.pl. You might need to install extra dependencies.<\/li>\n<li>Run CPAN shell for the first time: perl -MCPAN -e shell<\/li>\n<li>While you are still in the CPAN shell execute the following command &#8220;install GAAS\/libwww-perl-5.837.tar.gz&#8221;. We need an older version of libwww for perl.<\/li>\n<li>We need to edit the file &#8220;\/usr\/lib\/vmware-vcli\/VMware\/share\/VMware\/VICommon.pm&#8221; so perl accepts unknown ssl certificates from the vcenter. (<a href=\"http:\/\/albertolarripa.com\/2012\/04\/14\/vmware-stonith-for-linux-cluster\/\" target=\"_blank\">source article<\/a>).<br \/>\nAdd the line &#8220;$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;&#8221; after the line &#8220;use Data::Dumper;&#8221;<\/li>\n<li>Now we need to create a credentials file. For this you will need a usera ccount and a password which is allowed to reset a vmware host via vcenter.<br \/>\nExecute: \/usr\/lib\/vmware-vcli\/apps\/general\/credstore_admin.pl add -s &lt;ip-vcenter&gt; -u &#8220;&lt;username&gt;&#8221; -p &#8220;&lt;password&gt;&#8221; &#8211;credstore ~\/vicredentials.xml<\/li>\n<li>Change permissions on file &#8220;vicredentials.xml&#8221;: chmod 400 ~\/vicredentials.xml<\/li>\n<li>Move to a save location mv ~\/vicredentials.xml \/etc\/corosync\/<\/li>\n<li>Do this on both nodes.<\/li>\n<li>Check connection to vCenter is working allright:<br \/>\nExecute VI_SERVER=&lt;ip-vcenter&gt;\u00a0 VI_CREDSTORE=\/etc\/corosync\/vicredentials.xml HOSTLIST=&#8221;NODE1&#8243; RESETPOWERON=0 stonith -t external\/vcenter -E -S<\/li>\n<li>Result:<br \/>\nSmartmatch is experimental at \/usr\/lib\/stonith\/plugins\/external\/vcenter line 34.<br \/>\nSmartmatch is experimental at \/usr\/lib\/stonith\/plugins\/external\/vcenter line 115.<br \/>\nSmartmatch is experimental at \/usr\/lib\/stonith\/plugins\/external\/vcenter line 152.<br \/>\nSmartmatch is experimental at \/usr\/lib\/stonith\/plugins\/external\/vcenter line 34.<br \/>\nSmartmatch is experimental at \/usr\/lib\/stonith\/plugins\/external\/vcenter line 115.<br \/>\nSmartmatch is experimental at \/usr\/lib\/stonith\/plugins\/external\/vcenter line 152.<br \/>\ninfo: external\/vcenter device OK.<\/li>\n<li>When you get the OK you can continue otherwise solve your problem.<\/li>\n<li>Add stonith resource to cluster config: crm configure<br \/>\ncrm(live)configure# primitive p_stonith_fence_NODE1 stonith:external\/vcenter \\<br \/>\nparams HOSTLIST=&#8221;NODE1&#8243; VI_CREDSTORE=&#8221;\/etc\/corosync\/vicredentials.xml&#8221; VI_SERVER=&#8221;&lt;ip-vcenter&gt;&#8221; RESETPOWERON=&#8221;0&#8243; pcmk_host_check=&#8221;static-list&#8221; pcmk_host_list=&#8221;NODE1&#8243; \\<br \/>\nop start interval=&#8221;0&#8243; timeout=&#8221;120&#8243; \\<br \/>\nop stop interval=&#8221;0&#8243; timeout=&#8221;120&#8243; \\<br \/>\nop monitor interval=&#8221;3600&#8243; timeout=&#8221;300&#8243; start-delay=&#8221;15&#8243; \\<br \/>\nmeta target-role=&#8221;Started&#8221;<br \/>\ncrm(live)configure# location l_stonith_fence_NODE1 p_stonith_fence_NODE1 -inf: NODE1<br \/>\ncrm(live)configure# primitive p_stonith_fence_NODE2 stonith:external\/vcenter \\<br \/>\nparams HOSTLIST=&#8221;NODE2&#8243; VI_CREDSTORE=&#8221;\/etc\/corosync\/vicredentials.xml&#8221; VI_SERVER=&#8221;&lt;ip-vcenter&gt;&#8221; RESETPOWERON=&#8221;0&#8243; pcmk_host_check=&#8221;static-list&#8221; pcmk_host_list=&#8221;NODE2&#8243; \\<br \/>\nop start interval=&#8221;0&#8243; timeout=&#8221;120&#8243; \\<br \/>\nop stop interval=&#8221;0&#8243; timeout=&#8221;120&#8243; \\<br \/>\nop monitor interval=&#8221;3600&#8243; timeout=&#8221;300&#8243; start-delay=&#8221;15&#8243; \\<br \/>\nmeta target-role=&#8221;Started&#8221;<br \/>\ncrm(live)configure# location l_stonith_fence_NODE2 p_stonith_fence_NODE2 -inf: NODE2<br \/>\ncrm(live)configure# commit<br \/>\ncrm(live)configure# quit<\/li>\n<li>Watch and check if the stonith resource is nicely started: crm_mon -rf1<\/li>\n<li>Result:<br \/>\nNODE1(root@NODE1):~# crm_mon -rf1<br \/>\nLast updated: Thu Jul\u00a0 9 08:59:45 2015<br \/>\nLast change: Thu Jul\u00a0 2 03:52:35 2015 via crmd on NODE1<br \/>\nStack: corosync<br \/>\nCurrent DC: NODE1(168303913) &#8211; partition with quorum<br \/>\nVersion: 1.1.10-42f2063<br \/>\n2 Nodes configured<br \/>\n9 Resources configuredOnline: [ NODE1 NODE2]Full list of resources:<\/p>\n<p>p_stonith_fence_NODE1 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (stonith:external\/vcenter):\u00a0\u00a0\u00a0\u00a0 Started NODE2<br \/>\np_stonith_fence_NODE2 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (stonith:external\/vcenter):\u00a0\u00a0\u00a0\u00a0 Started NODE1<br \/>\nResource Group: zabbix-cluster<br \/>\nfs_data\u00a0\u00a0\u00a0 (ocf::heartbeat:Filesystem):\u00a0\u00a0\u00a0 Started NODE2<br \/>\nvirtip\u00a0\u00a0\u00a0\u00a0 (ocf::heartbeat:IPaddr2):\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Started NODE2<br \/>\nmysqld\u00a0\u00a0\u00a0\u00a0 (ocf::heartbeat:mysql): Started NODE2<br \/>\nzabbix-server\u00a0\u00a0\u00a0\u00a0\u00a0 (lsb:zabbix-server):\u00a0\u00a0\u00a0 Started NODE2<br \/>\napache2\u00a0\u00a0\u00a0 (lsb:apache2):\u00a0 Started NODE2<br \/>\nMaster\/Slave Set: ms_drbd_data [drbd_data]<br \/>\nMasters: [ NODE2]<br \/>\nSlaves: [ NODE1]<\/p>\n<p>Migration summary:<br \/>\n* Node NODE1:<br \/>\n* Node NODE2:<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I had to make a configuration of corosync, pacemaker and stonith via vCenter working on a Ubuntu 14.04 LTS server. Following is just a reminder for myself so I will not forget: Download &#8220;VMware-vSphere-Perl-SDK&#8221;. Version 5.5.0 works for me. VMWare-vSphere-Perl-SDK &hellip; <a href=\"http:\/\/www.1st-setup.nl\/wordpress\/usefull\/corosync-and-stonith-via-vcenter\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":614,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"ngg_post_thumbnail":0},"_links":{"self":[{"href":"http:\/\/www.1st-setup.nl\/wordpress\/wp-json\/wp\/v2\/pages\/677"}],"collection":[{"href":"http:\/\/www.1st-setup.nl\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.1st-setup.nl\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.1st-setup.nl\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.1st-setup.nl\/wordpress\/wp-json\/wp\/v2\/comments?post=677"}],"version-history":[{"count":5,"href":"http:\/\/www.1st-setup.nl\/wordpress\/wp-json\/wp\/v2\/pages\/677\/revisions"}],"predecessor-version":[{"id":680,"href":"http:\/\/www.1st-setup.nl\/wordpress\/wp-json\/wp\/v2\/pages\/677\/revisions\/680"}],"up":[{"embeddable":true,"href":"http:\/\/www.1st-setup.nl\/wordpress\/wp-json\/wp\/v2\/pages\/614"}],"wp:attachment":[{"href":"http:\/\/www.1st-setup.nl\/wordpress\/wp-json\/wp\/v2\/media?parent=677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}