我正在制作一个SaaS应用程序,用户可以在其中创建广告列表。
I am making a SaaS application in which users will create advertisement listings.
我从未进行过用户和数据管理wrt数据库,所以我需要有关如何实现它的建议(我承认这是一个开放性问题,但是我仍然觉得它很重要,因为还有其他地方可以问我!!)
I have never done user and data management w.r.t. a database so I need advice on how I should implement it (I acknowledge that this is an open question but I still feel it is relevant as where else could I ask!!)
我的数据库是 cassandra 。
- 我正在考虑对所有广告使用单个键空间来寻址第1点
- 我正在考虑为将存储其广告的每个用户创建一个专用键空间(point#2,point#3 和point#4)。
- 如果用户编辑/删除广告,则需要更改用户特定的键空间和所有广告的全局键空间
问题1-我的方法是创建此类应用程序的常用方法吗?如果不是这样,我将对替代设计的建议表示赞赏。
Question 1 - Is my approach the usual way of creating such an application? If not, I'll appreciate suggestions on alternate designs.
问题2-在创建用户特定的键空间时,我能够以编程方式创建键空间(用户提供的用户名和密码)作为我的Web注册过程的一部分?
Question 2 - As I'll create user specific keyspaces, would I be able to programatically create a keyspace (with user's provided username and password) as part of my web signup process?
推荐答案在Cassandra中每个用户的键空间都不是一个好主意,这只有在有几个用户的情况下才有效。各个键空间意味着您要为每个用户创建一个单独的表格,因此这与要点1相矛盾-显示要从所有表格中读取的所有广告。而且Cassandra在支持的表数方面也有限制-群集中建议的值不要超过500表(请参见此答案以了解更多详细信息)。
It's not good idea to have per user keyspace in Cassandra, this will work only if you have a couple of users. The individual keyspaces will mean that you're creating a separate tables for every user, so it will contradict the point 1 - to show all advertisements you'll need to read from all of tables. And Cassandra also has limitations on number of tables that it can support - recommended values are not more 500 tables in cluster (see this answer for more details).
我建议仅将用户ID用作分区键或分区键本身的一部分-但这取决于其他因素,例如用户可以创建多少个广告,等等。-这需要单独问题。
I recommend just to put user ID as a part of the partition key, or partition key itself - but this will depend on the other factors, like, how many advertisements can user create, etc. - this requires a separate question.
我建议在 DataStax学院只是为了更好地了解如何为Cassandra建模数据。
I suggest to take DS220 course on Cassandra data modelling at DataStax Academy just to get better understanding how to model data for Cassandra.
更多推荐
我应该如何在Cassandra中实现数据访问/权限管理
发布评论