iaas, sql, rest and powershell
Post on 02-Dec-2014
353 Views
Preview:
DESCRIPTION
TRANSCRIPT
IaaS, SQL, REST and Powershell
Why is IaaS useful and what can do with it
Introduction
AgendaIntroduction to IaaSSimple IaaS patterns for the EnterpriseSQL Server and IaaSDeploying via PowershellDeploying using RESTScripting updates to your VMSQL and High Availability in the Cloud
WhoRichard Conway (and Andy Cross), co-founders UK Windows Azure User Group and need to use this cache in their own application and will explain why!
What is IaaS?
IaaS is…
• By Definition and Function• Infrastructure as a Service• Permanent VM Roles (with a lot less hassle!)• A way of extending your windows network into the cloud securely• A way of migrating your existing application and processes into the cloud• A way of doing what you do on premise without large capital investment and
scaling to meet your needs quickly
• What can you do• Build a web farm• Build a Windows network• Build a virtual datacentre• Build a set of virtualised desktops to offload complex tasks (e.g. rendering)• Basically, building applications and entire organisations in the cloud!
Images Available at Preview
Windows Server 2008 R2
Windows Server 2008 R2 with SQL Server 2012 Evaluation
Windows Server 2012 Release Candidate
OpenSUSE 12.1
CentOS 6.2
Ubuntu 12.04
SUSE Linux Enterprise Server SP2
Installing a SQL VM via Powershell
Types and info on caches
Recap of demo• Download and install WAPP CmdLets• Download a .publishsettings file• Use Import-AzurePublishSettingsFile CmdLet• Use Set-AzureSubscription or Select-AzureSubscription to set the
correct subscription• To see a list of gallery and saved images Get-AzureVMImage• You need to specify an image name, a cloud service name, a machine
name, a VM size, a Windows password and a location• Use New-AzureVMConfig to provide the config, Add-
AzureProvisioningConfig to add the Windows provisioning, Add-AzureDataDisk to add an additional disk, Add-AzureEndpoint to setup an Azure endpoint on 1433
• Use Get-AzureDisk | Select DiskName and Remove-AzureDisk –DiskName –DeleteVHD to remove
What to do after an install …
• Remote desktop on to the machine• Update the SQL Server to use Mixed Mode authentication• Create and login and user with a password• Add the user to the dbowner role• Open an incoming port on the firewall to allow access to port 1433• Open up SSMS• Enter the credentials to the DNS endpoint • Login and manipulate the database• Take all of the above and script into a powershell script!
What the powershell script looks like to build the VM$img = "MSFT__Sql-Server-11EVAL-11.0.2215.0-05152012-en-us-30GB.vhd"$machinename = "ELASTASQLVHD"$hostedservice = "elastavhd"$size = "Small"$password = "Password900"$medialink = "http://elastastorage2.blob.core.windows.net/vhds/elastasql.vhd"$disklabel = "datasql"$sqllink = "http://elastastorage2.blob.core.windows.net/vhds/elastadata.vhd"
New-AzureVMConfig -name $machinename -InstanceSize $size -ImageName $img -MediaLocation $medialink -Verbose | Add-AzureProvisioningConfig -Windows -Password $password -Verbose | Add-AzureDataDisk -CreateNew -DiskSizeInGB 50 -DiskLabel $disklabel -MediaLocation $sqllink -Verbose | Add-AzureEndpoint -Name SqlEndpoint -Protocol tcp -PublicPort 1433 -LocalPort 1433 | New-AzureVM -ServiceName $hostedservice -Location "North Europe" -Verbose
What the powershell script looks like to build the VM$img = "MSFT__Sql-Server-11EVAL-11.0.2215.0-05152012-en-us-30GB.vhd"$machinename = "ELASTASQLVHD"$hostedservice = "elastavhd"$size = "Small"$password = "Password900"$medialink = "http://elastastorage2.blob.core.windows.net/vhds/elastasql.vhd"$disklabel = "datasql"$sqllink = "http://elastastorage2.blob.core.windows.net/vhds/elastadata.vhd"
New-AzureVMConfig -name $machinename -InstanceSize $size -ImageName $img -MediaLocation $medialink -Verbose | Add-AzureProvisioningConfig -Windows -Password $password -Verbose | Add-AzureDataDisk -CreateNew -DiskSizeInGB 50 -DiskLabel $disklabel -MediaLocation $sqllink -Verbose | Add-AzureEndpoint -Name SqlEndpoint -Protocol tcp -PublicPort 1433 -LocalPort 1433 | New-AzureVM -ServiceName $hostedservice -Location "North Europe" -Verbose
Deploying a SQL VM in C#Using Fluent Management
Simple Fluent Syntax
var manager = new SubscriptionManager(TestConstants.InsidersSubscriptionId);manager.GetVirtualMachinesManager() .AddCertificateFromStore(TestConstants.ManagementThumbprintIaaS) .CreateVirtualMachineDeployment() .AddToExistingCloudServiceWithName(TestConstants.CloudServiceNameIaaS) .WithDeploymentType(VirtualMachineTemplates.SqlServer2012) .WithStorageAccountForVhds(TestConstants.StorageServiceNameIaaS) .WithVmOfSize(VmSize.Small) .Deploy();
What the REST request is composed of …
• Deployment• RoleList• Role
• ConfigurationSet• Windows
• Domain Join• Certificates
• Linux• SSH
• Network• Endpoints
• Endpoint• Loadbalancer
• Subnet• Availability Set• DataDisks• DataDisk
• OS Disk• Role Size• Virtual Network• DNS Servers
POST https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/
Requests are asynchronous so you need to poll for success with the “x-ms-request-id”
DEMOFluent Management
VHDsHow to roll your own
Cloud
BlogStorage
Bring Your Own Server/VHDOn-Premises
On Premises Virtual Server
Provision VM from Image or Disk using portal, script or API
Use CaseForklift Migration of VMs
Sys Prepped Images
VHD Must Be Fixed Disk * CSUpload Can Convert on Upload
MyApp.vhd
Patterns with IaaSMigrating applications and using AD in the cloud
Migrating a Multi-VM Application
Cloud ServiceName: myapp1.cloudapp.net
Virtual MachineVM Name: appsrv110.1.5.6
Virtual MachineVM Name: appsrv210.1.5.7
DIP
Cloud Service Acts as a Networking BoundaryAll VMs in the same service can communicate directlyName resolution between VMs is automatic with Windows Azure provided DNS
Virtual MachineVM Name: SQLServer110.1.5.8
DIP DIP
Load BalancerPublic IP
Migrating an Intranet Application
Cloud Service
Mirrored DBs
HTTP
VPN GatewayHTTP
On Premises
AD / DNS
Exchange
Site to Site VPN Tunnel
Web/App
Web/App
Hardware Load Balancer on client side for load balancing across internal only VPN tunnel.
Load Balancer
Migrating an Intranet Application
Cloud Service
Mirrored DBs
HTTP
SLBVPN Gateway HTTP
On Premises
AD / DNS
Exchange
Site to Site VPN Tunnel
Web/App
Web/App
Software Load Balancer for Internal LBUse an SLB such as the ARR extension of IIS7.5 when site-to-site only connectivity is a requirement.
Domain Controller On-Premises
The Virtual Networkin Windows Azure
Gateway
SQL ServersIIS Servers
Load BalancerPublic IP
Site to Site VPN Tunnel
AD Authentication+
On-Premises Resources
Contoso.com Active Directory
Contoso Corp Network
IIS Servers
AD / DNS
SQL Servers
Exchange
S2S VPN Device
Contoso.com Active Directory
Domain Controller in the Cloud
The Virtual Networkin Windows Azure
Gateway
SQL ServersIIS Servers
Load BalancerPublic IP
AD Replication+
On Premises Resources
AD / DNS
AD Auth
Site to Site VPN Tunnel
Contoso.com Active Directory
Contoso Corp Network
IIS Servers
AD / DNS
SQL Servers
Exchange
S2S VPN Device
Contoso.com Active Directory
Active Directory Cloud Only
The Virtual Networkin Windows Azure
Gateway
SQL ServersIIS Servers
Load BalancerPublic IP
On Premises ResourcesAD / DNS
AD Auth
Site to Site VPN Tunnel
Contoso Corp Network
IIS Servers
AD / DNS
SQL Servers
Exchange
S2S VPN Device
Contoso.com Active Directory
Extranet Active Directory
Best Practice GuidelinesSQL Dos and Donts
SQL Performance Best Practice
• From the SQL Server team!• Test performance with SQLIO (test the underlying storage
subsystem)• Use Storage Analytics as a free download to see the underlying
storage transactions• Don’t set max memory let SQL Server handle this • Disable write caching for the OS• Move the data and logs off the OS Disk preferably onto
separate drives• Use the volatile D: drive for tempdb storage• Use page compression to reduce IO
SQL High Availability
Virtual Machine
Virtual Machine
SQL Server Primary
SQL Server Secondary
Availability Set
Database mirroring available now in the preview
SQL 2012 AlwaysOn Feature using Windows Clustering available in the commercial VM release
Q&ASee http://blog.elastacloud.com or follow @azurecoder for details of using mirroring
top related