如何以最小的应用程序影响从MySQL“切换"到Amazon RDS? [英] How to 'switch' from MySQL to Amazon RDS with minimal application impact?

查看:66
本文介绍了如何以最小的应用程序影响从MySQL“切换"到Amazon RDS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Amazon正式声明:"Amazon RDS使您能够访问熟悉的MySQL数据库的全部功能.这意味着您今天已经在现有MySQL数据库中使用的代码,应用程序和工具可与Amazon RDS无缝地协同工作."

我不明白这一点.可以通过Web服务访问Amazon RDS,那里有一个客户端库(如.Net的客户端库).

因此,如果我有一个使用DAL的现有.Net应用程序,而DAL又查询了MySQL,我该如何通过Web服务与Amazon RDS进行相同的DAL对话.还是我在这里想念东西?

解决方案

Amazon RDS是纯MySQL,可通过您的应用程序访问,与其他任何MySQL数据库相同. RDS的Web服务接口仅用于创建,删除和修改数据库实例,而不是数据库数据.从他们的常见问题解答:

问:如何访问正在运行的数据库 实例?

一旦数据库实例可用, 你可以找回它 通过DescribeDBInstance的端点 API.使用此端点,您可以 构造连接字符串 直接与您连接所需 使用您喜欢的数据库实例 数据库工具或编程语言. 为了允许网络请求 您正在运行的数据库实例,您将 需要授权访问.为一个 详细说明 构造您的连接字符串并 开始使用,请参考我们的 入门指南.

是您需要的《入门指南》的一部分-它说明了如何获取新实例的主机名,以便您可以连接到该实例,授权该实例以从客户端进行访问,然后使用MySQL命令行客户端进行连接(例如):

$ rds-describe-db-instances --headers
$ rds-authorize-db-security-group-ingress default --cidr-ip 192.0.2.0/30 --headers
$ mysql -h myinstance.crwjauxgijdf.us-east-1.rds.amazonaws.com -P 3306 -u mymasteruser -p

Amazon officially states: "Amazon RDS gives you access to the full capabilities of a familiar MySQL database. This means the code, applications, and tools you already use today with your existing MySQL databases work seamlessly with Amazon RDS."

I don't get this. Amazon RDS is accessible via web services and there a client libraries (like the one for .Net).

So if I have an existing .Net application that uses a DAL which in turn queries MySQL, how can I make the same DAL talk to the Amazon RDS (via the web services). Or am I missing something here?

解决方案

Amazon RDS is pure MySQL, accessible by your app the same way as any other MySQL database; the web services interface to RDS is purely for creation, deletion, and modification of the DB instances, not the DB data. From their FAQ:

Q: How do I access my running DB Instance?

Once your DB Instance is available, you can retrieve its endpoint via the DescribeDBInstance API. Using this endpoint you can construct the connection string required to connect directly with your DB Instance using your favorite database tool or programming language. In order to allow network requests to your running DB Instance, you will need to authorize access. For a detailed explanation of how to construct your connection string and get started, please refer to our Getting Started Guide.

This is the part of the Getting Started Guide you need -- it explains how to get the hostname of your new instance so you can connect to it, authorize the instance for access from the client, and then connect using the MySQL command-line client (as an example):

$ rds-describe-db-instances --headers
$ rds-authorize-db-security-group-ingress default --cidr-ip 192.0.2.0/30 --headers
$ mysql -h myinstance.crwjauxgijdf.us-east-1.rds.amazonaws.com -P 3306 -u mymasteruser -p

这篇关于如何以最小的应用程序影响从MySQL“切换"到Amazon RDS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆