sharding

Which of the following data duplication options across shards is recommended?

蓝咒 提交于 2019-12-12 02:54:16
问题 High performance mysql book suggests that for sharding a blog application, one may want to put comments data across 2 shards: first, on the shard of a person posting comment, and on the shard where the post is stored. So this raises the question how to reliably duplicate this data. Which of the following data duplication options across shards is recommended? Option 1: Make 2 separate inserts from the PHP script. Pros: a) Logic is in application layer. Cons: a) User is held for 2 inserts. b)

Is it possible to query for a range of hashes of a hashed indexed key in mongodb?

╄→гoц情女王★ 提交于 2019-12-12 02:48:20
问题 I have a hashed based sharding enabled for a key "userId" in a mongodb collection. Is it possible to get all documents whose hashed values of "userId" are between, let's say, "abcd" and "cdef"? Thanks! 回答1: One way that I found is to use the following query: db.mycollection.find({ "$and": [ {_id: {"$gt": -5012941854059245285}}, {_id : {"$lt": -4712634714892678072}} ]}).hint({_id: "hashed"}) where the long numbers are hashed values of _id. It works for me, but is it the best way of doing so?

how to execute read only query on sharded replica set in mongodb

不想你离开。 提交于 2019-12-11 23:16:52
问题 Consider following configuration - 2 Shard server each has 1-replica set (say rs0 and rs1). 3 config server and 1 query router (mongos) The above sharding configuration is working fine. But, i want to execute read-only query from sharded replica set (from secondary of rs0 and rs1). Since, the mongodb data are exists in both replica set rs0 and rs1. So, how to configure this, to fetch the data from both secondary of rs0 and rs1?. 回答1: Your sharding setup should not impact the use of read

How configuring access to a sharded collection in spring-data for mongo?

谁说我不能喝 提交于 2019-12-11 19:17:41
问题 I was wondering how to configure sharding in a spring config file. I took a look at this post http://krams915.blogspot.com.es/2012/02/mongodb-replica-sets-with-spring-data_9536.html and seems to work for a single replica set. But in case you have a sharding envrionment with several replica set, mongos instances, ..., is spring-data currently supporting this? Regards. 来源: https://stackoverflow.com/questions/20647829/how-configuring-access-to-a-sharded-collection-in-spring-data-for-mongo

Solr deletes already created shards when changing memory size

旧巷老猫 提交于 2019-12-11 15:28:36
问题 I am using solrcloud in 5.5.5 version. I have created a collection with two shards with default memory size of 512m. Then my shards got huge data from other system. Now I have 1.2 million documents. I got out of memory error. So I increased SOLR_HEAP (SOLR_HEAP="2g") in solr.in.sh file. After some time, I have noticed that, two created shards got removed from disk. Please anyone have idea about this 来源: https://stackoverflow.com/questions/54240237/solr-deletes-already-created-shards-when

How to replace node in sharded replica set?

蹲街弑〆低调 提交于 2019-12-11 12:08:18
问题 I got sharded mongodb setup with two replica sets: mongos> db.runCommand( { listShards : 1 } ) { "shards" : [ { "_id" : "rs01", "host" : "rs01/10.133.250.140:27017,10.133.250.154:27017" }, { "_id" : "rs02", "host" : "rs02/10.133.242.7:27017,10.133.242.8:27017" } ], "ok" : 1 } Node 10.133.250.140 just went down, and I replaced it with another one (ip-address changed). Replica set reconfiguration was pretty easy, just rs.remove() and rs.add() Now I have to update host config for shard rs01.

Sharding in MongoDB

房东的猫 提交于 2019-12-11 11:38:46
问题 I try to test sharding in MongoDB. For example, I use host1.com and host2.com instead real server names. So I created config server at host1.com: mongod --dbpath /path/to/configdb/ --configsvr Started mongos at the same machine: mongos --configdb host1.com --port 27020 And started mongod at two machines (host1.com and host2.com): mongod --dbpath /path/to/test_shard_db/ --shardsvr I added shards, enabled sharding for database test and collection test with shard key {'name': 1} (collection has

Kinesis max shard reads/sec and multiple consumers

≡放荡痞女 提交于 2019-12-11 06:46:31
问题 So I have a AWS Kinesis stream where I publish events for multiple consumers. It is important for most of them to receive hot data - which means that many of them will possibly poll and read the latest data at the same time. According to the AWS documentation increasing the number of shards will increase the level of parallelism while the number of reads/sec can be max 5/sec per shard. My question is whether (and how?) would adding more shards help the situation where all my consumers are up

Sharding key (MongoDB) for large number documents

孤者浪人 提交于 2019-12-11 05:22:57
问题 I am developing a web application where users will be uploading a large number of documents to the system and different types of operations will be performed on the documents, including aggregation. However the number of documents uploaded by each user varies widely - some might upload a dozen documents, and some might upload a million documents. documents look something like this: doc{ _id: <self generated UUID>, uid: <id of user who uploaded the document>, ctime: <creation timestamp>, ....

MongoDB shard by date on a single machine

主宰稳场 提交于 2019-12-11 03:57:13
问题 We have started with one single mongodb but no we have one collection grown to ~300GB. The collection contains objects which have a date field. But mostly we just need to query the more recent objects then the historic once. So my question is: is it possible to shard this collection on one server by a date field? More explicitly I would like to shard more recent objects into one node and older objects into another node. Instead of equally distributing all the objects on n shards. And is there