{"id":62,"date":"2014-08-06T14:31:00","date_gmt":"2014-08-06T12:31:00","guid":{"rendered":"https:\/\/www.cubeos.org\/blog\/2014\/08\/running-a-mysql-galera-cluster-on-microsoft-azure-2\/"},"modified":"2014-08-06T14:31:00","modified_gmt":"2014-08-06T12:31:00","slug":"running-a-mysql-galera-cluster-on-microsoft-azure-2","status":"publish","type":"post","link":"https:\/\/www.cubeos.org\/blog\/2014\/08\/running-a-mysql-galera-cluster-on-microsoft-azure-2\/","title":{"rendered":"Running a MySQL Galera cluster on Microsoft Azure"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>A few weeks ago, I was looking into running a MySQL Galera Cluster for a customer with a large Linux IAAS deployment on Azure.<\/p>\n<p>Why that? There&rsquo;s ClearDB, a Microsoft Partner that offers MySQL on Azure as SaaS (Software as a service), so you can go to <a title=\"https:\/\/www.cleardb.com\/store\/azure\" href=\"https:\/\/www.cleardb.com\/store\/azure\" target=\"_blank\" rel=\"nofollow\">https:\/\/www.cleardb.com\/store\/azure<\/a> and pick your size. Or, if you want to run it on your own, you can pick a Ubuntu Linux Gallery image and type &ldquo;apt-get install mysql-server&rdquo; and that&rsquo;s it, right? Well, not so fast&hellip;<\/p>\n<p>ClearDB is a great offering for most customers that need a MySQL backend, but in this case, even the largest ClearDB offer was not sufficient.<\/p>\n<p>So the customer followed the second path down, he created an IAAS VM (actually several VMs which each run an independent database server for different purposes) and configured his services to use these databases via the internal IP addresses of these servers. But there&rsquo;s one problem with this approach: Occasionally, Azure needs to deploy patches to the host systems running these VMs. And occasionally, the Linux VMs also need patches that require a restart of the database server or a reboot of the machines. Whenever this happened, the customer site would be down for a few minutes.&nbsp;<\/p>\n<p>To avoid this occasional downtime, I teamed up with Oli Sennhauser, CTO at <a href=\"http:\/\/fromdual.com\/\" target=\"_blank\" rel=\"nofollow\">FromDual<\/a> and my colleague Christian Geuer-Pollmann to set up a MySQL Galera Cluster on Azure.<\/p>\n<p>Such a cluster consists of three MySQL VMs. Database connections can be handled by all three machines, so the DB (read) load is distributed as well. As long as two machines are up, the database service is available. Galera achieves this by implementing the replication of database write transactions. More information can be found on <a title=\"http:\/\/galeracluster.com\/\" href=\"http:\/\/galeracluster.com\/\" target=\"_blank\" rel=\"nofollow\">http:\/\/galeracluster.com\/<\/a> and on <a title=\"https:\/\/launchpad.net\/galera\/\" href=\"https:\/\/launchpad.net\/galera\/\" target=\"_blank\" rel=\"nofollow\">https:\/\/launchpad.net\/galera\/<\/a>&nbsp;<\/p>\n<p>So, here&rsquo;s the tl;dr version of what we did:<\/p>\n<p>&#8211; Set up three Ubuntu 14.04 LTS IAAS VMs with fixed internal IP addresses <br \/>&#8211; Set up an Azure internal load balancer so that database clients have a single IP they connect to <br \/>&#8211; Installed mysql-server-wsrep-5.6.16-25.5 and galera-25.3.5 plus a few dependencies <br \/>&#8211; Configured galera on these three machines <br \/>&#8211; Added a bit of iptables magic, courtesy of FromDual, to the VMs to block access to the MySQL port while a database server is recovering. The internal load balancer then moves the clients to the other servers of the cluster in case one is down. <br \/>&#8211; And in order to keep this all neat and clean, we used Powershell to automate the Azure setup part.<\/p>\n<p>0. Prerequisites<\/p>\n<p>The fixed internal IP and the internal load balancer make use of features that were only added to the Azure virtual network quite recently. Chances are that if you configured an Azure virtual network a while ago, these function may not be available. So just configure a new virtual network for this.<\/p>\n<p>Currently, some of these features can only be configured via Powershell. So you need a (windows) machine to run powershell on, if you don&rsquo;t have one handy, just create a small (A1) Windows server machine in the Azure portal and use RDP to connect to it. Then install the Azure Powershell, see <a href=\"http:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/install-configure-powershell\/\" target=\"_blank\" rel=\"nofollow\">here<\/a>.<\/p>\n<p>And you should do a bit of planning ahead for your new virtual network. It should have sufficient IP addresses to host all your database clients, the three servers of the cluster and the additional IP input address of the load balancer. In this case, we used the 10.0.0.0\/8 default setting but placed all the database servers in the 10.11.0.0\/16 subnet.<\/p>\n<p>1. Creating the machines and the internal load balancer<\/p>\n<p>As said before, we scripted all this in powershell. And in order to keep the configuration apart from the actual commands, we set a bunch of variables in the header of our script that contain the actual settings. So when you see $servicename in the examples below, that is something we&rsquo;re setting in this header.<\/p>\n<p>The Load balancer is created by this powershell command:<\/p>\n<p>Add-AzureInternalLoadBalancer -ServiceName $servicename -InternalLoadBalancerName $loadBalancerName &ndash;SubnetName $subnetname &ndash;StaticVNetIPAddress $loadBalancerIP<\/p>\n<p>When running this command, we found that the service needs to be deployed before running this command. So in order to ensure this, we just created a small toy IAAS VM, then created the loadbalancer and the database VMs and then removed the toy VM again.<\/p>\n<p>To configure a VM to use the internal load balancer, we add an endpoint to the VM configuration:<\/p>\n<p>Add-AzureEndpoint ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -Name mysql ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -LocalPort 3306 ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -PublicPort 3306 ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -InternalLoadBalancerName $loadBalancerName ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -Protocol tcp ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -ProbePort 3306 ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -ProbeProtocol &#8220;tcp&#8221; ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -ProbeIntervalInSeconds 5 ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -ProbeTimeoutInSeconds 11 ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -LBSetName mysql<\/p>\n<p>Since we have multiple Linux VMs in the same cloud service, we need to remove the standard SSH endpoint and create an individual SSH endpoint for each machine:<\/p>\n<p>Remove-AzureEndpoint ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -Name SSH ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | ` <br \/> Add-AzureEndpoint ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -Name SSH ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -LocalPort 22 ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -PublicPort $externalSshPortNumber ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -Protocol tcp ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |`<\/p>\n<p>And we want to use a static internal IP for each machine since we need to specifiy these IP adresses in the galera configuration:<\/p>\n<p>Set-AzureSubnet -SubnetNames $subnetname ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | ` <br \/> Set-AzureStaticVNetIP -IPAddress $machineIpAddress ` <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | `<\/p>\n<p>We wrapped all this into a configuration function called GetCustomVM. So here&rsquo;s the complete script:<\/p>\n<div id=\"codeSnippetWrapper\" style=\"overflow: auto;cursor: text;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 97.5%;direction: ltr;text-align: left;margin: 20px 0px 10px;line-height: 12pt;background-color: #f4f4f4;border: silver 1px solid;padding: 4px\">\n<div id=\"codeSnippet\" style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\">\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum1\" style=\"color: #606060\"> 1:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum2\" style=\"color: #606060\"> 2:<\/span> # Set up three VMs <span style=\"color: #0000ff\">for<\/span> a Galera Cluster<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum3\" style=\"color: #606060\"> 3:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum4\" style=\"color: #606060\"> 4:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum5\" style=\"color: #606060\"> 5:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum6\" style=\"color: #606060\"> 6:<\/span> # Azure Cmdlet Reference<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum7\" style=\"color: #606060\"> 7:<\/span> # http:\/\/msdn.microsoft.com\/library\/azure\/jj554330.aspx<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum8\" style=\"color: #606060\"> 8:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum9\" style=\"color: #606060\"> 9:<\/span> $subscriptionId     = <span style=\"color: #006080\">\"&lt;your subscription ID here&gt;\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum10\" style=\"color: #606060\"> 10:<\/span> $imageLabel         = <span style=\"color: #006080\">\"Ubuntu Server 14.04 LTS\"<\/span>       # One from Get-AzureVMImage | <span style=\"color: #0000ff\">select<\/span> Label<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum11\" style=\"color: #606060\"> 11:<\/span> $datacenter         = <span style=\"color: #006080\">\"West Europe\"<\/span> # change this <span style=\"color: #0000ff\">to<\/span> your preferred data center, your VNET and storage account have <span style=\"color: #0000ff\">to<\/span> be set up there as well<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum12\" style=\"color: #606060\"> 12:<\/span> $adminuser          = <span style=\"color: #006080\">\"&lt;your linux user name here&gt;\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum13\" style=\"color: #606060\"> 13:<\/span> $adminpass          = <span style=\"color: #006080\">\"&lt;a linux password&gt;\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum14\" style=\"color: #606060\"> 14:<\/span> $instanceSize       = <span style=\"color: #006080\">\"ExtraSmall\"<\/span> # ExtraSmall,Small,Medium,Large,ExtraLarge,A5,A6,A7,A8,A9,Basic_A0,Basic_A1,Basic_A2,Basic_A3,Basic_A4<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum15\" style=\"color: #606060\"> 15:<\/span> $storageAccountName = <span style=\"color: #006080\">\"&lt;the storage account name for the vm harddisk files&gt;\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum16\" style=\"color: #606060\"> 16:<\/span> $vnetname           = <span style=\"color: #006080\">\"&lt;the name of your vnet&gt;\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum17\" style=\"color: #606060\"> 17:<\/span> $subnetname         = <span style=\"color: #006080\">\"&lt;the name of the subnet for the database servers&gt;\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum18\" style=\"color: #606060\"> 18:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum19\" style=\"color: #606060\"> 19:<\/span> $loadBalancerName   = <span style=\"color: #006080\">\"galera-ilb\"<\/span> # should be changed <span style=\"color: #0000ff\">if<\/span> there are multiple galera clusters  <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum20\" style=\"color: #606060\"> 20:<\/span> $loadBalancerIP     = <span style=\"color: #006080\">\"10.11.0.10\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum21\" style=\"color: #606060\"> 21:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum22\" style=\"color: #606060\"> 22:<\/span> $servicename        = <span style=\"color: #006080\">\"&lt;your service name&gt;\"<\/span> # all machines will be created <span style=\"color: #0000ff\">in<\/span> this service<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum23\" style=\"color: #606060\"> 23:<\/span> $availabilityset    = <span style=\"color: #006080\">\"galera-as\"<\/span> # should be changed <span style=\"color: #0000ff\">if<\/span> there are multiple galera clusters  <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum24\" style=\"color: #606060\"> 24:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum25\" style=\"color: #606060\"> 25:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum26\" style=\"color: #606060\"> 26:<\/span> # Calculate a bunch of properties<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum27\" style=\"color: #606060\"> 27:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum28\" style=\"color: #606060\"> 28:<\/span> $subscriptionName = (Get-AzureSubscription | `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum29\" style=\"color: #606060\"> 29:<\/span>     <span style=\"color: #0000ff\">select<\/span> SubscriptionName, SubscriptionId | `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum30\" style=\"color: #606060\"> 30:<\/span>     Where-Object SubscriptionId -eq $subscriptionId | `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum31\" style=\"color: #606060\"> 31:<\/span>     <span style=\"color: #0000ff\">Select<\/span>-Object SubscriptionName)[0].SubscriptionName<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum32\" style=\"color: #606060\"> 32:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum33\" style=\"color: #606060\"> 33:<\/span> <span style=\"color: #0000ff\">Select<\/span>-AzureSubscription -SubscriptionName $subscriptionName -Current<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum34\" style=\"color: #606060\"> 34:<\/span>  <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum35\" style=\"color: #606060\"> 35:<\/span> $imageName = (Get-AzureVMImage | Where Label -eq $imageLabel | Sort-Object -Descending PublishedDate)[0].ImageName<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum36\" style=\"color: #606060\"> 36:<\/span>    <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum37\" style=\"color: #606060\"> 37:<\/span> $storageAccountKey = (Get-AzureStorageKey -StorageAccountName $storageAccountName).Primary<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum38\" style=\"color: #606060\"> 38:<\/span>  <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum39\" style=\"color: #606060\"> 39:<\/span> $storageContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum40\" style=\"color: #606060\"> 40:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum41\" style=\"color: #606060\"> 41:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum42\" style=\"color: #606060\"> 42:<\/span> # Fix the <span style=\"color: #0000ff\">local<\/span> subscription object<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum43\" style=\"color: #606060\"> 43:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum44\" style=\"color: #606060\"> 44:<\/span> Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccount $storageAccountName <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum45\" style=\"color: #606060\"> 45:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum46\" style=\"color: #606060\"> 46:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum47\" style=\"color: #606060\"> 47:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum48\" style=\"color: #606060\"> 48:<\/span> # This function encapsulates the configuration generation of a single new Galera VM<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum49\" style=\"color: #606060\"> 49:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum50\" style=\"color: #606060\"> 50:<\/span> Function Get-CustomVM<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum51\" style=\"color: #606060\"> 51:<\/span> {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum52\" style=\"color: #606060\"> 52:<\/span>     Param (<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum53\" style=\"color: #606060\"> 53:<\/span>         [string]$customVmName, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum54\" style=\"color: #606060\"> 54:<\/span>         [string]$machineIpAddress, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum55\" style=\"color: #606060\"> 55:<\/span>         [int]$externalSshPortNumber,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum56\" style=\"color: #606060\"> 56:<\/span>         [string] $storageAccountName = $storageContext.StorageAccountName<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum57\" style=\"color: #606060\"> 57:<\/span>         )<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum58\" style=\"color: #606060\"> 58:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum59\" style=\"color: #606060\"> 59:<\/span>     # <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum60\" style=\"color: #606060\"> 60:<\/span>     # configure the VM object<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum61\" style=\"color: #606060\"> 61:<\/span>     #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum62\" style=\"color: #606060\"> 62:<\/span>     $vm = New-AzureVMConfig `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum63\" style=\"color: #606060\"> 63:<\/span>             -Name $customVmName `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum64\" style=\"color: #606060\"> 64:<\/span>             -InstanceSize $instanceSize `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum65\" style=\"color: #606060\"> 65:<\/span>             -ImageName $imageName `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum66\" style=\"color: #606060\"> 66:<\/span>             -AvailabilitySetName $availabilityset `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum67\" style=\"color: #606060\"> 67:<\/span>             -MediaLocation <span style=\"color: #006080\">\"https:\/\/$storageAccountName.blob.core.windows.net\/vhds\/$customVmName-OSDisk.vhd\"<\/span> `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum68\" style=\"color: #606060\"> 68:<\/span>             -HostCaching <span style=\"color: #006080\">\"ReadOnly\"<\/span> `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum69\" style=\"color: #606060\"> 69:<\/span>             | `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum70\" style=\"color: #606060\"> 70:<\/span>         Add-AzureProvisioningConfig `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum71\" style=\"color: #606060\"> 71:<\/span>             -Linux `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum72\" style=\"color: #606060\"> 72:<\/span>             -LinuxUser $adminuser `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum73\" style=\"color: #606060\"> 73:<\/span>             -Password $adminpass `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum74\" style=\"color: #606060\"> 74:<\/span>             | `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum75\" style=\"color: #606060\"> 75:<\/span>         Set-AzureSubnet -SubnetNames $subnetname `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum76\" style=\"color: #606060\"> 76:<\/span>             | `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum77\" style=\"color: #606060\"> 77:<\/span>         Set-AzureStaticVNetIP -IPAddress $machineIpAddress `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum78\" style=\"color: #606060\"> 78:<\/span>             | `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum79\" style=\"color: #606060\"> 79:<\/span>         Remove-AzureEndpoint `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum80\" style=\"color: #606060\"> 80:<\/span>             -Name SSH `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum81\" style=\"color: #606060\"> 81:<\/span>             | `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum82\" style=\"color: #606060\"> 82:<\/span>         Add-AzureEndpoint `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum83\" style=\"color: #606060\"> 83:<\/span>             -Name SSH `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum84\" style=\"color: #606060\"> 84:<\/span>             -LocalPort 22 `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum85\" style=\"color: #606060\"> 85:<\/span>             -PublicPort $externalSshPortNumber `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum86\" style=\"color: #606060\"> 86:<\/span>             -Protocol tcp `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum87\" style=\"color: #606060\"> 87:<\/span>             |`<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum88\" style=\"color: #606060\"> 88:<\/span>         Add-AzureEndpoint `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum89\" style=\"color: #606060\"> 89:<\/span>             -Name mysql `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum90\" style=\"color: #606060\"> 90:<\/span>             -LocalPort 3306 `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum91\" style=\"color: #606060\"> 91:<\/span>             -PublicPort 3306 `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum92\" style=\"color: #606060\"> 92:<\/span>             -InternalLoadBalancerName $loadBalancerName `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum93\" style=\"color: #606060\"> 93:<\/span>             -Protocol tcp `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum94\" style=\"color: #606060\"> 94:<\/span>             -ProbePort 3306 `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum95\" style=\"color: #606060\"> 95:<\/span>             -ProbeProtocol <span style=\"color: #006080\">\"tcp\"<\/span> `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum96\" style=\"color: #606060\"> 96:<\/span>             -ProbeIntervalInSeconds 5 `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum97\" style=\"color: #606060\"> 97:<\/span>             -ProbeTimeoutInSeconds 11 `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum98\" style=\"color: #606060\"> 98:<\/span>             -LBSetName mysql<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum99\" style=\"color: #606060\"> 99:<\/span>  <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum100\" style=\"color: #606060\"> 100:<\/span>     $vm<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum101\" style=\"color: #606060\"> 101:<\/span> }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum102\" style=\"color: #606060\"> 102:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum103\" style=\"color: #606060\"> 103:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum104\" style=\"color: #606060\"> 104:<\/span> # 0. Create cloud service before instantiating internal load balancer<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum105\" style=\"color: #606060\"> 105:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum106\" style=\"color: #606060\"> 106:<\/span> <span style=\"color: #0000ff\">if<\/span> ((Get-AzureService | where ServiceName -eq $servicename) -eq $null) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum107\" style=\"color: #606060\"> 107:<\/span>     Write-Host <span style=\"color: #006080\">\"Create cloud service\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum108\" style=\"color: #606060\"> 108:<\/span>     New-AzureService -ServiceName $servicename -Location $datacenter<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum109\" style=\"color: #606060\"> 109:<\/span> }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum110\" style=\"color: #606060\"> 110:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum111\" style=\"color: #606060\"> 111:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum112\" style=\"color: #606060\"> 112:<\/span> # 1. Create a dummyVM <span style=\"color: #0000ff\">with<\/span> an external endpoint so that the internal load balancer (which is <span style=\"color: #0000ff\">in<\/span> preview) is willing <span style=\"color: #0000ff\">to<\/span> be created<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum113\" style=\"color: #606060\"> 113:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum114\" style=\"color: #606060\"> 114:<\/span> $dummyVM = New-AzureVMConfig -Name <span style=\"color: #006080\">\"placeholder\"<\/span> -InstanceSize ExtraSmall -ImageName $imageName `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum115\" style=\"color: #606060\"> 115:<\/span>     -MediaLocation <span style=\"color: #006080\">\"https:\/\/$storageAccountName.blob.core.windows.net\/vhds\/dummy-OSDisk.vhd\"<\/span> -HostCaching <span style=\"color: #006080\">\"ReadWrite\"<\/span> `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum116\" style=\"color: #606060\"> 116:<\/span>     | Add-AzureProvisioningConfig -Linux -LinuxUser $adminuser -Password $adminpass `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum117\" style=\"color: #606060\"> 117:<\/span>     | Set-AzureSubnet -SubnetNames $subnetname `<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum118\" style=\"color: #606060\"> 118:<\/span>     | Set-AzureStaticVNetIP -IPAddress <span style=\"color: #006080\">\"10.0.1.200\"<\/span> <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum119\" style=\"color: #606060\"> 119:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum120\" style=\"color: #606060\"> 120:<\/span> New-AzureVM -ServiceName $servicename -VNetName $vnetname -VMs $dummyVM <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum121\" style=\"color: #606060\"> 121:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum122\" style=\"color: #606060\"> 122:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum123\" style=\"color: #606060\"> 123:<\/span> # 2. Create the internal load balancer (no endpoints yet)<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum124\" style=\"color: #606060\"> 124:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum125\" style=\"color: #606060\"> 125:<\/span> Add-AzureInternalLoadBalancer -ServiceName $servicename -InternalLoadBalancerName $loadBalancerName &ndash;SubnetName $subnetname &ndash;StaticVNetIPAddress $loadBalancerIP<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum126\" style=\"color: #606060\"> 126:<\/span> <span style=\"color: #0000ff\">if<\/span> ((Get-AzureInternalLoadBalancer -ServiceName $servicename) -ne $null) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum127\" style=\"color: #606060\"> 127:<\/span>     Write-Host <span style=\"color: #006080\">\"Created load balancer\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum128\" style=\"color: #606060\"> 128:<\/span> }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum129\" style=\"color: #606060\"> 129:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum130\" style=\"color: #606060\"> 130:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum131\" style=\"color: #606060\"> 131:<\/span> # 3. Create the cluster machines and hook them up <span style=\"color: #0000ff\">to<\/span> the ILB (without mentioning <span style=\"color: #006080\">\"-Location $datacenter -VNetName $vnetname \"<\/span>, because the $dummyVM pinned these already<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum132\" style=\"color: #606060\"> 132:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum133\" style=\"color: #606060\"> 133:<\/span> $vm1 = Get-CustomVM -customVmName <span style=\"color: #006080\">\"galera-a\"<\/span> -machineIpAddress <span style=\"color: #006080\">\"10.11.0.11\"<\/span> -externalSshPortNumber 40011<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum134\" style=\"color: #606060\"> 134:<\/span> $vm2 = Get-CustomVM -customVmName <span style=\"color: #006080\">\"galera-b\"<\/span> -machineIpAddress <span style=\"color: #006080\">\"10.11.0.12\"<\/span> -externalSshPortNumber 40012<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum135\" style=\"color: #606060\"> 135:<\/span> $vm3 = Get-CustomVM -customVmName <span style=\"color: #006080\">\"galera-c\"<\/span> -machineIpAddress <span style=\"color: #006080\">\"10.11.0.13\"<\/span> -externalSshPortNumber 40013<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum136\" style=\"color: #606060\"> 136:<\/span> New-AzureVM -ServiceName $servicename -VMs $vm1,$vm2,$vm3<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum137\" style=\"color: #606060\"> 137:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum138\" style=\"color: #606060\"> 138:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum139\" style=\"color: #606060\"> 139:<\/span> # 4. Delete the dummyVM<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum140\" style=\"color: #606060\"> 140:<\/span> #<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: white;border-style: none;padding: 0px\"><span id=\"lnum141\" style=\"color: #606060\"> 141:<\/span> Remove-AzureVM -ServiceName $servicename -Name $dummyVM.RoleName -DeleteVHD<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"overflow: visible;font-size: 8pt;font-family: 'Courier New', courier, monospace;width: 100%;color: black;direction: ltr;text-align: left;margin: 0em;line-height: 12pt;background-color: #f4f4f4;border-style: none;padding: 0px\"><span id=\"lnum142\" style=\"color: #606060\"> 142:<\/span>&nbsp; <\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Now the load balancer and the three VMs are created.<\/p>\n<p>2. Install and configure Galera on the three VMs<\/p>\n<p>We took the galera .deb packages from lounchpad.net:<\/p>\n<p><a href=\"https:\/\/launchpad.net\/codership-mysql\/5.6\/5.6.16-25.5\/+download\/mysql-server-wsrep-5.6.16-25.5-amd64.deb\" target=\"_blank\" rel=\"nofollow\">https:\/\/launchpad.net\/codership-mysql\/5.6\/5.6.16-25.5\/+download\/mysql-server-wsrep-5.6.16-25.5-amd64.deb<\/a> and <a href=\"https:\/\/launchpad.net\/galera\/3.x\/25.3.5\/+download\/galera-25.3.5-amd64.deb\" target=\"_blank\" rel=\"nofollow\">https:\/\/launchpad.net\/galera\/3.x\/25.3.5\/+download\/galera-25.3.5-amd64.deb<\/a>&nbsp;<\/p>\n<p>In these packages, we found a few minor glitches that collided with the Ubuntu 14.04 LTS we installed them on. The first glitch was that mysql-server-wsrep-5.6.16-25.5-amd64.deb has a configured dependency on mysql-client. And Ubuntu sees this satisfied with the mysql-client-5.5 package it uses as default, but this creates a version conflict. So I downloaded the .deb and modified its dependency to point to mysql-client-5.6 by following <a href=\"http:\/\/ubuntuincident.wordpress.com\/2010\/10\/27\/modify-dependencies-of-a-deb-file\/\" target=\"_blank\" rel=\"nofollow\">http:\/\/ubuntuincident.wordpress.com\/2010\/10\/27\/modify-dependencies-of-a-deb-file\/<\/a>. The second glitch was the fact that the default my.cnf contains the path \/var\/log\/mysql\/error.log which does not exist on Ubuntu. This created the strange situation that the server process would not start but just create two mysterious entries in syslog. Running strace on the server process showed the path it was trying to access, and once I created it everything worked fine. Another glitch in the package was that is was missing an upstart script for mysql, instead it had just a classic \/etc\/init.d shell script which confused upstart.&nbsp; So I took one from a standard mysql-server-5.6 package and everything worked out well.<\/p>\n<p>The steps to set up Galera were:<\/p>\n<p>$ apt-get install mysql-client-5.6 <br \/>$ apt-get install libssl0.9.8 <br \/>$ dpkg -i galera-25.3.5-amd64.deb <br \/>$ dpkg &#8211;force-depends -i mysql-server-wsrep-5.6.16-25.5-amd64.modified.deb <br \/>$ mkdir \/var\/log\/mysql <br \/>$ chown mysql \/var\/log\/mysql<\/p>\n<p>and put the standard upstart script from mysql-server-5.6 into the upstart config directory.<\/p>\n<p>The next part was to configure the galera cluster function. As you can see in the script above, we have created three machines with the internal IP addresses 10.11.0.11, 10.11.0.12 and 10.11.0.13. For this, we need to set a few things in the default my.cnf<\/p>\n<p>Binlog_format=row <br \/>Default_storage_engine=InnoDB <br \/>Innodb_autoinc_lock_mode=2 <br \/>Query_cache_type=0 <br \/>Query_cache_size=0 <br \/>Innodb_flush_log_at_trx_commit=0 <br \/>Bind_address=0.0.0.0 <br \/>wsrep_provider=\/usr\/lib\/galera\/libgalera_smm.so <br \/>wsrep_cluster_name=&#8221;&lt;your cluster name here&gt;&#8221; <br \/>Wsrep_sst_method=rsync<\/p>\n<p>These settings are the same in all three machines. On each of the machines, we can now set a human readable node name, eg.g<\/p>\n<p>wsrep_node_name=&#8217;Node A&#8217; <\/p>\n<p>In the next step, we configured the actual clustering, i.e., we told each machine where to find the replication partners.<\/p>\n<p>On machine 10.11.0.11, we set the following line in my.cnf:<\/p>\n<p>wsrep_cluster_address=&#8221;gcomm:\/\/&#8221;<\/p>\n<p>This allows this database node to come up even if there is no replication partner.<\/p>\n<p>Then we started the server on 10.11.0.11.<\/p>\n<p>Then we set the following line in my.cnf on 10.11.0.12:<\/p>\n<p>wsrep_cluster_address=&#8221;gcomm:\/\/10.11.0.11,10.11.0.13&#8243;<\/p>\n<p>and started the server on 10.11.0.12<\/p>\n<p>Then we set the following line in my.cnf on 10.11.0.13:<\/p>\n<p>wsrep_cluster_address=&#8221;gcomm:\/\/10.11.0.11,10.11.0.12&#8243;<\/p>\n<p>and started the server on 10.11.0.12.<\/p>\n<p>Now we went back to 10.11.0.11 and changed the line to:<\/p>\n<p>wsrep_cluster_address=&#8221;gcomm:\/\/10.11.0.12,10.11.0.13&#8243;<\/p>\n<p>and restarted the server. Now the galera cluster was configured.<\/p>\n<p>Instead of changing the configuration of the initial node twice, one can also directly start the server process and add the configuration setting to the command line, e.g. mysqld_safe wsrep_cluster_address=&rdquo;gcomm:\/\/&rdquo;. This is a good workaround if for whatever reason the cluster was fully shut down and needs to be brought up manually again.<\/p>\n<p>Since the internal load balancer was already configured before, we can now use the ILB input IP address to connect to the cluster. So the clients use 10.11.0.10:3306 to connect to the cluster. And with each new TCP connection, the load balancer chooses one of the running nodes and connects the client to it.<\/p>\n<p>There is one additional issue that may confuse clients in one specific situation. Imagine that one of the nodes just failed and is about to start up again. In this state, the database server can be accessed but does not yet have data replicated from the other nodes. In this state, although the clients can connect, all database commands will fail. If clients aren&rsquo;t prepared to handle this situation, this may show up as database errors in applications. But there&rsquo;s a solution: FromDual has implemented a small shell script that uses the Linux iptables firewall to deny access to the server while it is in this state. The load balancer then finds it cannot access the TCP port and reroutes the request to another running cluster node.<\/p>\n<p>To run the script whenever a replication state change occurs, another line is added to my.cnf:<\/p>\n<p>wsrep_notify_cmd = \/usr\/local\/bin\/block_galera_node.sh<\/p>\n<p>The script and the instructions for setting this up can be found here:&nbsp; <a href=\"http:\/\/fromdual.com\/galera-cluster-for-mysql-and-hardware-load-balancer\/\" target=\"_blank\" rel=\"nofollow\">http:\/\/fromdual.com\/galera-cluster-for-mysql-and-hardware-load-balancer\/<\/a> Don&rsquo;t be alarmed by the fact that it talks about hardware load balancers, it works the same with the (software-based) Azure internal load balancer.<\/p>\n<p>Hope this helps,<\/p>\n<p>H.<\/p>\n<div style=\"clear:both\"><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.msdn.com\/aggbug.aspx?PostID=10547924\" width=\"1\" height=\"1\"><br \/>\nSource: msdn<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; A few weeks ago, I was looking into running a MySQL Galera Cluster for a customer with a large Linux IAAS deployment on Azure. Why that? There&rsquo;s ClearDB, a Microsoft Partner that offers MySQL on Azure as SaaS (Software &hellip; <a href=\"https:\/\/www.cubeos.org\/blog\/2014\/08\/running-a-mysql-galera-cluster-on-microsoft-azure-2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-62","post","type-post","status-publish","format-standard","hentry","category-microsoft"],"_links":{"self":[{"href":"https:\/\/www.cubeos.org\/blog\/wp-json\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cubeos.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cubeos.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cubeos.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cubeos.org\/blog\/wp-json\/wp\/v2\/comments?post=62"}],"version-history":[{"count":0,"href":"https:\/\/www.cubeos.org\/blog\/wp-json\/wp\/v2\/posts\/62\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cubeos.org\/blog\/wp-json\/wp\/v2\/media?parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cubeos.org\/blog\/wp-json\/wp\/v2\/categories?post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cubeos.org\/blog\/wp-json\/wp\/v2\/tags?post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}