如何为每个用户单独在服务器上启动Cassandra

时间:2022-08-11 04:49:52

Sorry, I'm a newbie to databases and am using Cassandra mainly to collect and store statistics from my simulations that I'm running. Basically I have a logger which stores the collected statistics into a Cassandra database.

对不起,我是数据库的新手,我正在使用Cassandra来收集和存储我正在运行的模拟中的统计数据。基本上我有一个记录器,它将收集的统计信息存储到Cassandra数据库中。

At this moment, I have one version of Cassandra running on my server. I started it as a service. I have couple of users that are running simulations on the server at the same time. With one instance of Cassandra as a service running on the server, all logs are stored in the same database. However I was hopeful that each user once starts running simulations, also starts his/her own copy of Cassandra and once done, stop Cassandra.

此时,我的服务器上运行了一个版本的Cassandra。我把它作为一项服务开始。我有几个用户同时在服务器上运行模拟。将Cassandra的一个实例作为服务器上运行的服务,所有日志都存储在同一个数据库中。然而,我希望每个用户一旦开始运行模拟,也开始他/她自己的Cassandra副本,一旦完成,停止Cassandra。

Is that something that can be done with Cassandra? I understand I'm somewhat changing the use case for Cassandra, but wondering if that can be done.

这是可以用Cassandra完成的吗?我知道我在改变Cassandra的用例,但想知道是否可以这样做。

BTW, the main reason for using Cassandra is that I can't have the same schema for all different logs and statistics that are generated. So sql-based databases were not options for me.

顺便说一句,使用Cassandra的主要原因是我不能为生成的所有不同日志和统计信息使用相同的模式。所以基于sql的数据库不是我的选择。

1 个解决方案

#1


2  

The problem as you describe it is overkill for Cassandra - it's designed for building distributed database, running on multiple servers. If you just need "local" key-value store you can look into RocksDB, or something like.

您描述的问题对于Cassandra来说是过度的 - 它设计用于构建在多个服务器上运行的分布式数据库。如果您只需要“本地”键值存储,您可以查看RocksDB或类似内容。

If you still need to stick to Cassandra, you have several options:

如果你仍然需要坚持Cassandra,你有几个选择:

  • Have Cassandra running all the time, but give every user separate keyspace (if you need several tables inside it), or table (if data is in the single table). These keyspaces/tables could be removed after emulation finishes;
  • 让Cassandra一直运行,但是为每个用户提供单独的键空间(如果你需要几个表)或表(如果数据在单个表中)。模拟完成后,可以删除这些键空间/表;

  • Run Cassandra in the Docker container - in this case, every user gets the dedicated instance, but machine will need more resources if you run multiple simulations at the same time.
  • 在Docker容器中运行Cassandra - 在这种情况下,每个用户都获得专用实例,但如果您同时运行多个模拟,则机器将需要更多资源。

#1


2  

The problem as you describe it is overkill for Cassandra - it's designed for building distributed database, running on multiple servers. If you just need "local" key-value store you can look into RocksDB, or something like.

您描述的问题对于Cassandra来说是过度的 - 它设计用于构建在多个服务器上运行的分布式数据库。如果您只需要“本地”键值存储,您可以查看RocksDB或类似内容。

If you still need to stick to Cassandra, you have several options:

如果你仍然需要坚持Cassandra,你有几个选择:

  • Have Cassandra running all the time, but give every user separate keyspace (if you need several tables inside it), or table (if data is in the single table). These keyspaces/tables could be removed after emulation finishes;
  • 让Cassandra一直运行,但是为每个用户提供单独的键空间(如果你需要几个表)或表(如果数据在单个表中)。模拟完成后,可以删除这些键空间/表;

  • Run Cassandra in the Docker container - in this case, every user gets the dedicated instance, but machine will need more resources if you run multiple simulations at the same time.
  • 在Docker容器中运行Cassandra - 在这种情况下,每个用户都获得专用实例,但如果您同时运行多个模拟,则机器将需要更多资源。