如何维护生产和开发者数据库?
在一台机器上工作时,如何维护单独的生产数据库和开发人员数据库,并且可以透明地切换? 我见过一些相近的主题,但似乎没有一个匹配。
How would you maintain separate production anddeveloper databases when working on one machine, which you can toggle transparently? I've seen some close subjects but none of them seem to match.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
呼叫一名数据库产品人员和一名开发人员。 使用一组不同的用户名/密码对进行生产和开发。
您可以切换连接字符串和 更改数据库、用户名和密码。
Call one database prod and one dev. use a different set of username/password pair for production and development.
You can toggle the connection string & change the database, username and password.
理想情况下,生产环境不应与开发环境位于同一主机上(因此任何意外的长时间运行或密集查询都不会影响生产)。
我过去使用的一种方法是同时需要 QA 环境和开发环境,即使用 SQL Server 的不同实例,这具有额外的优势,即数据库间查询相对“安全”,并且不需要在环境之间进行更改; 然后根据需要使用不同的配置文件。
Ideally the production environment shouldn't be on the same host as the development environment (so any accidentally long running or intensive queries don't take down production).
One approach I've used in the past where I needed a QA environment and a development environment side-by-side, was to use different instances of SQL Server, which had the added advantage that inter-database queries were relatively "safe", and didn't need changing between environments; Then just have different config files as appropriate.
我通常看到这通过两种方式之一完成。
使用两个配置文件,并根据需要简单地重命名它们以启用每个环境
在
我个人更喜欢第二个选项,因为我发现第一个选项很容易意外出现在生产数据库中。
I typically see this done one of two ways.
Use two configuration files, and simply rename them as needed to enable each environment
Use two copies of the application/website on the machine, one that is production one that is dev.
I personally prefer the second option, as I find that the first one makes it WAY too easy to accidentally be on the production database.