<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL &#8211; Blog of Kliment Andreev &#8211; A place so I won&#039;t forget things</title>
	<atom:link href="https://blog.andreev.it/category/sql/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.andreev.it</link>
	<description></description>
	<lastBuildDate>Wed, 01 Dec 2021 20:47:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Azure: Run WordPress on managed MySQL and App Services</title>
		<link>https://blog.andreev.it/2021/12/azure-run-wordpress-on-managed-mysql-and-app-services/</link>
					<comments>https://blog.andreev.it/2021/12/azure-run-wordpress-on-managed-mysql-and-app-services/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Wed, 01 Dec 2021 20:47:57 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Azure App]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://blog.andreev.it/?p=8946</guid>

					<description><![CDATA[In this post I&#8217;ll explain how to run a WordPress site using Azure services&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>In this post I&#8217;ll explain how to run a WordPress site using Azure services for managed MySQL and App Services for a PHP application.<br />
The basic offerings for MySQL and App Services create these resources in a public subnet, so in order to integrate them with your VNETs, you&#8217;ll have to use the more expensive options. In this post, we&#8217;ll use just that. We&#8217;ll create the MySQL database without any public access and integrate the App Services to connect to the SQL database internally.</p>
<h1>VNET/subnets</h1>
<p>First, we&#8217;ll create a VNET with three subnets. When you integrate an App Services in a VNET, the subnet where the App Services will reside must be empty. The same applies for Flex MySQL servers. You can have multiple Apps in the same dedicated subnet. So, you need a dedicated subnet for both App Service and MySQL Flex, but not for MySQL single server. Single MySQL server can share the subnet with other resources.<br />
For MySQL, there are two options. We can use a private endpoint or a VNET integration. We&#8217;ll go with a private endpoint first. We don&#8217;t need a dedicated subnet for this.<br />
In my case, I&#8217;ll create a VNET with <strong>192.168.100.0/22</strong> CIDR and three subnets, <strong>192.168.100.0/24</strong> for some Infra/MySQL stuff, <strong>192.168.101.0/24</strong> for the App Services and <strong>192.168.102.0/24</strong> for Flex MySQL. I&#8217;ll use a new resource group called <strong>rgWordPress</strong>. The VNET will be called <strong>vnetWordPress</strong> and the subnets, <strong>subInfra</strong>, <strong>subApp</strong> and <strong>subMySQL</strong> respectively.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-01.png"><img fetchpriority="high" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-01.png" alt="" width="1582" height="1178" class="aligncenter size-full wp-image-8948" /></a></p>
<h2>VM</h2>
<p>I will also create a VM in the <strong>subInfra</strong> subnet. This VM is not needed at all, it will be used to test connectivity. In my case, I&#8217;ll spin a new Debian 1CPU, 1GB VM and I&#8217;ll install the MySQL client.</p>
<pre class="brush: bash; title: ; notranslate">sudo apt install default-mysql-client</pre>
<h1>Managed Single server MySQL</h1>
<p>When it comes to MySQL, there are two options: Flexible server and Single server. Look at this <a href="https://docs.microsoft.com/en-us/azure/mysql/select-right-deployment-type" rel="noopener" target="_blank">link</a> to determine what you want to use. In most of the cases, you&#8217;ll use a Flexible server. But there are some limitations in both use cases. For example, a Flexible server can&#8217;t use private endpoints. You are limited to VNET integration and Single server can&#8217;t be VNET integrated. On top of that, only General Purpose and Memory Optimized servers can have private endpoints. The basic single server can be public only. Flex VNET integrated servers require dedicated and empty subnets. There are other limitations as well, so take a look at the link above.<br />
In my case, I am using a General Purpose server.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-02.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-02.png" alt="" width="1514" height="1532" class="aligncenter size-full wp-image-8954" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-02.png 1514w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-02-296x300.png 296w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-02-1012x1024.png 1012w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-02-768x777.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-02-1170x1184.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-02-585x592.png 585w" sizes="(max-width: 1514px) 100vw, 1514px" /></a><br />
Once you create the server, it will be public. As you can see from the <strong>Overview</strong> for the server, there is a public DNS record.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-03.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-03.png" alt="" width="1010" height="356" class="aligncenter size-full wp-image-8956" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-03.png 1010w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-03-300x106.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-03-768x271.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-03-585x206.png 585w" sizes="(max-width: 1010px) 100vw, 1010px" /></a><br />
On the left side/blade, under <strong>Security</strong>, click on <strong>Private endpoint connections</strong> and create one.<br />
Name the private link and put it in the same resource group as the other resources.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-04.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-04.png" alt="" width="1568" height="802" class="aligncenter size-full wp-image-8957" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-04.png 1568w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-04-300x153.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-04-1024x524.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-04-768x393.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-04-1536x786.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-04-1170x598.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-04-585x299.png 585w" sizes="(max-width: 1568px) 100vw, 1568px" /></a><br />
For the resource type <strong>Microsoft.DBforMySQL/servers</strong> and you&#8217;ll be able to select the newly created MySQL server from the dropdown under <strong>Resource</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-05.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-05.png" alt="" width="1544" height="726" class="aligncenter size-full wp-image-8958" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-05.png 1544w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-05-300x141.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-05-1024x481.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-05-768x361.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-05-1536x722.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-05-1170x550.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-05-585x275.png 585w" sizes="(max-width: 1544px) 100vw, 1544px" /></a><br />
Finally, choose the virtual network and subnet where you want to put the private link. Do not use the subnet for App Services. In addition, make sure that the integration with the private DNS zone is set to <strong>Yes</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-06.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-06.png" alt="" width="2056" height="994" class="aligncenter size-full wp-image-8959" /></a><br />
If you log to the server that we just built and try to resolve the public DNS for the MySQL server, you&#8217;ll see that it resolves as a private IP. That&#8217;s because you have a private DNZ zone that takes precedence over the public DNS.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-07.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-07.png" alt="" width="1600" height="186" class="aligncenter size-full wp-image-8961" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-07.png 1600w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-07-300x35.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-07-1024x119.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-07-768x89.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-07-1536x179.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-07-1170x136.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-07-585x68.png 585w" sizes="(max-width: 1600px) 100vw, 1600px" /></a><br />
In case, you are still getting the public IP, go to the <strong>Private DNS zone</strong> and make sure that it&#8217;s linked to the actual VNET.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-08.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-08.png" alt="" width="1888" height="774" class="aligncenter size-full wp-image-8962" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-08.png 1888w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-08-300x123.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-08-1024x420.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-08-768x315.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-08-1536x630.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-08-1170x480.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-08-585x240.png 585w" sizes="(max-width: 1888px) 100vw, 1888px" /></a><br />
Now you can try to connect to the MySQL database. </p>
<pre class="brush: bash; title: ; notranslate">mysql -u klimenta@mysqlwordpress-single -h mysqlwordpress-single.mysql.database.azure.com -p</pre>
<p>Where <strong>-u</strong> specifies the username and the <strong>-h </strong>is the host. These parameters are under <strong>Overview</strong> on the right side. See the screenshot above.<br />
You might get the following error. ERROR 9002 (28000): SSL connection is required. Please specify SSL options and retry.<br />
In that case, download the SSL certificate and try again. </p>
<pre class="brush: bash; title: ; notranslate">
wget https://www.digicert.com/CACerts/BaltimoreCyberTrustRoot.crt.pem
mysql -u klimenta@mysqlwordpress-single -h mysqlwordpress-single.mysql.database.azure.com -p --ssl-ca=BaltimoreCyberTrustRoot.crt.pem
</pre>
<p>In case you are wondering, wait, why this cert? &#8211; The answer is <a href="https://docs.microsoft.com/en-us/azure/mysql/howto-configure-ssl" rel="noopener" target="_blank">here</a>.<br />
As you can see, I am able to connect now.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-09.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-09.png" alt="" width="1620" height="806" class="aligncenter size-full wp-image-8964" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-09.png 1620w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-09-300x149.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-09-1024x509.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-09-768x382.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-09-1536x764.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-09-1170x582.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-09-585x291.png 585w" sizes="(max-width: 1620px) 100vw, 1620px" /></a><br />
It is also recommended to disable the public access. Go to <strong>Connection security </strong>under <strong>Settings</strong> and select <strong>Yes</strong> for <strong>Deny public network access</strong>.</p>
<h1>App Services</h1>
<p>Go to App Services and create one. Make sure you use <strong>Premium</strong> offering so you can do a VNET integration. The initial parameters are self explaining. Use the defaults for the rest of the screens. You won&#8217;t be able to do much with PHP anyway.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-10.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-10.png" alt="" width="1564" height="1458" class="aligncenter size-full wp-image-8967" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-10.png 1564w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-10-300x280.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-10-1024x955.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-10-768x716.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-10-1536x1432.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-10-1170x1091.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-10-585x545.png 585w" sizes="(max-width: 1564px) 100vw, 1564px" /></a><br />
Once the app is provisioned, on the left side/blade, go to the <strong>Networking</strong> menu under <strong>Settings</strong>. You&#8217;ll see that the VNET integration is not configured. Click on the link.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-11.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-11.png" alt="" width="1992" height="1224" class="aligncenter size-full wp-image-8968" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-11.png 1992w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-11-300x184.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-11-1024x629.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-11-768x472.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-11-1536x944.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-11-1920x1180.png 1920w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-11-1170x719.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-11-585x359.png 585w" sizes="(max-width: 1992px) 100vw, 1992px" /></a><br />
Pretty much, you have to select the VNET and an empty subnet. As you can see, I can only select subApp from the dropdown.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-12.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-12.png" alt="" width="1152" height="1054" class="aligncenter size-full wp-image-8970" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-12.png 1152w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-12-300x274.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-12-1024x937.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-12-768x703.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-12-585x535.png 585w" sizes="(max-width: 1152px) 100vw, 1152px" /></a><br />
Close the blade and from the App menu, click on <strong>SSH</strong> under <strong>Development Tools</strong> on the left. This will open a new tab in your browser with a SSH session.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-13.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-13.png" alt="" width="1000" height="524" class="aligncenter size-full wp-image-8971" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-13.png 1000w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-13-300x157.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-13-768x402.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-13-585x307.png 585w" sizes="(max-width: 1000px) 100vw, 1000px" /></a><br />
We have to create the WordPress database now. You can do that from the test server that we used initially or from the actual SSH session. Let&#8217;s use the SSH session. It already comes with mysql client preinstalled.</p>
<pre class="brush: bash; title: ; notranslate">
wget https://www.digicert.com/CACerts/BaltimoreCyberTrustRoot.crt.pem
mysql -u klimenta@mysqlwordpress-single -h mysqlwordpress-single.mysql.database.azure.com -p --ssl-ca=BaltimoreCyberTrustRoot.crt.pem
</pre>
<p>Once in MySQL client, execute these SQL statements.</p>
<pre class="brush: sql; title: ; notranslate">
CREATE DATABASE dbwordpress;
GRANT ALL PRIVILEGES ON dbwordpress.* TO &quot;wordpressuser&quot;@&quot;%&quot; IDENTIFIED BY &quot;SuperSecret&quot;;
FLUSH PRIVILEGES;
EXIT
</pre>
<p>Replace the values with yours for the database name, MySQL host name, username and password.<br />
Now, you can download WordPress and extract it.</p>
<pre class="brush: bash; title: ; notranslate">
cd /home/site/wwwroot
wget -c http://WordPress.org/latest.tar.gz
tar -xzvf latest.tar.gz
mv WordPress/* /home/site/wwwroot/
rm -rf WordPress
rm -rf latest.tar.gz
</pre>
<p>Once completed, go to the URL for the app. It should be under the <strong>Overview</strong>. You have to provide the database name (dbwordpress), username (wordpressuser@mysqlwordpress-single), password (SuperSecret) and the database host (mysqlwordpress-single.mysql.database.azure.com).<br />
Most likely you&#8217;ll see an error. The easiest way is to disable the SSL requirement for the MySQL database from Connection security under Settings for the database.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-14.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-14.png" alt="" width="2218" height="382" class="aligncenter size-full wp-image-8975" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-14.png 2218w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-14-300x52.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-14-1024x176.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-14-768x132.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-14-1536x265.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-14-2048x353.png 2048w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-14-1920x331.png 1920w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-14-1170x202.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-14-585x101.png 585w" sizes="(max-width: 2218px) 100vw, 2218px" /></a><br />
If this doesn&#8217;t work for you, you&#8217;ll have to manually specify the parameters in wp-config.php. You can search this on your own.<br />
Once you are done, specify the values in WordPress install screen and you are all set.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-15.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-15.png" alt="" width="1544" height="996" class="aligncenter size-full wp-image-8976" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-15.png 1544w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-15-300x194.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-15-1024x661.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-15-768x495.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-15-1536x991.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-15-1170x755.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-15-585x377.png 585w" sizes="(max-width: 1544px) 100vw, 1544px" /></a></p>
<h1>Flex MySQL server</h1>
<p>Let&#8217;s see how Flex MySQL server works. Go to Azure MySQL but this time provision a flex server.<br />
This is how my setup looks like.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-16.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-16.png" alt="" width="1594" height="1216" class="aligncenter size-full wp-image-8978" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-16.png 1594w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-16-300x229.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-16-1024x781.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-16-768x586.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-16-1536x1172.png 1536w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-16-1170x893.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-16-585x446.png 585w" sizes="(max-width: 1594px) 100vw, 1594px" /></a><br />
&#8230;and this.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/11/P156-17.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/11/P156-17.png" alt="" width="1508" height="818" class="aligncenter size-full wp-image-8979" srcset="https://blog.andreev.it/wp-content/uploads/2021/11/P156-17.png 1508w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-17-300x163.png 300w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-17-1024x555.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-17-768x417.png 768w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-17-1170x635.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/11/P156-17-585x317.png 585w" sizes="(max-width: 1508px) 100vw, 1508px" /></a><br />
A flexible MySQL server can&#8217;t have a private endpoint, but it can be VNET integrated, same as the Azure App Services. And if you choose for the flex server to be VNET integrated, you&#8217;ll need a dedicated and empty subnet, same as Azure App Services.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2021/12/P156-18.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2021/12/P156-18.png" alt="" width="1524" height="1170" class="aligncenter size-full wp-image-8988" srcset="https://blog.andreev.it/wp-content/uploads/2021/12/P156-18.png 1524w, https://blog.andreev.it/wp-content/uploads/2021/12/P156-18-300x230.png 300w, https://blog.andreev.it/wp-content/uploads/2021/12/P156-18-1024x786.png 1024w, https://blog.andreev.it/wp-content/uploads/2021/12/P156-18-768x590.png 768w, https://blog.andreev.it/wp-content/uploads/2021/12/P156-18-1170x898.png 1170w, https://blog.andreev.it/wp-content/uploads/2021/12/P156-18-585x449.png 585w" sizes="(max-width: 1524px) 100vw, 1524px" /></a><br />
Once you provision the flex MySQL server, you&#8217;ll be able to manage it the same as a single server with a private endpoint. You can also see the entry in the private DNS zone for a flex server, same as with the single server. A flex server also allows you to have a hot standby HA pair but you can&#8217;t use this hot standby as a replica. A HA will double the price and you won&#8217;t be able to create replicas. The HA is in a different zone but in a same region and it allows forced and automatic failovers. And if you want to use a read only replica (up to 10), you have to take care of the SQL proxying using ProxySQL, HAProxy or Nginx.<br />
So, if you want some sort of HA for the MySQL, go with the flexible MySQL. You&#8217;ll have automatic failover within the region. But if you want to recover from a regional failure, use a single MySQL server with a read replica in another region (flexible MySQL can&#8217;t have replica in another region) and when you need to failover, just promote the replica in a standalone server (you&#8217;ll also need an Azure App Service in the DR region). The bad thing is that once you promote a replica in a standalone server and the original regions comes back up, you can&#8217;t revert the DR MySQL server in a replica again. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2021/12/azure-run-wordpress-on-managed-mysql-and-app-services/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AWS, Windows: MS SQL 2017 with AlwaysOn (Named Instance, WSFC) on AWS</title>
		<link>https://blog.andreev.it/2019/07/windows-ms-sql-2017-with-alwayson-named-instance-wsfc-on-aws/</link>
					<comments>https://blog.andreev.it/2019/07/windows-ms-sql-2017-with-alwayson-named-instance-wsfc-on-aws/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Mon, 08 Jul 2019 20:16:10 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[AlwaysOn]]></category>
		<category><![CDATA[MS SQL]]></category>
		<guid isPermaLink="false">https://blog.andreev.it/?p=5313</guid>

					<description><![CDATA[In this article, I&#8217;ll explain how to install and configure two Windows 2019 servers&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>In this article, I&#8217;ll explain how to install and configure two Windows 2019 servers running MS SQL 2017 Enterprise with <a href="https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/overview-of-always-on-availability-groups-sql-server?view=sql-server-2017" rel="noopener noreferrer" target="_blank">AlwaysOn</a>. The servers will have local storage only but you&#8217;ll still have HA. There are several prerequisites that you need in order to test this scenario. </p>
<ul>
&#8211; Functional AD and rights to create objects in AD<br />
&#8211; Unrestricted traffic access between the SQL nodes and AD (you can probably restrict the ports, but do your research)<br />
&#8211; Two AD accounts (an user account and a SQL service account)<br />
&#8211; Two extra IPs assigned to each SQL node<br />
&#8211; Proper DNS resolution in AWS and time synced between the nodes and DCs</ul>
</ul>
<h1>Domain controllers and AD</h1>
<p>I have two DCs running in two zones in the same region. Make sure that you can ping/resolve the servers by using only the short DNS name. E.g. My first domain controller is dc01. When I do <strong>ping dc02</strong> from dc01, it resolves fine. If not, check the DNS settings. You should also check the advanced DNS settings. Make sure that your domain is on the top. In my case, I have the DNS settings of dc01 pointing to itself and dc02. Notice ad-domain.local on top of other suffixes. <strong>AD-DOMAIN.LOCAL</strong> is the name of my domain. If you have the DNS suffixes configured on the VPC level, you don&#8217;t have to make this change. The only thing important is that you have a proper DNS resolution.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-01.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-01.png" alt="" width="1167" height="490" class="aligncenter size-full wp-image-8540" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-01.png 1167w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-01-300x126.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-01-1024x430.png 1024w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-01-768x322.png 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-01-585x246.png 585w" sizes="(max-width: 1167px) 100vw, 1167px" /></a><br />
Open up <strong>AD Users and Computers (dsa.msc)</strong> and create a single service account for the SQL servers. I&#8217;ll call it <strong>svc_sql</strong> and it should be a member of <strong>Domain Users</strong> only. The password should never expire. This account will run the SQL DB engine on SQL nodes.<br />
Then create an OU for the cluster object. In my case, I&#8217;ll create an OU called <strong>SQLCLUSTERS</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-02.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-02.png" alt="" width="362" height="278" class="aligncenter size-full wp-image-8541" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-02.png 362w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-02-300x230.png 300w" sizes="(max-width: 362px) 100vw, 362px" /></a><br />
Then create the name of your SQL cluster as a computer object and disable it.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-03.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-03.png" alt="" width="579" height="295" class="aligncenter size-full wp-image-8542" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-03.png 579w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-03-300x153.png 300w" sizes="(max-width: 579px) 100vw, 579px" /></a><br />
In <strong>AD Users and Computers</strong>, under the <strong>View </strong>menu, make sure that <strong>Advanced Features</strong> is enabled. Right-click the SQL cluster computer object and choose <strong>Properties</strong>, then click on <strong>Security </strong>tab and click <strong>Add</strong>. Type the name of the service account you just created and give it <strong>Full Control</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-04.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-04.png" alt="" width="460" height="528" class="aligncenter size-full wp-image-8543" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-04.png 460w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-04-261x300.png 261w" sizes="(max-width: 460px) 100vw, 460px" /></a><br />
We also need the cluster computer account to have rights to the OU. Right-click the OU that you just created, choose <strong>Properties </strong>and under the <strong>Security </strong>tab, click <strong>Advanced</strong>.<br />
You&#8217;ll see something like this.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-05.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-05.png" alt="" width="763" height="520" class="aligncenter size-full wp-image-8544" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-05.png 763w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-05-300x204.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-05-585x399.png 585w" sizes="(max-width: 763px) 100vw, 763px" /></a><br />
Click <strong>Add </strong>and in the new dialog that shows up, in the upper left corner, click the link <strong>Select a principal</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-06.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-06.png" alt="" width="588" height="347" class="aligncenter size-full wp-image-8545" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-06.png 588w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-06-300x177.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-06-585x345.png 585w" sizes="(max-width: 588px) 100vw, 588px" /></a><br />
By default, computer object are not going to show up, so click on <strong>Object Types</strong> button, then check <strong>Computer </strong>and click <strong>OK </strong>to go back to the screen above.<br />
Type the name of the SQL cluster and click on <strong>Check Names</strong> to verify it.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-07.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-07.png" alt="" width="457" height="250" class="aligncenter size-full wp-image-8546" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-07.png 457w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-07-300x164.png 300w" sizes="(max-width: 457px) 100vw, 457px" /></a><br />
Click OK when it reminds you that the object is disabled. In the <strong>Permission Entry</strong> dialog box, make sure that the Type is set to <strong>Allow</strong>, and the <strong>Applies to</strong> is set to <strong>This object and all descendant objects</strong>. Finally, under <strong>Permissions</strong>, click on the <strong>Create Computer objects</strong> check box. Click<strong> OK</strong> until you close all open dialogs.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-08.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-08.png" alt="" width="899" height="553" class="aligncenter size-full wp-image-8547" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-08.png 899w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-08-300x185.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-08-768x472.png 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-08-585x360.png 585w" sizes="(max-width: 899px) 100vw, 899px" /></a><br />
The AD part is now complete.</p>
<h1>WSFC (Windows Server Failover Cluster)</h1>
<p>Now, we have to create and configure the failover cluster. I have two SQL nodes, <strong>node01 </strong>and <strong>node02</strong>. We have to install WSFC on each node, but before doing that, let&#8217;s add extra two IPs per node. In AWS console, on each SQL instance, click on the network adapter, usually called <strong>eth0</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-09.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-09.png" alt="" width="1015" height="284" class="aligncenter size-full wp-image-8548" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-09.png 1015w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-09-300x84.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-09-768x215.png 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-09-585x164.png 585w" sizes="(max-width: 1015px) 100vw, 1015px" /></a><br />
Click on the <strong>Interface ID</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-10.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-10.png" alt="" width="443" height="155" class="aligncenter size-full wp-image-8549" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-10.png 443w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-10-300x105.png 300w" sizes="(max-width: 443px) 100vw, 443px" /></a><br />
Then from the <strong>Actions </strong>drop down, click on <strong>Manage IP Addresses</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-11.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-11.png" alt="" width="695" height="265" class="aligncenter size-full wp-image-8550" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-11.png 695w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-11-300x114.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-11-585x223.png 585w" sizes="(max-width: 695px) 100vw, 695px" /></a><br />
Add two extra IPs per instance. You can choose DHCP provided IPs or manual. I decided to go with manual assignment. Make sure the IPs are in the same subnet as the primary and they are not in use.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-12.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-12.png" alt="" width="618" height="253" class="aligncenter size-full wp-image-8551" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-12.png 618w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-12-300x123.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-12-585x239.png 585w" sizes="(max-width: 618px) 100vw, 618px" /></a><br />
For <strong>node01</strong>, I&#8217;ll use <strong>192.168.1.60</strong> and <strong>192.168.1.61</strong> and for <strong>node02 </strong>I&#8217;ll use <strong>192.168.2.60</strong> and <strong>192.168.2.61</strong>. <strong>node01 </strong>and <strong>dc01 </strong>are in a <strong>192.168.1.0/24</strong> subnet and <strong>node02 </strong>and <strong>dc02 </strong>are in <strong>192.168.2.0/24</strong> subnet. Now, log to both nodes with an admin account and add the SQL service account <strong>svc_sql</strong> as a local administrator. Then log off and log back to SQL nodes as <strong>svc_sql</strong> service account.<br />
On both nodes, install the WSFC (Windows Server Failover Cluster) from an elevated PowerShell prompt and reboot.</p>
<pre class="brush: powershell; title: ; notranslate">
Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools
</pre>
<p>Once the instances come back, log as <strong>svc_sql</strong> and create the cluster. Open up an elevated command or PowerShell prompt and type <strong>cluadmin.msc</strong> (do this on one node, not both). In the wizard dialog box, click <strong>Browse </strong>and type the name of the nodes.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-13.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-13.png" alt="" width="533" height="260" class="aligncenter size-full wp-image-8552" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-13.png 533w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-13-300x146.png 300w" sizes="(max-width: 533px) 100vw, 533px" /></a><br />
The cluster wizard will do some pre-checks and if everything looks good click <strong>Next</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-14.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-14.png" alt="" width="534" height="259" class="aligncenter size-full wp-image-8553" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-14.png 534w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-14-300x146.png 300w" sizes="(max-width: 534px) 100vw, 534px" /></a><br />
Do not skip this part. Make sure you validate the cluster and you run all tests. It takes about a minute or two.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-15.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-15.png" alt="" width="527" height="115" class="aligncenter size-full wp-image-8554" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-15.png 527w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-15-300x65.png 300w" sizes="(max-width: 527px) 100vw, 527px" /></a><br />
You&#8217;ll see some warnings about the network, but you can ignore them. <a href="https://blog.andreev.it/wp-content/uploads/2019/07/Failover-Cluster-Validation-Report_htm50.zip" rel="noopener noreferrer" target="_blank">This </a>is how my report looked like. You&#8217;ll be able to enter the name of the cluster if everything is OK. In my case, the cluster name is the disabled computer object <strong>SQLCLUSTER01 </strong>that we created earlier.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-16.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-16.png" alt="" width="531" height="371" class="aligncenter size-full wp-image-8555" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-16.png 531w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-16-300x210.png 300w" sizes="(max-width: 531px) 100vw, 531px" /></a><br />
Make sure you uncheck the storage setting. We are using local storage, so there is nothing to add to the cluster as a resource.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-17.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-17.png" alt="" width="533" height="339" class="aligncenter size-full wp-image-8556" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-17.png 533w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-17-300x191.png 300w" sizes="(max-width: 533px) 100vw, 533px" /></a><br />
After a minute, you should get a greeting that the cluster is OK.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-18.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-18.png" alt="" width="536" height="349" class="aligncenter size-full wp-image-8557" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-18.png 536w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-18-300x195.png 300w" sizes="(max-width: 536px) 100vw, 536px" /></a><br />
Back in the cluster manager, you&#8217;ll see this mess. Don&#8217;t worry.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-19.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-19.png" alt="" width="920" height="587" class="aligncenter size-full wp-image-8558" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-19.png 920w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-19-300x191.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-19-768x490.png 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-19-585x373.png 585w" sizes="(max-width: 920px) 100vw, 920px" /></a><br />
At the bottom of the cluster manager, right click the first node and choose <strong>Properties</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-20.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-20.png" alt="" width="570" height="187" class="aligncenter size-full wp-image-8559" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-20.png 570w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-20-300x98.png 300w" sizes="(max-width: 570px) 100vw, 570px" /></a><br />
How do you know which one is which? Once you open the properties, look at the <strong>Network </strong>under the <strong>General </strong>tab. Based on the subnet, you&#8217;ll have to assign the IP that belongs to that subnet. So, in my case this is how it looked like before I made the change.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-21.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-21.png" alt="" width="400" height="553" class="aligncenter size-full wp-image-8560" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-21.png 400w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-21-217x300.png 217w" sizes="(max-width: 400px) 100vw, 400px" /></a><br />
I know that <strong>192.168.2.0/24</strong> belongs to <strong>node02</strong>, so I&#8217;ve changed the settings from DHCP to Static IP and added <strong>192.168.2.60</strong>. Remember this IP? It was the first one that we added to node02. Scroll up if you forgot.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-22.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-22.png" alt="" width="396" height="555" class="aligncenter size-full wp-image-8561" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-22.png 396w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-22-214x300.png 214w" sizes="(max-width: 396px) 100vw, 396px" /></a><br />
Do the same for the 2nd entry. This time you have to add <strong>192.168.1.60</strong> because the subnet is <strong>192.168.1.0/24</strong>. Then, bring the cluster online.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-23.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-23.png" alt="" width="565" height="318" class="aligncenter size-full wp-image-8562" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-23.png 565w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-23-300x169.png 300w" sizes="(max-width: 565px) 100vw, 565px" /></a><br />
Now, you can install the SQL server. </p>
<h1>SQL Server installation</h1>
<p>As I mentioned earlier, make sure you have correct DNS settings and the time is in sync with AD. Before you install MS SQL, make sure you have your partitions ready. They don&#8217;t have to be like this, you can use C:\ only for everything, but ask your DBA how they want to carve the space for the DB. I am using the trial version downloaded from <a href="https://www.microsoft.com/en-us/sql-server/sql-server-downloads" rel="noopener noreferrer" target="_blank">here</a>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-24.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-24.png" alt="" width="754" height="207" class="aligncenter size-full wp-image-8563" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-24.png 754w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-24-300x82.png 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-24-585x161.png 585w" sizes="(max-width: 754px) 100vw, 754px" /></a><br />
Run the installation on both nodes using the service account <strong>svc_sql</strong>. You made this a local admin, didn&#8217;t you? Click on <strong>Installation </strong> on the left side and the first option for a <strong>new SQL Server stand-alone</strong>&#8230;<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-25.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-25.jpg" alt="" width="743" height="269" class="aligncenter size-full wp-image-8564" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-25.jpg 743w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-25-300x109.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-25-585x212.jpg 585w" sizes="(max-width: 743px) 100vw, 743px" /></a><br />
Choose license.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-26.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-26.jpg" alt="" width="324" height="161" class="aligncenter size-full wp-image-8565" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-26.jpg 324w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-26-300x149.jpg 300w" sizes="(max-width: 324px) 100vw, 324px" /></a><br />
Accept the license terms and use or do not use <strong>Microsoft Update</strong> for SQL updates.<br />
Ignore the warning for the firewall.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-27.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-27.jpg" alt="" width="477" height="141" class="aligncenter size-full wp-image-8566" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-27.jpg 477w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-27-300x89.jpg 300w" sizes="(max-width: 477px) 100vw, 477px" /></a><br />
Check the <strong>Database Engine Service</strong>, <strong>SQL Server Replication</strong>&#8230;<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-28.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-28.jpg" alt="" width="283" height="88" class="aligncenter size-full wp-image-8567" /></a><br />
&#8230;scroll down and check <strong>Client Tools Connectivity</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-29.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-29.jpg" alt="" width="276" height="54" class="aligncenter size-full wp-image-8568" /></a><br />
Click on <strong>Named instance</strong> and type your name. In my case it&#8217;s <strong>SQL2017</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-30.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-30.jpg" alt="" width="316" height="165" class="aligncenter size-full wp-image-8569" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-30.jpg 316w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-30-300x157.jpg 300w" sizes="(max-width: 316px) 100vw, 316px" /></a><br />
Leave the <strong>Service Accounts</strong> as is. We&#8217;ll change one of them later.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-31.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-31.jpg" alt="" width="579" height="240" class="aligncenter size-full wp-image-8570" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-31.jpg 579w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-31-300x124.jpg 300w" sizes="(max-width: 579px) 100vw, 579px" /></a><br />
Under <strong>Server Configuration</strong> tab, use <strong>Windows authentication mode</strong> and click <strong>Add Current User</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-32.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-32.jpg" alt="" width="586" height="426" class="aligncenter size-full wp-image-8571" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-32.jpg 586w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-32-300x218.jpg 300w" sizes="(max-width: 586px) 100vw, 586px" /></a><br />
On the <strong>Data Directories</strong> tab in the same dialog you can change the disk destinations. If you have just one <strong>C:\</strong> partition you can skip this part. If not, map the directories here. Here are mine.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-33.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-33.png" alt="" width="582" height="241" class="aligncenter size-full wp-image-8572" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-33.png 582w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-33-300x124.png 300w" sizes="(max-width: 582px) 100vw, 582px" /></a><br />
And for <strong>TempDB</strong> on the next tab in the same dialog.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-34.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-34.png" alt="" width="576" height="415" class="aligncenter size-full wp-image-8573" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-34.png 576w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-34-300x216.png 300w" sizes="(max-width: 576px) 100vw, 576px" /></a><br />
Proceed to <strong>Install</strong> until the installation completes successfully.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-35.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-35.jpg" alt="" width="599" height="143" class="aligncenter size-full wp-image-8574" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-35.jpg 599w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-35-300x72.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-35-585x140.jpg 585w" sizes="(max-width: 599px) 100vw, 599px" /></a></p>
<h2>SQL Management Tools (optional)</h2>
<p>This step is optional. If you have <strong>SSMS </strong>already installed, you can skip this part. If not, install it on a node, both or any client workstation. From the same setup menu, install SQL Management Tools (third from the top). This will take you to a MS web site where you can download the latest <strong>SMSS</strong> (SQL Server Management Studio).<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-36.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-36.jpg" alt="" width="743" height="269" class="aligncenter size-full wp-image-8575" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-36.jpg 743w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-36-300x109.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-36-585x212.jpg 585w" sizes="(max-width: 743px) 100vw, 743px" /></a></p>
<h2>SQL service account change</h2>
<p>Before you reboot, let&#8217;s change the account that runs SQL. This is mandatory for a SQL cluster. DO NOT change the account from the <strong>Services </strong>console, instead open <strong>SQL 2017 Configuration Manager</strong>.<br />
Do this on both nodes. Select where it says <strong>SQL Server Services</strong> on the left and then right-click on <strong>SQL Server (SQL2017)</strong> on the right and choose <strong>Properties</strong>.<br />
Enter the SQL service account, its password and click <strong>Apply</strong>. This will reset the SQL service and change it to run under the domain service account. Do not reboot yet.</p>
<h1>Dynamic ports and firewall</h1>
<p>Because we are using a named SQL instance, the DB engine assigns a random dynamic port for the listener. Instead of opening a range of ports on the firewall, we can restrict the listener to a static port and then open the firewall for that port only. Do this on both nodes. In the same <strong>SQL 2017 Configuration Manager</strong>, look for <strong>SQL Server Network Configuration</strong> on the left, expand it and select <strong>Protocols for SQL2017</strong> or whatever you named your instance. Right-click where it says <strong>TCP/IP</strong> on the right and choose <strong>Properties</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-37.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-37.jpg" alt="" width="492" height="235" class="aligncenter size-full wp-image-8576" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-37.jpg 492w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-37-300x143.jpg 300w" sizes="(max-width: 492px) 100vw, 492px" /></a><br />
Click on the second tab <strong>IP Addresses</strong> and scroll all the way down where it says <strong>TCP Dynamic Ports</strong>. Delete that value, leave it blank and in the next field <strong>TCP Port</strong> below, enter a random TCP port from <strong>49152-65535</strong>. I&#8217;ll use <strong>50000 </strong>for both nodes. You need to restart the SQL service for this change to take effect, but we&#8217;ll reboot, so no need for that. But, if you have your Windows Firewall enabled, you have to open these TCP ports. Run these command from an elevated PowerShell prompt.</p>
<pre class="brush: bash; title: ; notranslate">
New-NetFirewallRule -Name &quot;SQL2017 Named Instance (in)&quot; -Description &quot;SQL2017 Named Instance&quot; `
-DisplayName &quot;SQL2017 Named Instance&quot; -Enabled:True -Profile Domain,Public,Private `
-Direction Inbound -Action Allow -Protocol TCP -LocalPort 50000
New-NetFirewallRule -Name &quot;SQL Server Rule (in)&quot; -Description &quot;SQL Server Rule&quot; `
-DisplayName &quot;SQL Rule&quot; -Enabled:True -Profile Domain,Public,Private `
-Direction Inbound -Action Allow -Protocol TCP -LocalPort 1433
New-NetFirewallRule -Name &quot;SQL Server Browser Rule (in)&quot; -Description &quot;SQL Server Browser Rule&quot; `
-DisplayName &quot;SQL Browser Rule&quot; -Enabled:True -Profile Domain,Public,Private `
-Direction Inbound -Action Allow -Protocol UDP -LocalPort 1434
New-NetFirewallRule -Name &quot;SQL Server AlwaysOn Replication (in)&quot; -Description &quot;SQL Server AlwaysOn Replication&quot; `
-DisplayName &quot;SQL Server AlwaysOn Replication&quot; -Enabled:True -Profile Domain,Public,Private `
-Direction Inbound -Action Allow -Protocol TCP -LocalPort 5022
</pre>
<p>Now, you can reboot.</p>
<h1>AlwaysOn</h1>
<p>Log as the SQL service account <strong>svc_sql</strong> and open <strong>SQL Configuration Manager</strong>. You have to do this on both nodes. Similarly to what you did when you change the SQL service account, do the same.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-38.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-38.jpg" alt="" width="856" height="455" class="aligncenter size-full wp-image-8577" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-38.jpg 856w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-38-300x159.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-38-768x408.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-38-585x311.jpg 585w" sizes="(max-width: 856px) 100vw, 856px" /></a><br />
Select <strong>SQL Server Services</strong>, right-click <strong>SQL Server (SQL2017)</strong> and check <strong>Enable AlwaysOn Availability Groups</strong> under <strong>AlwaysOn High Availability</strong> tab.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-39.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-39.jpg" alt="" width="797" height="331" class="aligncenter size-full wp-image-8578" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-39.jpg 797w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-39-300x125.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-39-768x319.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-39-585x243.jpg 585w" sizes="(max-width: 797px) 100vw, 797px" /></a><br />
Restart the SQL service on both nodes. Once completed, open SSMS, connect to a node and create a new database.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-40.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-40.jpg" alt="" width="361" height="264" class="aligncenter size-full wp-image-8579" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-40.jpg 361w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-40-300x219.jpg 300w" sizes="(max-width: 361px) 100vw, 361px" /></a><br />
I&#8217;ll name my database <strong>MyDB</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-41.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-41.jpg" alt="" width="501" height="205" class="aligncenter size-full wp-image-8580" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-41.jpg 501w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-41-300x123.jpg 300w" sizes="(max-width: 501px) 100vw, 501px" /></a><br />
Make sure you backup the database. You can&#8217;t proceed without this step.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-42.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-42.jpg" alt="" width="514" height="250" class="aligncenter size-full wp-image-8581" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-42.jpg 514w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-42-300x146.jpg 300w" sizes="(max-width: 514px) 100vw, 514px" /></a><br />
Little further below, right-click on <strong>Always On High Availability</strong> and click on <strong>New Availability Group Wizard</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-43.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-43.jpg" alt="" width="420" height="101" class="aligncenter size-full wp-image-8582" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-43.jpg 420w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-43-300x72.jpg 300w" sizes="(max-width: 420px) 100vw, 420px" /></a><br />
Specify a name for the availability group.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-44.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-44.jpg" alt="" width="574" height="198" class="aligncenter size-full wp-image-8583" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-44.jpg 574w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-44-300x103.jpg 300w" sizes="(max-width: 574px) 100vw, 574px" /></a><br />
Select the database that we just created.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-45.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-45.jpg" alt="" width="582" height="131" class="aligncenter size-full wp-image-8584" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-45.jpg 582w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-45-300x68.jpg 300w" sizes="(max-width: 582px) 100vw, 582px" /></a><br />
Click on <strong>Add Replica</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-46.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-46.jpg" alt="" width="581" height="288" class="aligncenter size-full wp-image-8585" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-46.jpg 581w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-46-300x149.jpg 300w" sizes="(max-width: 581px) 100vw, 581px" /></a><br />
Connect to node02.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-47.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-47.jpg" alt="" width="574" height="361" class="aligncenter size-full wp-image-8586" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-47.jpg 574w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-47-300x189.jpg 300w" sizes="(max-width: 574px) 100vw, 574px" /></a><br />
I want automatic failover which means it&#8217;s a synchronous commit.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-48.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-48.jpg" alt="" width="580" height="218" class="aligncenter size-full wp-image-8587" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-48.jpg 580w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-48-300x113.jpg 300w" sizes="(max-width: 580px) 100vw, 580px" /></a><br />
Choose <strong>Automatic Seeding</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-49.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-49.jpg" alt="" width="589" height="467" class="aligncenter size-full wp-image-8588" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-49.jpg 589w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-49-300x238.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-49-585x464.jpg 585w" sizes="(max-width: 589px) 100vw, 589px" /></a><br />
Don&#8217;t worry about the listener.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-50.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-50.jpg" alt="" width="577" height="221" class="aligncenter size-full wp-image-8589" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-50.jpg 577w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-50-300x115.jpg 300w" sizes="(max-width: 577px) 100vw, 577px" /></a><br />
After 10-20 seconds the configuration should complete.<br />
Now, we need to add a listener. Expand the <strong>Availability Groups</strong>, right-click <strong>Availability Group Listeners</strong> and select <strong>Add Listener</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-51.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-51.jpg" alt="" width="382" height="218" class="aligncenter size-full wp-image-8590" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-51.jpg 382w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-51-300x171.jpg 300w" sizes="(max-width: 382px) 100vw, 382px" /></a><br />
Give listener a name (in my case <strong>MyListener</strong>), you can choose a port (I used the default <strong>1433</strong>, you can choose a random port but don&#8217;t forget to open the firewall) and add the other two IPs as static IPs.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-52.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-52.jpg" alt="" width="506" height="195" class="aligncenter size-full wp-image-8591" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-52.jpg 506w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-52-300x116.jpg 300w" sizes="(max-width: 506px) 100vw, 506px" /></a><br />
Right-click the availability group and click on <strong>Show Dashboard</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-53.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-53.jpg" alt="" width="852" height="504" class="aligncenter size-full wp-image-8592" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-53.jpg 852w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-53-300x177.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-53-768x454.jpg 768w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-53-585x346.jpg 585w" sizes="(max-width: 852px) 100vw, 852px" /></a><br />
Everything should be with green checkmarks and both states should be synchronized. The availability group (and the database) are configured for automatic failover, but you can do manual failover if you want. Right-click the availability group and click on <strong>Failover</strong>. This is how my manual failover looks like.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-54.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-54.jpg" alt="" width="576" height="202" class="aligncenter size-full wp-image-8593" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-54.jpg 576w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-54-300x105.jpg 300w" sizes="(max-width: 576px) 100vw, 576px" /></a><br />
At this point you have a fully functional AlwaysOn cluster. </p>
<h1>Test the failover (optional)</h1>
<p>We&#8217;ll use a sample populated table to run some queries from PowerShell. Then, we&#8217;ll stop one node and watch the outcome. In order to do the test, open up SMSS, log as <strong>svc_sql</strong> and connect to the listener directly.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-55.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-55.jpg" alt="" width="479" height="227" class="aligncenter size-full wp-image-8594" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-55.jpg 479w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-55-300x142.jpg 300w" sizes="(max-width: 479px) 100vw, 479px" /></a><br />
Click on <strong>New Query</strong> from the top.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-56.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-56.jpg" alt="" width="394" height="236" class="aligncenter size-full wp-image-8595" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-56.jpg 394w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-56-300x180.jpg 300w" sizes="(max-width: 394px) 100vw, 394px" /></a><br />
Insert these statements. They&#8217;ll create a SQL login mapped from the domain name (in my case <strong>klimenta</strong>) and a table in the <strong>MyDB </strong>database called <strong>COLORS</strong>. Replace the values that match your domain name and the database. Execute the first part (<strong>CREATE LOGIN</strong>) on <strong>node02 </strong>too.</p>
<pre class="brush: sql; title: ; notranslate">
CREATE LOGIN &#x5B;AD-DOMAIN\klimenta]  
    FROM WINDOWS  
    WITH DEFAULT_DATABASE = &#x5B;MyDB];
USE MyDB;
CREATE TABLE COLORS (ID INT, NAME VARCHAR(10));
INSERT INTO COLORS VALUES(1,'RED');
INSERT INTO COLORS VALUES(2,'YELLOW');
INSERT INTO COLORS VALUES(3,'BLUE');
INSERT INTO COLORS VALUES(4,'WHITE');
GO
</pre>
<p>Double-click the login that you just created, click on <strong>User Mapping</strong> and put a checkmark next to <strong>MyDB</strong> database.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-57.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-57.jpg" alt="" width="698" height="321" class="aligncenter size-full wp-image-8596" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-57.jpg 698w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-57-300x138.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-57-585x269.jpg 585w" sizes="(max-width: 698px) 100vw, 698px" /></a><br />
Right-click the database, choose <strong>Properties </strong>then click on <strong>Permissions</strong>. Select the username and make sure you have <strong>Connect </strong>and <strong>Select </strong>permissions.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-58.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-58.jpg" alt="" width="754" height="465" class="aligncenter size-full wp-image-8597" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-58.jpg 754w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-58-300x185.jpg 300w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-58-585x361.jpg 585w" sizes="(max-width: 754px) 100vw, 754px" /></a><br />
From a separate workstation/server, you can use even the domain controller, log as the username (<strong>klimenta</strong>) that you just granted right to the MyDB database. Open up PowerShell ISE and run this script. Replace the values for the listener and the database. It&#8217;s a script that connects to the database and spits the contect of the COLORS table indefinitely. Use CTRL-C to break.</p>
<pre class="brush: powershell; title: ; notranslate">
$Server = 'tcp:mylistener,1433'    
$database = 'MyDB'
$Connection = New-Object System.Data.SQLClient.SQLConnection
$Connection.ConnectionString = &quot;server=$($Server);database=$($Database);trusted_connection=true;MultiSubnetFailover=True;&quot;
$Connection.Open()
$Command = New-Object System.Data.SQLClient.SQLCommand
$Command.Connection = $Connection
$x=0
while ($true) {
    $Command.CommandText = 'SELECT * FROM COLORS'
    $Reader = $Command.ExecuteReader()
    $Datatable = New-Object System.Data.DataTable
    $Datatable.Load($Reader)
    $Datatable
    Start-Sleep -s 5
    Write-Host($x, &quot;---&quot;)
    $x++;
}
$Connection.Close()  
</pre>
<p>Once you see the output, shutdown the primary node or do a manual failover. You&#8217;ll notice that there is no interruption in the program flow. The only thing that changes is the IP of the listener.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/07/P132-59.jpg"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/07/P132-59.jpg" alt="" width="395" height="362" class="aligncenter size-full wp-image-8598" srcset="https://blog.andreev.it/wp-content/uploads/2019/07/P132-59.jpg 395w, https://blog.andreev.it/wp-content/uploads/2019/07/P132-59-300x275.jpg 300w" sizes="(max-width: 395px) 100vw, 395px" /></a></p>
<h1>Links</h1>
<p><a href="https://youtu.be/GM7H9fba9cQ" rel="noopener noreferrer" target="_blank">YouTube (AWS)</a><br />
<a href="https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/overview-of-always-on-availability-groups-sql-server?view=sql-server-2017" rel="noopener noreferrer" target="_blank">Microsoft</a><br />
<a href="https://www.red-gate.com/simple-talk/sql/database-administration/the-posh-dba-accessing-sql-server-from-powershell/" rel="noopener noreferrer" target="_blank">PowerShell</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2019/07/windows-ms-sql-2017-with-alwayson-named-instance-wsfc-on-aws/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CentOS: Upgrade PostgreSQL from 9.2 to 9.6</title>
		<link>https://blog.andreev.it/2019/02/146-centos-postgresql-upgrade-postgresql-from-9-2-to-9-6/</link>
					<comments>https://blog.andreev.it/2019/02/146-centos-postgresql-upgrade-postgresql-from-9-2-to-9-6/#comments</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Tue, 05 Feb 2019 00:12:37 +0000</pubDate>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[upgrade]]></category>
		<guid isPermaLink="false">https://blog.andreev.it/?p=4381</guid>

					<description><![CDATA[If you&#8217;ve installed BitBucket on a CentOS 7 server and use PostgreSQL as the&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>If you&#8217;ve installed BitBucket on a CentOS 7 server and use PostgreSQL as the back-end database, you&#8217;ve probably seen this nagging warning that support for PostgreSQL 9.2.24 has been deprecated and will be removed in an upcoming release.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2019/02/P123-01.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2019/02/P123-01.png" alt="" width="508" height="257" class="aligncenter size-full wp-image-8420" srcset="https://blog.andreev.it/wp-content/uploads/2019/02/P123-01.png 508w, https://blog.andreev.it/wp-content/uploads/2019/02/P123-01-300x152.png 300w" sizes="(max-width: 508px) 100vw, 508px" /></a><br />
While PostgeSQL 9.2 is quite old and they are already announcing version 12, mind that any of the Atlassian stack can&#8217;t support anything more than version 9.6 at the time of this writing.<br />
So, I&#8217;ll explain how to upgrade PostgreSQL on CentOS from 9.2.24 to PostgreSQL 9.6. While this post is for CentOS, it might work for other distros too. There are some prerequisites though. First, I assume that you installed PostgreSQL using <strong>yum </strong>from the default repo. In this case, your database most likely resides under <strong>/var/lib/pgsql/data</strong> and the binaries are under <strong>/usr/bin/psql</strong>. If you use the default version, then you probably use <strong>systemctl start/stop postgresql</strong> to manage the start/stop of the database daemon. If you have something different, the following tutorial will probably work, but you&#8217;ll have to adjust some directories.<br />
First thing first, let&#8217;s check the version of PostgreSQL that we use.</p>
<pre class="brush: bash; highlight: [1]; title: ; notranslate">
psql --version
psql (PostgreSQL) 9.2.24
</pre>
<p>Next, stop any services that use the database, such as BitBucket, Jira or Confluence or whatever you have there.<br />
Log as the postgres user that you use to manage the database. By the default this user is <strong>postgres</strong>.<br />
Do a full backup and move the backup somewhere because the home directory for the postgres user is where the database home is. You can compress the SQL file first. It&#8217;s just a plain text file.</p>
<pre class="brush: bash; title: ; notranslate">
pg_dumpall &gt; backup.sql
mv backup.sql somewhere/
</pre>
<p>Once done, stop the postgreSQL daemon, but log as root first. You won&#8217;t be able to stop the daemon using the postgres user.</p>
<pre class="brush: bash; title: ; notranslate">
systemctl stop postgresql
</pre>
<p>Go to a temp folder and get the RPM package from the PostgreSQL site. In case the link doesn&#8217;t work, go to the website using a browser and see what&#8217;s the latest 9.6 version.</p>
<pre class="brush: bash; title: ; notranslate">
cd /tmp
wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
</pre>
<p>Install the newer version.</p>
<pre class="brush: bash; title: ; notranslate">
rpm -ivh pgdg-centos96-9.6-3.noarch.rpm
yum install postgresql96-server
</pre>
<p>You&#8217;ll get some warning that symlinks can&#8217;t be created but you can ignore them. The new version installs the binaries under <strong>/usr/psql-9.6/bin</strong>.<br />
Log as the postgres user and initialize the new database.</p>
<pre class="brush: bash; highlight: [1]; title: ; notranslate">
/usr/pgsql-9.6/bin/initdb -D /var/lib/pgsql/9.6/data/
The files belonging to this database system will be owned by user &quot;postgres&quot;.
This user must also own the server process.

The database cluster will be initialized with locale &quot;en_US.UTF-8&quot;.
The default database encoding has accordingly been set to &quot;UTF8&quot;.
The default text search configuration will be set to &quot;english&quot;.

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/pgsql/9.6/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling &quot;trust&quot; authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/pgsql-9.6/bin/pg_ctl -D /var/lib/pgsql/9.6/data/ -l logfile start
</pre>
<p>Ignore the line that says that we can start the server. We have to upgrade the current database first. Make sure that the directories below are the same as yours. If not, make changes.</p>
<pre class="brush: bash; highlight: [1]; title: ; notranslate">
/usr/pgsql-9.6/bin/pg_upgrade --old-datadir /var/lib/pgsql/data/ --new-datadir /var/lib/pgsql/9.6/data/ --old-bindir /usr/bin/ --new-bindir /usr/pgsql-9.6/bin/
Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok

*failure*
Consult the last few lines of &quot;pg_upgrade_server.log&quot; for
the probable cause of the failure.

connection to database failed: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket &quot;/var/lib/pgsql/.s.PGSQL.50432&quot;?


could not connect to old postmaster started with the command:
&quot;/usr/bin/pg_ctl&quot; -w -l &quot;pg_upgrade_server.log&quot; -D &quot;/var/lib/pgsql/data/&quot; -o &quot;-p 50432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directory='/var/lib/pgsql'&quot; start
Failure, exiting
</pre>
<p>Oh boy. If you check the error message, you&#8217;ll get some more info.</p>
<pre class="brush: bash; highlight: [1]; title: ; notranslate">
tail /var/lib/pgsql/pg_upgrade_server.log
server stopped


command: &quot;/usr/bin/pg_ctl&quot; -w -l &quot;pg_upgrade_server.log&quot; -D &quot;/var/lib/pgsql/data/&quot; -o &quot;-p 50432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directory='/var/lib/pgsql'&quot; start &gt;&gt; &quot;pg_upgrade_server.log&quot; 2&gt;&amp;1
waiting for server to start....FATAL:  unrecognized configuration parameter &quot;unix_socket_directory&quot;
 stopped waiting
pg_ctl: could not start server
Examine the log output.
</pre>
<p>The reason being that as of PostgreSQL version 9.3 the config parameter <strong>unix_socket_directory</strong> has been replaced with <strong>unix_socket_directories</strong>. There is a workaround thanks to this <a href="https://dba.stackexchange.com/users/55596/ziggy-crueltyfree-zeitgeister" rel="noopener noreferrer" target="_blank">guy</a>. The link for more info is <a href="https://dba.stackexchange.com/questions/50135/pg-upgrade-unrecognized-configuration-parameter-unix-socket-directory" rel="noopener noreferrer" target="_blank">here</a>.<br />
Pretty much, all you have to do is execute these lines first. Execute these lines as root or sudo user.</p>
<pre class="brush: bash; title: ; notranslate">
mv /usr/bin/pg_ctl{,-orig}
echo '#!/bin/bash' &gt; /usr/bin/pg_ctl
echo '&quot;$0&quot;-orig &quot;${@/unix_socket_directory/unix_socket_directories}&quot;' &gt;&gt; /usr/bin/pg_ctl
chmod +x /usr/bin/pg_ctl
</pre>
<p>Now you can do the upgrade.</p>
<pre class="brush: bash; highlight: [1]; title: ; notranslate">
/usr/pgsql-9.6/bin/pg_upgrade --old-datadir /var/lib/pgsql/data/ --new-datadir /var/lib/pgsql/9.6/data/ --old-bindir /usr/bin/ --new-bindir /usr/pgsql-9.6/bin/
Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* system OID user data types                ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for roles starting with 'pg_'                      ok
Checking for invalid &quot;line&quot; user columns                    ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows on the new cluster                        ok
Deleting files from new pg_clog                             ok
Copying old pg_clog to new server                           ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Setting oldest multixact ID on new cluster                  ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                                            ok
Setting minmxid counter in new cluster                      ok
Copying user relation files
                                                            ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok
Creating script to analyze new cluster                      ok
Creating script to delete old cluster                       ok

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    ./analyze_new_cluster.sh

Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh
</pre>
<p>Start the new database now and check everything. As you can see, the startup script is different. This time we have to specify the version of PostgreSQL. As root do:</p>
<pre class="brush: bash; title: ; notranslate">
systemctl start postgresql-9.6
</pre>
<p>You can revert the change back.</p>
<pre class="brush: bash; title: ; notranslate">
mv -f /usr/bin/pg_ctl{-orig,}
</pre>
<p>Log as postgres user and do a check up. It might take some time if your database is large.</p>
<pre class="brush: bash; title: ; notranslate">
./analyze_new_cluster.sh
</pre>
<p>You can delete the old database if you want.</p>
<pre class="brush: bash; title: ; notranslate">
./delete_old_cluster.sh
</pre>
<p>If you check the new version, you&#8217;ll see that it&#8217;s the same.</p>
<pre class="brush: bash; highlight: [1]; title: ; notranslate">
psql --version
psql (PostgreSQL) 9.2.24
</pre>
<p>The database is upgraded and running 9.6, it&#8217;s just the <strong>psql </strong>binary that&#8217;s the old version. You have to tell the postgres user to use the new binaries. Delete the old binaries first, uninstall the old version, make sure it doesn&#8217;t start on boot and enable the new version. Also, if you have any specific configurations, make sure you compare<strong> postgresql.conf</strong> and <strong>pg_hba.conf</strong> under <strong>/var/lib/pgsql/data</strong> and <strong>/var/lib/pgsql/9.6/data</strong>. Log as root first. Make sure it says 9.2 when you run yum remove.</p>
<pre class="brush: bash; title: ; notranslate">
systemctl disable postgresql
yum remove postgresql
</pre>
<p>Enable postgreSQL to boot on start.</p>
<pre class="brush: bash; title: ; notranslate">
systemctl enable postgresql-9.6
</pre>
<p>Add the following line under <strong>.bash_profile</strong> for the postgres user.</p>
<pre class="brush: bash; title: ; notranslate">
export PATH=$PATH:/usr/pgsql-9.6/bin
</pre>
<p>If you don&#8217;t have a <strong>.bash_profile</strong> file, check if there is any <strong>.bash_profile.rpmsave</strong>. Rename this one as <strong>.bash_profile</strong> and add the above line. It should look like this.</p>
<pre class="brush: bash; title: ; notranslate">
&#x5B; -f /etc/profile ] &amp;&amp; source /etc/profile
PGDATA=/var/lib/pgsql/9.6/data
export PGDATA
# If you want to customize your settings,
# Use the file below. This is not overridden
# by the RPMS.
&#x5B; -f /var/lib/pgsql/.pgsql_profile ] &amp;&amp; source /var/lib/pgsql/.pgsql_profile
export PATH=$PATH:/usr/pgsql-9.6/bin
</pre>
<p>If you log off, log back on as the postgres user or execute <strong>source .bash_profile</strong> and check the version, you&#8217;ll see that you are all set.</p>
<pre class="brush: bash; title: ; notranslate">
psql --version
psql (PostgreSQL) 9.6.11
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2019/02/146-centos-postgresql-upgrade-postgresql-from-9-2-to-9-6/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>AWS: Restore MS SQL database to RDS</title>
		<link>https://blog.andreev.it/2017/08/109-aws-restore-ms-sql-database-rds/</link>
					<comments>https://blog.andreev.it/2017/08/109-aws-restore-ms-sql-database-rds/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Sat, 05 Aug 2017 22:32:25 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[MS SQL]]></category>
		<category><![CDATA[RDS]]></category>
		<category><![CDATA[restore]]></category>
		<guid isPermaLink="false">http://blog.iandreev.com/?p=3099</guid>

					<description><![CDATA[I had to migrate a SQL 2014 database from our on-prem environment to AWS.&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>I had to migrate a SQL 2014 database from our on-prem environment to AWS. The requirement was to use RDS. So, these are the steps that I&#8217;ve taken in order to successfully migrate the database. You can also check the official AWS link <a href="http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html" target="_blank" rel="noopener noreferrer">here</a>. </p>
<p>First, take a backup of the existing database in <strong>BAK </strong>format. In my case for the purpose of this blog, I&#8217;ve backed up my vCenter database called <strong>VCDB </strong>in a file called <strong>VCDB.BAK</strong>. Once you have the file, create a S3 bucket in AWS with the default settings and upload the BAK file there. In my case the S3 bucket was named <strong>restoremybackup</strong>.<br />
Next, make sure you have access to a Windows server with SQL Management Studio installed, either in AWS or on-prem, but this server will need to talk to the RDS database over port 1433 TCP. I built a server in AWS and installed the SQL Management Studio, which is a free download. Make sure that you have a security group in place that allows port 1433. We will use this security group to assign it to the RDS instance. I&#8217;ve created a new security group called <strong>sgAllowSQLAccess</strong>. For the source, type the IP of the server with SQL Management Studio or the security group itself. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2017/08/P087-01.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/08/P087-01.png" alt="" width="681" height="375" class="aligncenter size-full wp-image-7650" srcset="https://blog.andreev.it/wp-content/uploads/2017/08/P087-01.png 681w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-01-300x165.png 300w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-01-585x322.png 585w" sizes="(max-width: 681px) 100vw, 681px" /></a><br />
Then, go to RDS and create an <strong>Option Group</strong>. Name the <strong>Option Group</strong>, in my case it&#8217;s <strong>ogSQL2014Restore</strong>, choose the engine and the version. I am using <strong>sqlserver-se</strong> which is <strong>SQL Standard Edition</strong> and the version is <strong>12.00</strong> which is <strong>MS SQL 2014</strong>. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2017/08/P087-02.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/08/P087-02.png" alt="" width="684" height="282" class="aligncenter size-full wp-image-7651" srcset="https://blog.andreev.it/wp-content/uploads/2017/08/P087-02.png 684w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-02-300x124.png 300w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-02-585x241.png 585w" sizes="(max-width: 684px) 100vw, 684px" /></a><br />
Once created, select your <strong>Option Group</strong> and click on <strong>Add Option</strong>. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2017/08/P087-03.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/08/P087-03.png" alt="" width="672" height="288" class="aligncenter size-full wp-image-7652" srcset="https://blog.andreev.it/wp-content/uploads/2017/08/P087-03.png 672w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-03-300x129.png 300w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-03-585x251.png 585w" sizes="(max-width: 672px) 100vw, 672px" /></a><br />
Choose <strong>SQLSERVER_BACKUP_RESTORE</strong>, then click on <strong>Create a New Role</strong>. For the role, use a name, in my case it&#8217;s <strong>iamRestoreSQLBackup</strong>. Then type the name of the S3 bucket that you just created and make sure that you select <strong>Apply Immediately &#8211; yes</strong>.<br />
Then click on <strong>Add Option</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2017/08/P087-04.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/08/P087-04.png" alt="" width="636" height="316" class="aligncenter size-full wp-image-7653" srcset="https://blog.andreev.it/wp-content/uploads/2017/08/P087-04.png 636w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-04-300x149.png 300w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-04-585x291.png 585w" sizes="(max-width: 636px) 100vw, 636px" /></a><br />
Now, it&#8217;s time to create the RDS database. Launch a new RDS instance and use the parameters that suit your needs. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2017/08/P087-05.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/08/P087-05.png" alt="" width="647" height="566" class="aligncenter size-full wp-image-7654" srcset="https://blog.andreev.it/wp-content/uploads/2017/08/P087-05.png 647w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-05-300x262.png 300w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-05-585x512.png 585w" sizes="(max-width: 647px) 100vw, 647px" /></a><br />
For the next set of options, choose your preferred settings, but make sure that you assign the <strong>Security Group</strong> that we just created and the <strong>Option Group</strong> that we also created. In my case it looks like this. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2017/08/P087-06.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2017/08/P087-06.png" alt="" width="571" height="706" class="aligncenter size-full wp-image-7655" srcset="https://blog.andreev.it/wp-content/uploads/2017/08/P087-06.png 571w, https://blog.andreev.it/wp-content/uploads/2017/08/P087-06-243x300.png 243w" sizes="(max-width: 571px) 100vw, 571px" /></a><br />
Once the RDS it&#8217;s in available state, try to telnet to port 1433 to the RDS endpoint from the Windows server where you have the SQL Management Studio installed. If everything is OK, you are ready to restore the database. In SQL Management Studio, select a <strong>New Query</strong> and type the following. </p>
<pre class="brush: sql; title: ; notranslate">
exec msdb.dbo.rds_restore_database 
        @restore_db_name='database_name', 
        @s3_arn_to_restore_from='arn:aws:s3:::bucket_name/file_name_and_extension';
</pre>
<p>Replace <strong>&#8216;database_name&#8217;</strong> and <strong>&#8216;bucket_name/file_name_and_extenstion&#8217;</strong> with your values. In my case, they were <strong>VCDB </strong>and <strong>restoremybackup/VCDB.BAK</strong>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2017/08/109-aws-restore-ms-sql-database-rds/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ESX/ESXi: Install vCenter 5.0</title>
		<link>https://blog.andreev.it/2014/01/install-vcenter-5-0/</link>
					<comments>https://blog.andreev.it/2014/01/install-vcenter-5-0/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Sun, 12 Jan 2014 02:19:57 +0000</pubDate>
				<category><![CDATA[ESX/ESXi]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[vCenter]]></category>
		<guid isPermaLink="false">http://blog.iandreev.com/?p=1035</guid>

					<description><![CDATA[In this post I&#8217;ll describe how I installed vCenter 5.0 on Windows 2008 R2&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>In this post I&#8217;ll describe how I installed <strong>vCenter 5.0</strong> on Windows 2008 R2 server using SQL 2008 R2 database. I&#8217;ve used two servers in my lab, one for the vCenter and the other one for the SQL. I won&#8217;t explain how to install SQL server, it&#8217;s fairly straightforward. </p>
<p>First thing to do is to create the SQL database. VMware provides a SQL script that you can execute to create the database. The script is on the vCenter installation DVD/ISO under <strong>source\vCenter-Server\dbschema</strong> folder where source is some drive letter (D:\ or E:\). This script does not work right, so we&#8217;ll use a modified version. By default, <strong>vCenter</strong> requires full <strong>db_owner</strong> rights so it can create some scheduled jobs. If your environment doesn’t allow this type of access, see the installation guide for vCenter. In this post, we’ll grant full <strong>db_owner</strong> rights for the sql user (<strong>vpxuser</strong>) to both vCenter database (<strong>VCDB</strong>) and the <strong>msdb</strong> system database. Once <strong>vCenter</strong> is up and running, you can remove the full <strong>db_owner</strong> rights from the msdb. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-01.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-01.png" alt="" width="561" height="305" class="aligncenter size-full wp-image-6872" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-01.png 561w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-01-300x163.png 300w" sizes="(max-width: 561px) 100vw, 561px" /></a></p>
<p>Start the <strong>SQL Server Management Studio</strong>, log as the <strong><em>sa</em></strong> user or some domain user with full SQL admin rights, and click <strong>New Query</strong>.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-02.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-02.png" alt="" width="525" height="251" class="aligncenter size-full wp-image-6873" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-02.png 525w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-02-300x143.png 300w" sizes="(max-width: 525px) 100vw, 525px" /></a></p>
<p>Copy and paste the following script, but change the file path where you want your database to reside. In my case it is <strong>C:\DATA</strong>. Also, change the password for the <strong>vpxuser</strong> that we will create. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-03.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-03.png" alt="" width="562" height="411" class="aligncenter size-full wp-image-6874" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-03.png 562w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-03-300x219.png 300w" sizes="(max-width: 562px) 100vw, 562px" /></a></p>
<pre class="brush: sql; title: ; notranslate">
use &#x5B;master]
go
CREATE DATABASE &#x5B;VCDB] ON PRIMARY
(NAME = N'vcdb', FILENAME = N'C:\DATA\VCDB.mdf', SIZE = 2000KB, FILEGROWTH = 10% )
LOG ON
(NAME = N'vcdb_log', FILENAME = N'C:\DATA\VCDB.ldf', SIZE = 1000KB, FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS
go
use VCDB
go
sp_addlogin @loginame=&#x5B;vpxuser], @passwd=N'vpxuserpassword', @defdb='VCDB',
@deflanguage='us_english'
go
ALTER LOGIN &#x5B;vpxuser] WITH CHECK_POLICY = OFF
go
CREATE USER &#x5B;vpxuser] for LOGIN &#x5B;vpxuser]
go
</pre>
<p>While in <strong>SQL Server Management Studio</strong>, expand the <strong>Security</strong>, then <strong>Logins</strong>. Double-click on the <strong>vpxuser</strong> and choose <strong>User Mapping</strong>. Select the <strong>VCDB</strong> database and put a check mark for <strong>db_owner</strong>. Put a check mark on the <strong>msdb</strong> database and do the same (check mark on <strong>db_owner</strong>).<br />
 <a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-04.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-04.png" alt="" width="874" height="470" class="aligncenter size-full wp-image-6875" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-04.png 874w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-04-300x161.png 300w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-04-768x413.png 768w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-04-585x315.png 585w" sizes="(max-width: 874px) 100vw, 874px" /></a></p>
<p>Next thing to do is to install the <strong>SQL Server Native Client</strong> on the vCenter server. It’s a free download from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=16978" title="Click here to download SQL Native Client" target="_blank" rel="noopener noreferrer">Microsoft</a>. Once installed, go to <strong>Administrative Tools | Data Sources (ODBC)</strong>. Click on <strong>System DSN</strong> tab and then click <strong>Add</strong>. You should see a <strong>SQL Server Native Client 10.0</strong> driver there. Do not use <strong>SQL Server</strong> driver. It won&#8217;t work.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-05.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-05.png" alt="" width="575" height="462" class="aligncenter size-full wp-image-6876" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-05.png 575w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-05-300x241.png 300w" sizes="(max-width: 575px) 100vw, 575px" /></a></p>
<p>Enter the name for the <strong>ODBC</strong> connection, a description and type the hostname for the SQL server. In my case, I&#8217;ll use <strong>vCenter, vCenter Database</strong> and <strong>sql</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-06.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-06.png" alt="" width="497" height="379" class="aligncenter size-full wp-image-6877" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-06.png 497w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-06-300x229.png 300w" sizes="(max-width: 497px) 100vw, 497px" /></a></p>
<p>Next, choose <strong>SQL authentication</strong> and type the SQL user that we just created with the script (<strong>vpxuser</strong> and its password).<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-07.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-07.png" alt="" width="505" height="380" class="aligncenter size-full wp-image-6878" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-07.png 505w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-07-300x226.png 300w" sizes="(max-width: 505px) 100vw, 505px" /></a></p>
<p>Click the first check mark and select the <strong>VCDB</strong> database.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-08.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-08.png" alt="" width="511" height="384" class="aligncenter size-full wp-image-6879" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-08.png 511w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-08-300x225.png 300w" sizes="(max-width: 511px) 100vw, 511px" /></a></p>
<p>Leave the defaults and click <strong>Finish</strong>.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-09.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-09.png" alt="" width="495" height="370" class="aligncenter size-full wp-image-6880" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-09.png 495w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-09-300x224.png 300w" sizes="(max-width: 495px) 100vw, 495px" /></a></p>
<p>Click the <strong>Test Data Source</strong> button and make sure that it says that the connection completed successfully.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-10.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-10.png" alt="" width="357" height="366" class="aligncenter size-full wp-image-6881" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-10.png 357w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-10-293x300.png 293w" sizes="(max-width: 357px) 100vw, 357px" /></a></p>
<p>Now, it&#8217;s time to install <strong>vCenter</strong>. Insert the DVD or mount the ISO image and the installer will start.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-11.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-11.png" alt="" width="686" height="502" class="aligncenter size-full wp-image-6882" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-11.png 686w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-11-300x220.png 300w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-11-585x428.png 585w" sizes="(max-width: 686px) 100vw, 686px" /></a></p>
<p>Click the first option <strong>vCenter server</strong> and go thru the Next, Accept cycle. Once you reach the <strong>Database Options</strong>, select the second radio button and choose the ODBC connection that we just created.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-12.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-12.png" alt="" width="499" height="370" class="aligncenter size-full wp-image-6883" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-12.png 499w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-12-300x222.png 300w" sizes="(max-width: 499px) 100vw, 499px" /></a></p>
<p>If you get this error, make sure you start the <strong>SQL Server Agent</strong> on the SQL server. By default this service is disabled. You can stop this service once the installation completes.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-13.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-13.png" alt="" width="381" height="154" class="aligncenter size-full wp-image-6884" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-13.png 381w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-13-300x121.png 300w" sizes="(max-width: 381px) 100vw, 381px" /></a></p>
<p>Enter the SQL username and password that we just created.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-14.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-14.png" alt="" width="497" height="366" class="aligncenter size-full wp-image-6885" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-14.png 497w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-14-300x221.png 300w" sizes="(max-width: 497px) 100vw, 497px" /></a></p>
<p>If you receive the following error, it means that you are not a <strong>db_owner</strong> on the <strong>VCDB</strong> database.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-15.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-15.png" alt="" width="405" height="319" class="aligncenter size-full wp-image-6886" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-15.png 405w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-15-300x236.png 300w" sizes="(max-width: 405px) 100vw, 405px" /></a></p>
<p>You won&#8217;t be able to continue until you fix this. When you reach this screen <strong>vCenter Server Service</strong>, stop. You have an option to run the <strong>vCenter Server</strong> service as a local server account or you can choose a domain account. If you use a domain account, it should be a local admin on the server.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-16.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-16.png" alt="" width="497" height="371" class="aligncenter size-full wp-image-6887" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-16.png 497w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-16-300x224.png 300w" sizes="(max-width: 497px) 100vw, 497px" /></a></p>
<p>Change or accept the defaults for the <strong>vCenter</strong> program.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-17.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-17.png" alt="" width="503" height="377" class="aligncenter size-full wp-image-6888" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-17.png 503w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-17-300x225.png 300w" sizes="(max-width: 503px) 100vw, 503px" /></a><br />
Select the first option.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-18.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-18.png" alt="" width="498" height="374" class="aligncenter size-full wp-image-6889" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-18.png 498w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-18-300x225.png 300w" sizes="(max-width: 498px) 100vw, 498px" /></a></p>
<p>Change or accept the default ports. If you install <strong>vCenter</strong> on a shared server with <strong>IIS</strong> installed, you&#8217;ll have port conflicts here.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-19.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-19.png" alt="" width="485" height="374" class="aligncenter size-full wp-image-6890" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-19.png 485w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-19-300x231.png 300w" sizes="(max-width: 485px) 100vw, 485px" /></a><br />
Change or accept the default ports for the <strong>Inventory Service</strong>.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-20.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-20.png" alt="" width="500" height="371" class="aligncenter size-full wp-image-6891" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-20.png 500w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-20-300x223.png 300w" sizes="(max-width: 500px) 100vw, 500px" /></a><br />
Estimate how many VMs you&#8217;ll have.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-21.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-21.png" alt="" width="501" height="374" class="aligncenter size-full wp-image-6892" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-21.png 501w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-21-300x224.png 300w" sizes="(max-width: 501px) 100vw, 501px" /></a></p>
<p>Click <strong>Install</strong>.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-22.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-22.png" alt="" width="497" height="377" class="aligncenter size-full wp-image-6893" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-22.png 497w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-22-300x228.png 300w" sizes="(max-width: 497px) 100vw, 497px" /></a></p>
<p>After couple of minutes, click <strong>Finish</strong> to complete the install. Your <strong>vCenter Server</strong> should be up and running, but we are not over yet.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-23.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-23.png" alt="" width="495" height="371" class="aligncenter size-full wp-image-6894" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-23.png 495w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-23-300x225.png 300w" sizes="(max-width: 495px) 100vw, 495px" /></a></p>
<p>We will install the <strong>Update Manager</strong> now. This part of <strong>vCenter</strong> is used to patch the vCenter and ESXi hosts. Log back to the SQL server and in <strong>SQL Server Management Studio</strong>, execute this script that will create a new database for the <strong>Update Manager</strong>. Make sure you change the file path for the database. In my case is <strong>C:\DATA</strong>. We&#8217;ll use the same <strong>vpxuser</strong> user for the <strong>Update Manager</strong> database.</p>
<pre class="brush: sql; title: ; notranslate">
CREATE DATABASE &#x5B;VCUM] ON PRIMARY
(NAME = N'vcum', FILENAME = N'C:\DATA\VCUM.mdf', SIZE = 2000KB, FILEGROWTH = 10% )
LOG ON
(NAME = N'vcum_log', FILENAME = N'C:\DATA\VCUM.ldf', SIZE = 1000KB, FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS
go
use VCUM
go
</pre>
<p>On vCenter server, go to<strong> C:\Windows\SysWOW64</strong> folder and run <strong>odbcacd32.exe</strong>. The <strong>Update Manager</strong> is using a 32-bit ODBC and by default, if you go to <strong>Administrative Tools</strong> and start the <strong>ODBC manager</strong>, you&#8217;ll execute the 64-bit version.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-24.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-24.png" alt="" width="449" height="323" class="aligncenter size-full wp-image-6895" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-24.png 449w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-24-300x216.png 300w" sizes="(max-width: 449px) 100vw, 449px" /></a></p>
<p>Pick a name and description for this ODBC connection and specify your SQL server hostname.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-25.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-25.png" alt="" width="503" height="384" class="aligncenter size-full wp-image-6896" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-25.png 503w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-25-300x229.png 300w" sizes="(max-width: 503px) 100vw, 503px" /></a></p>
<p>Select the <strong>VCUM</strong> database that we just created and similarly to the previous ODBC creation, finish the rest of the steps.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-26.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-26.png" alt="" width="501" height="381" class="aligncenter size-full wp-image-6897" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-26.png 501w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-26-300x228.png 300w" sizes="(max-width: 501px) 100vw, 501px" /></a></p>
<p>Start the <strong>Update Manager</strong> install.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-27.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-27.png" alt="" width="655" height="452" class="aligncenter size-full wp-image-6898" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-27.png 655w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-27-300x207.png 300w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-27-585x404.png 585w" sizes="(max-width: 655px) 100vw, 655px" /></a></p>
<p>Accept the defaults.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-28.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-28.png" alt="" width="501" height="374" class="aligncenter size-full wp-image-6899" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-28.png 501w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-28-300x224.png 300w" sizes="(max-width: 501px) 100vw, 501px" /></a></p>
<p>Create a domain user that will run the <strong>Update Manager</strong> service. In my case I use <strong>svc_vcenter</strong>. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-29.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-29.png" alt="" width="491" height="371" class="aligncenter size-full wp-image-6900" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-29.png 491w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-29-300x227.png 300w" sizes="(max-width: 491px) 100vw, 491px" /></a></p>
<p>Specify the 32-bit ODBC connection that we just created.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-30.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-30.png" alt="" width="498" height="379" class="aligncenter size-full wp-image-6901" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-30.png 498w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-30-300x228.png 300w" sizes="(max-width: 498px) 100vw, 498px" /></a></p>
<p>Enter the same <strong>vpxuser</strong> and password.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-31.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-31.png" alt="" width="498" height="371" class="aligncenter size-full wp-image-6902" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-31.png 498w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-31-300x223.png 300w" sizes="(max-width: 498px) 100vw, 498px" /></a></p>
<p>Specify if any proxy servers need to be specified. <strong>Update Manager</strong> requires Internet connection.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-32.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-32.png" alt="" width="491" height="377" class="aligncenter size-full wp-image-6903" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-32.png 491w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-32-300x230.png 300w" sizes="(max-width: 491px) 100vw, 491px" /></a></p>
<p>Change or accept the defaults.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-33.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-33.png" alt="" width="497" height="378" class="aligncenter size-full wp-image-6904" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-33.png 497w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-33-300x228.png 300w" sizes="(max-width: 497px) 100vw, 497px" /></a></p>
<p>The rest of the steps a re just plain Next, Next, Finish.</p>
<p>Once installed, go back and install the <strong>vCenter</strong> client. I won&#8217;t explain how to do this. It&#8217;s trivial. Log to the <strong>vCenter</strong> with a local admin password or with a domain account (if you run vCenter service under a domain account).<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-34.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-34.png" alt="" width="416" height="373" class="aligncenter size-full wp-image-6905" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-34.png 416w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-34-300x269.png 300w" sizes="(max-width: 416px) 100vw, 416px" /></a></p>
<p>Select the top left <strong>vCenter</strong> server name and then click on <strong>Permissions</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-35.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-35.png" alt="" width="756" height="123" class="aligncenter size-full wp-image-6906" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-35.png 756w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-35-300x49.png 300w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-35-585x95.png 585w" sizes="(max-width: 756px) 100vw, 756px" /></a></p>
<p>Click <strong>Add</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-36.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-36.png" alt="" width="635" height="502" class="aligncenter size-full wp-image-6907" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-36.png 635w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-36-300x237.png 300w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-36-585x462.png 585w" sizes="(max-width: 635px) 100vw, 635px" /></a></p>
<p>Type your domain, enter a user that you want to grant full admin rights and click <strong>Check Names</strong>. If everything is OK, the dialog box will just blink.<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-37.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-37.png" alt="" width="500" height="468" class="aligncenter size-full wp-image-6908" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-37.png 500w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-37-300x281.png 300w" sizes="(max-width: 500px) 100vw, 500px" /></a></p>
<p>Back in the previous dialog, select <strong>Administrator</strong> and click OK. We made <strong>svc_vcenter</strong> an admin <strong>vCenter</strong> user. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-38.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-38.png" alt="" width="630" height="500" class="aligncenter size-full wp-image-6909" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-38.png 630w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-38-300x238.png 300w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-38-585x464.png 585w" sizes="(max-width: 630px) 100vw, 630px" /></a></p>
<p>From the <strong>vCenter</strong> client menu, select <strong>Plug-Ins</strong> and select the <strong>Update Manager</strong> plug-in.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-39.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-39.png" alt="" width="771" height="356" class="aligncenter size-full wp-image-6910" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-39.png 771w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-39-300x139.png 300w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-39-768x355.png 768w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-39-585x270.png 585w" sizes="(max-width: 771px) 100vw, 771px" /></a></p>
<p>Click <strong>Run</strong>.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-40.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-40.png" alt="" width="436" height="297" class="aligncenter size-full wp-image-6911" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-40.png 436w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-40-300x204.png 300w" sizes="(max-width: 436px) 100vw, 436px" /></a></p>
<p>Create a new datacenter, add the ESXi hosts and you are all set.</p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2014/01/P037-41.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2014/01/P037-41.png" alt="" width="407" height="211" class="aligncenter size-full wp-image-6912" srcset="https://blog.andreev.it/wp-content/uploads/2014/01/P037-41.png 407w, https://blog.andreev.it/wp-content/uploads/2014/01/P037-41-300x156.png 300w" sizes="(max-width: 407px) 100vw, 407px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2014/01/install-vcenter-5-0/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
