aws rds监控慢sql

This article deploys a new AWS RDS SQL Server using the AWS CLI command: create-db-instance.

本文使用AWS CLI命令create-db-instance部署了新的AWS RDS SQL Server

介绍 (Introduction)

Amazon Web Services (AWS) gives a managed database service RDS for Microsoft SQL Server. Previously, we deployed the RDS instance using the AWS console. Suppose you deploy RDS instance frequently, it might be cumbersome for you to go through console RDS wizard, choose required options and deploy it. We can stop RDS service when it is not being used, but it can be stopped for a maximum of seven days. RDS automatically starts the RDS instance for maintenance purposes. In this case, you can create the lambda function to start and stop SQL instances automatically.

Amazon Web Services(AWS)为Microsoft SQL Server提供了托管数据库服务RDS。 以前,我们使用AWS控制台部署RDS实例。 假设您经常部署RDS实例,那么通过控制台RDS向导,选择所需的选项并进行部署可能会很麻烦。 我们可以在不使用RDS服务时将其停止,但是最多可以停止7天。 RDS会出于维护目的自动启动RDS实例。 在这种情况下,您可以创建lambda函数来自动启动和停止SQL实例。

In my case, usually, I drop RDS instance after preparing a demo for my article. You can also terminate an RDS instance after completing your testing. In this case, it is a wise decision to use AWS CLI scripts and configure your instances.

就我而言,通常是在为我的文章准备演示之后删除RDS实例。 您也可以在完成测试后终止RDS实例。 在这种情况下,明智的选择是使用AWS CLI脚本并配置实例。

The following articles can be helpful in understanding RDS SQL Server:

以下文章可能有助于理解RDS SQL Server:

  • Launching a new database instance using the AWS Web Console 使用AWS Web Console启动新的数据库实例
  • AWS RDS – SQL Server Administration AWS RDS – SQL Server管理
  • How to stop an AWS RDS SQL Server using a web console and AWS CLI 如何使用Web控制台和AWS CLI停止AWS RDS SQL Server
  • Automatically Start/Stop an AWS RDS SQL Server using AWS Lambda functions 使用AWS Lambda函数自动启动/停止AWS RDS SQL Server

In this article, we will deploy an AWS RDS SQL Server using the AWS CLI script.

在本文中,我们将使用AWS CLI脚本部署AWS RDS SQL Server。

先决条件 (Pre-requisites)

  • Install the AWS CLI version 2 and configure the CLI profile: You should install CLI version 2 in your local system or the EC2 instance. You can refer to this article 安装AWS CLI版本2并配置CLI配置文件 :您应该在本地系统或EC2实例中安装CLI版本2。 您可以参考本文Learn AWS CLI: An Overview of AWS CLI (AWS Command Line Interface) for it. 了解AWS CLI:AWS CLI概述(AWS命令行界面) 。
  • AWS blog for more details on the AWS Shell console. AWS博客以获取有关AWS Shell控制台的更多详细信息。

使用AWS CLI部署AWS RDS SQL Server (Using the AWS CLI to deploy an AWS RDS SQL Server)

We will use the CLI command create-db-instance to deploy RDS instances. We can deploy all supported RDS databases using this command. I will go through the option in AWS Web console and its similar argument in the CLI create-db-instance command.

我们将使用CLI命令create-db-instance部署RDS实例。 我们可以使用此命令部署所有受支持的RDS数据库。 我将在AWS Web控制台中使用该选项,并在CLI create-db-instance命令中使用其类似参数。

引擎选项 (Engine options)

In the AWS console RDS wizard, you need to select the engine type and its corresponding edition. For SQL Server, we have the following supported editions.

在AWS控制台RDS向导中,您需要选择引擎类型及其对应的版本。 对于SQL Server,我们具有以下受支持的版本。

In the below table, we can see the CLI argument for the SQL Server edition. For example, if we want to create a new RDS instance for SQL Server express edition, we specify sqlserver-ex.

在下表中,我们可以看到SQL Server版本的CLI参数。 例如,如果要为SQL Server Express版本创建新的RDS实例,则可以指定sqlserver-ex。

CLI argument

SQL Server edition

Equivalent CLI option

Engine

Express edition

sqlserver-ex

Web edition

sqlserver-web

Standard edition

sqlserver-se

Enterprise edition

sqlserver-ee

CLI参数

SQL Server版本

等效的CLI选项

发动机

速成版

sqlserver-ex

网络版

sqlserver-web

标准版

sqlserver-se

企业版

sqlserver-ee


(Version
)

AWS RDS supports different SQL Server versions from 2012 to 2017 along with different levels. You need to specify which version you require in the new AWS RDS SQL Server. We need to select the version depending upon the features. We also need to consider that RDS does not support all SQL Server features. Features such as Data Quality Services, log shipping, file table, maintenance plans are not supported.

从2012年到2017年,AWS RDS支持不同SQL Server版本以及不同的级别。 您需要在新的AWS RDS SQL Server中指定所需的版本。 我们需要根据功能选择版本。 我们还需要考虑RDS并不支持所有SQL Server功能。 不支持数据质量服务,日志传送,文件表,维护计划等功能。

For my demonstration, I choose SQL Server version 14.00.3281.6.v1. In the CLI, we need to specify the version in the format as 14.00.3281.6.v1.

为了演示,我选择了SQL Server版本14.00.3281.6.v1。 在CLI中,我们需要以14.00.3281.6.v1的格式指定版本。

You can refer to SQL Server Versions Supported in RDS for a complete list of supported SQL versions and their similar RDS argument.

您可以参考RDS支持SQL Server版本,以获取受支持SQL版本及其相似的RDS参数的完整列表。

数据库实例标识符
(DB instance identifier
)

It is the name for your DB instance. It is a unique name for all databases in the AWS account.

它是您的数据库实例的名称。 它是AWS账户中所有数据库的唯一名称。

  • Its name must contain a minimum of 1 and a maximum of 63 letters, numbers or hyphens 名称必须包含至少1个字符,最多63个字母,数字或连字符
  • Its first character must be a letter 它的第一个字符必须是字母
  • You cannot use two consecutive hyphens 您不能使用两个连续的连字符
  • The instance name must not end with a hyphen 实例名称不能以连字符结尾

In the CLI command, we will use argument –db-instance-identifier along with DB instance name.

在CLI命令中,我们将使用–db-instance-identifier参数以及数据库实例名称。

数据库凭证 (DB credentials)

We need a master username and password for the RDS instance. By default, RDS uses the admin username. This admin user has the maximum permissions for your instance. In the web console, you specify these details in the credential settings page.

我们需要RDS实例的主用户名和密码。 默认情况下,RDS使用管理员用户名。 此管理员用户具有您实例的最大权限。 在Web控制台中,您可以在“凭据设置”页面中指定这些详细信息。

In the AWS CLI, we specify the following arguments.

在AWS CLI中,我们指定以下参数。

  • –master-username: Specify the master username –master-username:指定主用户名
  • –master-user-password: Specify the password for the admin user –master-user-password :指定管理员用户的密码

数据库实例大小 (DB instance size)

It is the CPU and memory capacity for your RDS server. AWS provides various DB instance class depending upon the CPU and memory configurations. Your AWS RDS SQL Server cost also varies depending upon the instance class you have selected.

它是RDS服务器的CPU和内存容量。 AWS根据CPU和内存配置提供各种数据库实例类。 您的AWS RDS SQL Server成本也会根据您选择的实例类而有所不同。

We can use argument –db-instance-class in the CLI command to specify the DB instance class. For a free-tier account, we can use db.t2.micro having 1 vCPU and 1 GiB memory. I will specify value db.t2.micro for the –db-instance-class argument. You can refer to AWS docs to understand all Available DB Instance Classes.

我们可以在CLI命令中使用参数–db-instance-class来指定数据库实例类。 对于免费帐户,我们可以使用具有1个vCPU和1个GiB内存的db.t2.micro。 我将为–db-instance-class参数指定值db.t2.micro。 您可以参考AWS文档以了解所有可用的数据库实例类。

储存类型和大小 (Storage type and size)

AWS RDS SQL Server supports two storage types.

AWS RDS SQL Server支持两种存储类型。

  • General-purpose (SSD): It is useful for most of the workloads and provides up to 3000 IOPS. It is default storage provided for RDS and is cost-effective storage 通用(SSD):对于大多数工作负载有用,并提供高达3000 IOPS。 它是为RDS提供的默认存储,是经济高效的存储
  • Provisioned storage (SSD): it is suitable for IO intensive workloads 预置存储(SSD):适用于IO密集型工作负载

We can use a maximum of 16TiB of storage in any of the storage classes specified above. It uses a minimum of 20GiB of storage.

在上面指定的任何存储类中,我们最多可以使用16TiB的存储。 它至少使用20GiB的存储空间。

In the CLI command, we use the following arguments for storage class and size.

在CLI命令中,我们将以下参数用于存储类和大小。

  • –storage-type: specify Standard or GP2 for storage class –storage-type:为存储类指定标准或GP2
  • –allocated-storage: specify your storage size as per your database size. We specify the size in GiB unit –allocated-storage:根据数据库大小指定存储大小。 我们以GiB单位指定尺寸

虚拟私有云(VPC) (Virtual Private Cloud (VPC))

VPC is a networking component of the AWS. It is a crucial parameter while creating the RDS instance. In the below screenshot, we can see the default VPC for the new RDS instance.

VPC是AWS的网络组件。 在创建RDS实例时,它是关键参数。 在下面的屏幕截图中,我们可以看到新RDS实例的默认VPC。

  • Note: We cannot modify VPC after a database is created in AWS注意:在AWS中创建数据库后,我们无法修改VPC

We will use argument –vpc-security-group-ids for the RDS instance VPC.

我们将对RDS实例VPC使用参数–vpc-security-group-ids

子网组 (Subnet group)

Each VPC is associated with the subnet group. Specify the subnet group for your RDS instance using CLI argument –db-subnet-group-name

每个VPC与子网组关联。 使用CLI参数–db-subnet-group-name为RDS实例指定子网组

可公开访问 (Publicly Accessible)

By default, AWS RDS SQL Server allows connection to your database from the Amazon EC2 and other services inside your VPC. We can allow connections from outside VPC to allocate a public IP address to it. I want to connect my RDS from the laptop outside the VPC network, therefore change the configuration using the –publicly-accessible. If you do not want public access, you can use argument –no- publicly-accessible

默认情况下,AWS RDS SQL Server允许从Amazon EC2和VPC内的其他服务连接到数据库。 我们可以允许来自外部VPC的连接为其分配公共IP地址。 我想从VPC网络外部的笔记本电脑连接我的RDS,因此请使用–public-accessible更改配置 如果您不希望公共访问,则可以使用参数–no- public -accessible

DB参数组 (DB parameter group)

We can define a parameter group for the RDS instance. A parameter group is a set of SQL instance configurations. By default, RDS creates a default parameter group and assigns it to your instance. We cannot modify the default parameter group. You can create a new custom group with configurations and apply them to the DB parameter group.

我们可以为RDS实例定义一个参数组。 参数组是一组SQL实例配置。 默认情况下,RDS创建一个默认参数组并将其分配给您的实例。 我们无法修改默认参数组。 您可以使用配置创建一个新的自定义组,并将其应用于数据库参数组。

If you use a custom parameter group, you can use the argument –- DBParameterGroups to specify it.

如果使用自定义参数组,则可以使用参数-DBParameterGroups进行指定。

数据库选项组 (DB option group)

AWS RDS uses the option group to enable certain features such as integration service, reporting service. We can create a custom option group and assign it to the RDS instance using CLI argument –option-group-name.

AWS RDS使用选项组来启用某些功能,例如集成服务,报告服务。 我们可以创建一个自定义选项组,并使用CLI参数–option-group-name将其分配给RDS实例

自动备份和备份保留期 (Automatic backups and backup retention period)

AWS RDS SQL Server automatically takes the database backup and maintains for you as per defined backup retention period.

AWS RDS SQL Server自动进行数据库备份,并按照定义的备份保留期限为您维护。

We can choose the backup retention period as per our requirement. By default, RDS uses 7 days retention period. In the AWS CLI, we will use –backup-retention-period argument to specify the number of days (positive number only). For my demo RDS instance, I do not want any backups, so I specified the value as zero. The zero value in this argument tells RDS to disable automatic backups.

我们可以根据需要选择备份保留期。 默认情况下,RDS使用7天的保留期。 在AWS CLI中,我们将使用–backup-retention-period参数指定天数(仅正数)。 对于我的演示RDS实例,我不需要任何备份,因此我将该值指定为零。 此参数中的零值告诉RDS禁用自动备份。

时区 (TimeZone)

If you need a specific requirement for the time zone and collation, we can specify them while creating the RDS instance. By default, it uses Universal Coordinated Time (UTC).

如果您需要时区和排序规则的特定要求,我们可以在创建RDS实例时指定它们。 默认情况下,它使用世界标准时间(UTC)。

You can refer to the article, Local Time Zone for Microsoft SQL Server DB Instances for supported time zones and use –timezone to specify required time zone other than a default time zone.

您可以参考文章“ Microsoft SQL Server数据库实例的本地时区”以了解受支持的时区,并使用–timezone指定默认时区以外的所需时区。

We can combine the arguments for the CLI command rds create-db-instance and execute them to create a new AWS RDS SQL Server instance.

我们可以组合CLI命令rds create-db-instance的参数并执行它们以创建新的AWS RDS SQL Server实例。

>aws rds create-db-instance –engine sqlserver-ex –engine-version 14.00.3281.6.v1 –db-instance-identifier sqlserverrds –allocated-storage 20 –db-instance-class db.t2.micro –db-subnet-group default-vpc-9c710fe6 –master-username admin –master-user-password admin1234 –backup-retention-period 0 –storage-type standard –port 1433 –publicly-accessible –profile production

> aws rds create-db-instance –引擎sqlserver-ex –engine-version 14.00.3281.6.v1 –db-instance-identifier sqlserverrds –已分配存储20 –db-instance-class db.t2.micro –db-subnet-组default-vpc-9c710fe6 –主用户名admin –主用户密码admin1234 –备份保留期限0 –存储类型标准–端口1433 –可公开访问–配置文件生产

This command gives the output in a JSON format and returns all configurations with default and custom values for your RDS instance.

此命令以JSON格式提供输出,并返回RDS实例具有默认值和自定义值的所有配置。

Similarly, in the below screenshot we get configurations like MultiAZ, Engine version, read replica, option group.

同样,在下面的屏幕截图中,我们获得了诸如MultiAZ,引擎版本,只读副本,选项组之类的配置。

You can connect to the AWS web console and refresh the RDS dashboard. You can see that the new instance is being created.

您可以连接到AWS Web控制台并刷新RDS仪表板。 您可以看到正在创建新实例。

If you do not need this instance, you can select it and delete the instance from the Actions menu.

如果不需要此实例,则可以选择它并从“ 操作”菜单中删除该实例。

It asks you a confirmation, and you need to enter delete me keyword as a token of confirmation.

它要求您进行确认,您需要输入Delete me关键字作为确认令牌。

It starts deleting the AWS RDS SQL Server. It takes a few minutes, and after that, you can refresh the RDS dashboard. It removes the entry for deleted RDS.

它开始删除AWS RDS SQL Server。 这需要几分钟,然后,您可以刷新RDS仪表板。 它删除已删除的RDS的条目。

结论 (Conclusion)

In this article, we deployed a new AWS RDS SQL Server using AWS CLI commands. We simulated the web console RDS wizard with a similar argument of CLI. It is an excellent way to use the CLI command to be efficient, productive by saving time and deployment efforts.

在本文中,我们使用AWS CLI命令部署了新的AWS RDS SQL Server。 我们使用类似CLI的参数模拟了Web控制台RDS向导。 通过节省时间和部署工作,这是使用CLI命令高效高效的绝佳方法。

翻译自: https://www.sqlshack.com/deploying-an-aws-rds-sql-server-using-the-aws-cli/

aws rds监控慢sql

aws rds监控慢sql_使用AWS CLI部署AWS RDS SQL Server相关推荐

  1. aws rds监控慢sql_如何将AWS RDS SQL Server与AWS Glue连接

    aws rds监控慢sql This article gives you an overview of configuring AWS RDS SQL Server with AWS Glue ser ...

  2. aws rds监控慢sql_如何使用Web控制台和AWS CLI停止AWS RDS SQL Server

    aws rds监控慢sql This article explores the process to stop an AWS RDS SQL Server using web console and ...

  3. aws rds监控慢sql_使用AWS Lambda函数自动启动/停止AWS RDS SQL Server

    aws rds监控慢sql This article gives you an overview of the AWS Lambda function to automatically start a ...

  4. aws rds监控慢sql_估算AWS RDS SQL Server成本

    aws rds监控慢sql This article explores estimating the AWS RDS SQL Server cost so that you can plan reso ...

  5. aws rds监控慢sql_在AWS RDS SQL Server上使用SSIS包

    aws rds监控慢sql In the first part of the article, Explore SQL Server Integration Services (SSIS) on AW ...

  6. aws rds监控慢sql_使用本机备份的AWS RDS SQL Server迁移

    aws rds监控慢sql In this article, we will review how to migrate database from on-premises SQL Server in ...

  7. aws rds监控慢sql_将AWS S3存储桶与AWS RDS SQL Server集成

    aws rds监控慢sql This article gives you an overview of integrating AWS S3 buckets with AWS RDS SQL Serv ...

  8. aws rds监控慢sql_使用AWS Backup备份AWS RDS SQL Server数据库

    aws rds监控慢sql This article gives you an overview of creating backups of AWS RDS SQL Server database ...

  9. aws rds监控慢sql_在AWS RDS SQL Server上的SSAS中部署表格数据库

    aws rds监控慢sql In this article, we are going to explore Analysis Service for AWS RDS SQL Server in de ...

最新文章

  1. Scrapy源代码分析-经常使用的爬虫类-CrawlSpider(三)
  2. java加载xml配置文件_java读取配置文件的几种方法
  3. 在VS中设置比较和谐的字体和颜色的方法
  4. azure_Azure Analysis Services中的动态分区(表格)
  5. 移动应用测试基于JAVA_Appium用于测试Android混合移动应用程序
  6. 吉林大学计算机学院换届,CCF吉林大学学生分会举行换届选举会议-中国计算机学会...
  7. html简单网页代码
  8. 毕业季音乐计算机简谱,毕业季简谱(歌词)-贺敬轩演唱-桃李醉春风记谱
  9. 模电七:集成运算放大器(上)
  10. Leetcode 20有效的括号、33搜索旋转排序数组、88合并两个有序数组(nums1长度为m+n)、160相交链表、54螺旋矩阵、415字符相加(不能直接转Int)、reverse()函数
  11. php汉字大写金额,php 数字金额转中文汉字大写金额
  12. OSChina 周三乱弹 —— 我居然在 osc 里追剧
  13. 微信聊天记录删除了怎么恢复?最简单快捷的恢复方式看这里
  14. oeasy教您玩转linux 010211 牛说 cowsay
  15. 微信服务号菜单栏跳转网页配置方法(非接口写法)
  16. php导出数据库为excel文件,phpexcel导出数据库成excel文件
  17. 氮化物 聚多巴胺修饰六方氮化硼|铁颗粒周期性填充的竹节状氮化硼纳米管|纳米氮化硼(BN)包覆的Al2O3复合粉|铜纳米线填充氮化硼纳米管
  18. Redis分片入门案例
  19. 全国电费充值优惠接口源码
  20. 软件开发可行性分析九个流程的理解

热门文章

  1. macOS 10.15安装GDB
  2. 【洛谷新手村】简单字符串 p1055 ISBN号码
  3. 小小知识点(九)——拉盖尔高斯波束自由空间傍轴近似条件下的复振幅
  4. Expm 1_2 实现快速排序的算法,并尝试采用不同的方法实现线性的划分过程.
  5. MySQL-数据操作-增删改查
  6. 【ARM-Linux开发】libxml/parser.h: 没有那个文件或目录解决方案
  7. AJAX JSONP源码实现(原理解析)
  8. ES6——函数的name属性
  9. LeetCode(1009)——十进制整数的反码(JavaScript)
  10. LeetCode(693)——交替位二进制数(JavaScript)