sql azure 语法
介绍 (Introduction)
In this new chapter, we will show how to use the Microsoft Portal to monitor the Virtual Machines with SQL Server Installed. We will show how to do it with the current Portal and the New Microsoft Azure Portal. We will check how to monitor performance, watch the logs, review the settings and change them.
在这一新的章节中,我们将展示如何使用Microsoft Portal监视安装了SQL Server的虚拟机。 我们将展示如何使用当前门户和新的Microsoft Azure门户来做到这一点。 我们将检查如何监视性能,查看日志,查看设置并进行更改。
要求 (Requirements)
I am assuming that you already have a VM with SQL Server in Azure installed.
我假设您已经在Azure中安装了带有SQL Server的虚拟机 。
- An Azure subscription. Azure订阅。
- A VM Machine in Azure with SQL Server already installed (check my article about Azure VMs). Azure中已安装SQL Server的VM机器(请查看有关Azure VM的文章)。
入门 (Getting started)
In the Microsoft Portal, go to the Virtual Machine section and click on the VM with SQL Server installed.
在Microsoft门户中,转到“虚拟机”部分,然后单击装有SQL Server的VM。
Figure 1. The VMs in the Azure Portal 图1. Azure门户中的VM You have the options to install Windows PowerShell for Windows and Linux. For more information about PowerShell in Azure, you can read our Article about PowerShell in Azure
您可以选择安装适用于Windows和Linux的Windows PowerShell。 有关Azure中PowerShell的更多信息,可以阅读有关Azure中PowerShell的文章。
Figure 2. The initial page in the portal of the VMs 图2. VM门户中的初始页面 The Monitor section allows you to monitor:
监视部分允许您监视:
- CPU Percentage which shows the CPU utilization per percentage. The use is usally intensive, but if the value if too high (more than 80% very frequently), it means that a machine with more CPUs is required or maybe a Load Balancing is requiredCPU百分比 ,显示每个百分比的CPU利用率。 使用通常消耗大量资源,但是如果该值过高(非常频繁地超过80%),则意味着需要使用更多CPU的计算机,或者可能需要负载平衡
- Disk read/write bytes/second helps us to measure the disk activity related. If there is too much disk activity, it is recommended to distribute the information in other disks. Usually, the number of disks in Azure is high. In SQL Server, you can distribute your Data files in different disks to improve performance. This value is in MB per second磁盘读/写字节/秒可帮助我们测量相关的磁盘活动。 如果磁盘活动过多,建议将信息分发到其他磁盘中。 通常,Azure中的磁盘数量很多。 在SQL Server中,可以将数据文件分发到不同的磁盘中以提高性能。 此值以MB /秒为单位
- Network IN and 网络IN和OUT shows the Network input and output in Bytes OUT表示以字节为单位的网络输入和输出
You can see the maximum value, the minimum value and the average value of these metrics
您可以看到这些指标的最大值,最小值和平均值
Figure 3. The VMs performance 图3. VM的性能
Figure 4. The Azure VM max, min and average performance 图4. Azure VM的最大,最小和平均性能 In the ENDPOINTS section, you can find the Endpoints, the ports used, the public and private ports. The Endpoints allow us to communicate with other Machines outside the Cloud. For that you enable the ports specifying the public and private ports
在“端点”部分中,您可以找到端点,使用的端口,公共端口和专用端口。 端点使我们能够与云外部的其他计算机进行通信。 为此,请启用指定公共端口和专用端口的端口
Figure 5. The Endpoint’s information 图5.端点信息 The Configure section is very important to define the Tier. The basic Tier includes Memory from 768 MB to 14 GB and the Standard Tier from 768MB to 112 GB. The Virtual Machine Size is closely related to the Tier. For more information about review the link Tier and virtual machine size. The availability Set is to configure high availability using groups of virtual machines. That way, the chances to have all the machines down is very low. You need 2 or more virtual machines in a group named availability set for this feature. If one of the VMs is down, the others will replace the one failing. For more information about availability set, please check this link
配置部分对于定义层非常重要。 基本层包括从768 MB到14 GB的内存,以及从768MB到112 GB的标准层。 虚拟机大小与层密切相关。 有关更多信息,请查看链接层和虚拟机大小。 可用性集用于使用虚拟机组配置高可用性。 这样一来,关闭所有计算机的机会就很小。 为此功能,在名为可用性集的组中需要2个或更多虚拟机。 如果其中一台虚拟机关闭,其他虚拟机将替换其中一台出现故障的虚拟机。 有关可用性设置的更多信息,请检查此链接
Figure 6. The setting of the Azure VMs 图6. Azure VM的设置 The scale section is used to configure the instances in the availability set. For example, if the CPU used is too high, we can use more instances to attend the users demand. With the SCALE section, we can see the instances used and the autoscale options. In Azure, there are 2 main ways to SCALE:
标度部分用于配置可用性集中的实例。 例如,如果使用的CPU太高,我们可以使用更多实例来满足用户需求。 通过SCALE部分,我们可以看到使用的实例和自动缩放选项。 在Azure中,有两种主要的SCALE方法:
- One if the CPU is too high. 如果CPU太高,则返回1。
- The number of messages in the Queue. 队列中的消息数。
You can specify parameters to scale your VMs
您可以指定参数来扩展虚拟机
Figure 7. The instances used to autoscale 图7.用于自动缩放的实例 In the instances section, you can see the name, the status of the machine the size. In the instances section, you can see the name, the status of the machine the size.
在实例部分,您可以看到名称,机器状态和大小。 在实例部分,您可以看到名称,机器状态和大小。
In an availability set, you can have several machines running and you can verify here which ones are up and which ones down
在可用性集中,您可以运行多台计算机,并且可以在此处验证哪些计算机处于启动状态,哪些计算机处于关闭状态。
Figure 8. The instances used 图8.使用的实例 The linked resources allow you to link resources such as a SQL Database with a service. When you link a resource, it is easier to monitor the service and the resource together
链接的资源使您可以将SQL数据库等资源与服务链接。 链接资源时,更容易一起监视服务和资源
Figure 9. Linked resources in Azure 图9. Azure中的链接资源 The certificates shows the certificate used in the Virtual Machine, the status, subject used, expiration date. The certificate allows to have a secure connection to the VM machine. The expiration date is very important to verify if the certification is out-of-date
证书显示虚拟机中使用的证书,状态,使用的主题,到期日期。 该证书允许与VM计算机建立安全连接。 到期日期对于验证认证是否过期非常重要。
Figure 10. The azure certificates used. 图10.使用的天蓝色证书。 In the dashboard section you can see the Applications and services that can be used according to your subscription options, Reboot logs and Operations logs
在仪表板部分中,您可以看到根据订阅选项,重新启动日志和操作日志可以使用的应用程序和服务
Figure 11. Some dashboard options 图11.一些仪表板选项 You can for example, filter by date and time when the VM reboot. You can use ranges of dates and times to filter the information. The search option allows to search the entries of the criteria specified
例如,您可以按VM重新启动时的日期和时间进行筛选。 您可以使用日期和时间范围来过滤信息。 搜索选项允许搜索指定条件的条目
Figure 12. The reboot history of the Azure VMs 图12. Azure VM的重新启动历史记录 The operation logs allows you to see the operations done on the Virtual Machine. You can filter the information by subscription, date, time, status, type and service name.
操作日志使您可以查看在虚拟机上完成的操作。 您可以按订阅,日期,时间,状态,类型和服务名称过滤信息。
For example, you can check when the service started including the date and time, who did the operation. The log also includes an ID to identify the operation done. You also have the status of the service with the operation done
例如,您可以检查服务的启动时间,包括日期和时间,操作者。 该日志还包含一个ID,用于标识已完成的操作。 您还具有完成操作的服务状态
Figure 13. The operation log of the Azure VMs 图13. Azure VM的操作日志 Besides the Logs, you can see the status, the Virtual IP Address, the endpoints used, the location of the VM, The date it was created and the last modification date. The input EndPoints use the IP address followed by the Port. You can install your Azure machine in several locations like USA, Brazil and Japan
除了日志,您还可以查看状态,虚拟IP地址,使用的端点,VM的位置,创建日期和最后修改日期。 输入的端点使用IP地址,后跟端口。 您可以在美国,巴西和日本等多个位置安装Azure机器
Figure 14. The VM information 图14. VM信息 The current portal is easy to use, but now there is a new console called the Preview Portal which will be the new Portal in the Future. You can access to the preview portal with this link
当前的门户网站易于使用,但是现在有了一个名为“预览门户网站”的新控制台,它将成为将来的新门户网站。 您可以通过此链接访问预览门户
If you click on the BROWSE ALL, you will be able to see all the resources
如果单击“全部浏览”,您将能够看到所有资源
Figure 15. The new Azure Portal 图15.新的Azure门户 Let’s click in one of the virtual machines
让我们点击其中一个虚拟机
Figure 16. A view of all the resources in the Azure Preview Portal 图16. Azure预览门户中所有资源的视图 The interface allows configuring settings, to connect to the Virtual Machine, to restart the VM, delete the machine, reset and capture the VM image in order to create new VMs based on that image. You can also reset the remote access. You can also see the subscription information, the status of the VM, the IPs used (private and virtual). You can see the size and subscription ID. The operative system and the size of the VM (explained in step 5) are also displayed
该界面允许配置设置,连接到虚拟机,重新启动VM,删除计算机,重置和捕获VM映像,以便基于该映像创建新的VM。 您也可以重置远程访问。 您还可以查看订阅信息,VM的状态,使用的IP(专用和虚拟)。 您可以看到大小和订阅ID。 还显示了操作系统和VM的大小(在步骤5中进行了说明)
Figure 17. The options available in the new Azure Portal 图17.新Azure门户中可用的选项 You can also check the Performance of the VM like the CPU % explained in detail in the step 3 of this article
您还可以检查虚拟机的性能,例如本文第3步中详细说明的CPU%
Figure 18. The CPU Percentage of the machines 图18.机器的CPU百分比 You can also see the disk writes and the network input and output. For more information about these counters, check the step 3
您还可以看到磁盘写入以及网络输入和输出。 有关这些计数器的更多信息,请检查步骤3
Figure 19. The disk and network performance 图19.磁盘和网络性能 It is also possible to see the system events and Alert rules of the VM in Azure. In the new Portal it is possible to configure alerts if the Counters exceed a specified threshold. For example, you can configure the CPU % to send an alert if it exceeds 80%. The Alerts and event will be displayed here. You will be able to see also if the alert rules are active, the number of alerts and if they are enabled
还可以查看Azure中VM的系统事件和警报规则。 在新门户中,可以在计数器超过指定阈值时配置警报。 例如,您可以将CPU%配置为在警报超过80%时发送警报。 警报和事件将在此处显示。 您还将能够查看警报规则是否处于活动状态,警报数量以及是否已启用它们
Figure 20. 图20. The events and alerts 事件和警报 If you press the all settings option, you will be able to see the Properties, Disks, IP addresses, Endpoints and other options available. As you can see the information is more complete now. You can easily check Properties, disks, Endpoints, Load balanced configurations, Extensions used by the Azure, Diagnostics and the size of the VM. You also have the option to reset the password or create new users
如果按所有设置选项,将可以看到“属性”,“磁盘”,“ IP地址”,“端点”和其他可用选项。 如您所见,信息现在更加完整。 您可以轻松检查属性,磁盘,端点,负载平衡配置,Azure使用的扩展,诊断和VM的大小。 您还可以选择重置密码或创建新用户
Figure 21. The Settings available 图21.可用设置 For example, the size shows the number of disks, the memory in GB, the number of cores and disks per Size of VM and prices. You can see the characteristics of the A4, A7 Standard and the A4 Basic
例如,大小显示磁盘数量,以GB为单位的内存,每个VM大小和价格的核心数和磁盘数。 您可以看到A4,A7标准版和A4基本版的特征
Figure 22. The different options and sizes of the VMs in Azure 图22. Azure中VM的不同选项和大小 The Properties shows the status of the VM, DNS and computer name, IP, operative system. You have access to the virtual and the private IP address
该属性显示VM,DNS和计算机名称,IP,操作系统的状态。 您可以访问虚拟IP地址和私有IP地址
Figure 23. The properties of the VM 图23. VM的属性 It is also possible to see the disk information and the size of the disks. In this sample, the virtual machine has 16 disks
也可以查看磁盘信息和磁盘大小。 在此示例中,虚拟机具有16个磁盘
Figure 24. The disk information of the VMs 图24. VM的磁盘信息
结论 (Conclusion)
In this chapter, we taught how to see the logs in Azure, how to get the properties, check the resources, how to monitor the performance of the machines using the current Microsoft Azure Portal and using the Preview Portal which be used in the future. We noted that the new portal has a more intuitive access to options and it is easier to use and access.
在本章中,我们讲授了如何在Azure中查看日志,如何获取属性,检查资源,如何使用当前的Microsoft Azure门户以及将来使用的预览门户来监视计算机的性能。 我们注意到,新门户网站对选项的访问更加直观,并且更易于使用和访问。
sql azure 语法