问题标签 [sharding]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
951 浏览

database - Propel 中的数据库分片支持

只是想知道 Propel 对数据库分片的支持有多好?我正在考虑用 PHP 创建我的应用程序,使用 MySQL 作为数据库服务器,Propel 作为 ORM。

我发现最好从一开始就保持架构的可扩展性,以防我的应用程序起飞。

你怎么看?

0 投票
5 回答
3968 浏览

database - 如何在分片数据库中创建唯一的行 ID?

在非分片数据库中,我可以只使用自动增量来生成唯一 ID 来引用特定行。

我想对我的数据库进行分片,比如分成 12 个分片。现在,当我插入特定分片时,自动增量 ID 不再是唯一的。

想听听任何人处理这个问题的经验。

0 投票
2 回答
6642 浏览

mysql - 用于数据库分片的 MySQL 代理替代方案

MySQL 代理是否有任何替代方案。我不想使用它,因为它仍处于 alpha 阶段。

我将有 10 个 MySQL 服务器,其中 table_1 table_2 table_3 table_4 ... table_10 分布在 10 个服务器上。每个表的结构都是相同的,它们只是具有不同数据集的分片。

是否有 MySQL 代理的替代方案,我可以让我的客户端应用程序连接到单个 SQL Server(代理),它查看查询并代表它获取数据。

例如,如果客户端从 Proxy 请求“SELECT * FROM table_5 WHERE user=123”,它连接到包含 table_5 的第 5 个 SQL Server 并获取数据?

0 投票
1 回答
1395 浏览

java - 如何使用 Java 确定 Google AppEngine 数据存储中的给定键是否存在对象?

我正在尝试将分片计数器示例 (code.google.com/appengine/articles/sharding_counters.html) 移植到 Java。唯一的问题是 Java API 没有类似于 Python 的“get_by_key_name”的调用。这是基本思想:

不幸的是,这在我第一次运行它时会引发 JDOObjectNotFoundException。我可以运行查询以确定给定名称的计数器是否存在,但这不是事务性的。另一个线程可以做同样的事情,最后两者都会创建一个具有相同键的对象。

据我了解,事务中支持的唯一操作(对于 Java API)是 get 和 put。那么我如何才能通过键锁定一个尚不存在的对象(即没有'get')并确保我是第一个也是唯一一个创建它的对象?

0 投票
4 回答
15126 浏览

postgresql - 在 postgresql 中水平分片的好方法是什么

在 postgresql 中水平分片的好方法是什么

这是使用分片的更好方法

也可以在不更改客户端代码的情况下进行分区

如果有人可以分享一个关于如何设置和使用分片的简单教程或食谱示例,那就太好了

0 投票
1 回答
227 浏览

sharding - 有关于作业排队和数据库分片的好的链接/文章吗?

有没有人有关于如何/何时/为什么使用作业队列来扩展 Web 应用程序的良好链接?此外,关于 db 分片的文章也会很有用 :)

0 投票
2 回答
1195 浏览

sharding - 我将如何了解有关网站分片用户数据的更多信息?

我对跨多个服务器分片我的网站用户数据感兴趣。

例如,用户将从同一个地方登录。但是登录脚本需要弄清楚用户数据所在的服务器。因此,登录脚本将查询主注册表以获取该用户名,并可能返回它在服务器 B 上。然后登录脚本将连接到服务器 B 并验证用户名/密码。那有意义吗?拥有像主注册表这样的东西来解决数据所在的位置是否正常?

另外-我已经搜索过,但我没有找到关于分片的教程/信息/策略的运气。如果您知道有关该主题的任何在线资源,如果您愿意分享,我将不胜感激,以便我进行自我教育。谢谢!

0 投票
3 回答
507 浏览

database - 具有离线访问的分布式键值数据存储(静态分区)

需要能够将复制所有信息的服务器设置为拥有所有数据的主数据存储。

还需要专门存储/复制本地 LAN 中可用的某些数据的服务器,以便当互联网连接中断时,他们仍然可以访问其本地数据。正常情况下,客户端会从本地局域网访问大部分数据,当本地局域网服务器宕机时,可能会使用其他数据。

这与分布式数据存储的好处(例如抗故障性和速度)一起需要。

哪种分布式键值数据存储或其他数据存储方法最适合这种情况?

0 投票
8 回答
38624 浏览

sql-server - How do I speed up deletes from a large database table?

Here's the problem I am trying to solve: I have recently completed a data layer re-design that allows me to load-balance my database across multiple shards. In order to keep shards balanced, I need to be able to migrate data from one shard to another, which involves copying from shard A to shard B, and then deleting the records from shard A. But I have several tables that are very big, and have many foreign keys pointed to them, so deleting a single record from the table can take more than one second.

In some cases I need to delete millions of records from the tables, and it just takes too long to be practical.

Disabling foreign keys is not an option. Deleting large batches of rows is also not an option because this is a production application and large deletes lock too many resources, causing failures. I'm using Sql Server, and I know about partitioned tables, but the restrictions on partitioning (and the license fees for enterprise edition) are so unrealistic that they are not possible.

When I began working on this problem I thought the hard part would be writing the algorithm that figures out how to delete rows from the leaf level up to the top of the data model, so that no foreign key constraints get violated along the way. But solving that problem did me no good since it takes weeks to delete records that need to disappear overnight.

I already built in a way to mark data as virtually deleted, so as far as the application is concerned, the data is gone, but I'm still dealing with large data files, large backups, and slower queries because of the sheer size of the tables.

Any ideas? I have already read older related posts here and found nothing that would help.

0 投票
1 回答
480 浏览

python - 当一个人创建一个新模型时,应该在哪里放置代码以在 Google App Engine/Django 上自动增加一个分片计数器?

我有一个模型 MyModel(扩展了 Google 的 db.Model),我想跟踪已创建的模型数量。

我认为 Google I/O talk on Sharding Counters中的代码非常好,所以我正在使用它。但是我不确定在创建新代码时应该在哪里调用增量。(我使用的是 Django,并且我将熟悉的 models.py、views.py 等布局保留到项目的应用程序中。)

对于将递增代码放在哪里,似乎有几种可能性:

  1. 重载 Model.put() 以便在第一次保存模型时递增计数器,并类似地重载 Model.delete() 以递减计数器

  2. 将某种监听器附加到保存/删除,并检查保存是否为新模型(GAE 是否有这样的监听器?)

  3. 将计数器递增代码放入创建/删除模型的 view.py 函数中

我非常愿意就如何做到最好(以及每个选项的优缺点)提出建议和想法。

感谢您的阅读。

最好的,布赖恩