dongli564510 2011-11-03 03:10
浏览 74

如何处理用户对可以访问多个数据库的应用程序的访问权限

I am considering a way of taking an existing php and mysql application that was developed for use in-house (and thus has a single database with nothing built in in terms of multi-tenancy).

I figured that it's possible and maybe in some way better to run each client of their own database. What I want to know is how best to handle the login of a user given the credentials supplied could be in any one of the databases and in some cases possibly multiple databases.

I had thought along the lines of iterating through each database and checking for valid credentials. If the credentials exist in multiples then return a list that the user chooses from, or if it exists only once then just logging in.

Is that a valid solution? Will it start to perform badly IF the application was to expand to have thousands of users across hundreds of databases?

  • 写回答

1条回答 默认 最新

  • dongwo8827523 2011-11-03 04:45
    关注

    I recommend installing a different instance of the app for each client, with their own database.

    Each client should be given their own url to access the app, instead of having them all access in from 1 location, but pointing to multiple databases.

    This will adress a few problems that you might encounter if you run all your clients from 1 location (multiple databases)

    1. What happend if the different client has accounts with the same name? Which account will take precedence?
    2. What happens if the client want to take over the app and host it seperately from the rest of the clients. How can you easily seperate out this client into a sepetare installation?

    Another point to note, connecting and disconnecting to databases are expensive. If you have to do so 100 times when the user logs in to find out which database that user is in. It might bogg down the system or your database server.

    评论

报告相同问题?

悬赏问题

  • ¥15 Fluent udf 编写问题
  • ¥15 求合并两个字节流VB6代码
  • ¥15 Pyqt 如何正确的关掉Qthread,并且释放其中的锁?
  • ¥30 网站服务器通过node.js部署了一个项目!前端访问失败
  • ¥15 WPS访问权限不足怎么解决
  • ¥15 java幂等控制问题
  • ¥15 海湾GST-DJ-N500
  • ¥15 氧化掩蔽层与注入条件关系
  • ¥15 Django DRF 如何反序列化得到Python对象类型数据
  • ¥15 多数据源与Hystrix的冲突