我应该如何在Cassandra中实现数据访问/权限管理

编程入门 行业动态 更新时间:2024-10-27 00:34:50
本文介绍了我应该如何在Cassandra中实现数据访问/权限管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在制作一个SaaS应用程序,用户可以在其中创建广告列表。

I am making a SaaS application in which users will create advertisement listings.

  • 我注册的所有用户都应可以看到所有广告用户和未注册的访问者
  • 只有注册用户才能创建广告
  • 注册用户可以创建多个广告
  • 只有创建广告的用户才可以删除或编辑它。
  • All advertisements should be visible to all users of my registered users as well as unregistered visitors
  • Only registered users can create an advertisement
  • A registered user can create several advertisements
  • Only the user who creates the advertisement should be able to delete or edit it.
  • 我从未进行过用户和数据管理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中实现数据访问/权限管理

    本文发布于:2023-10-11 13:43:59,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1481861.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:权限   数据   如何在   Cassandra

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!