what is the Key Value pair to define Replication Factor in the json object - ravendb

-d '{"DatabaseName": "DB_Name", "ReplicationFactor": "3"}'
The replication factor key value pair seems to be wrong and CURL command ignores this value while creating a database and sets the replication factor to 1.
Please tell me know the correct Key value name to define replication factor.
Thanks

Related

redis how to get first key-value pair of hash map

I would like to have something like the following table in redis.
host name
back queue
stanford.edu
23
microsoft.com
17
As far as I know, the best way to implement this is to use redis hashes (with host name as key and back queue as value). However, in my use case, I also want to get the first key-value pair present in the hash map.
How can this be implemented? Are there any redis datatypes specifically for this?

Add Version/Flavor to Keys in Redis

We are storing path's to data in redis as following:
KEY: `/pathOfUniqueAsset/v11/`
VALUE: `/disk1/pathOfUniqueAsset/path/v/11/`.
As you can see, the v which stands for version, will grow over time. I was wondering if there is a way to store flavors/versions of a key/value pair?
You can use a Hash instead of a String, as the key's value type. In the Hash, you can have a field per version/flavor and have the value as the associated path.
E.g.:
HSET /pathOfUniqueAsset v11 /disk1/pathOfUniqueAsset/path/v/11/
What are you trying to achieve? Do you need to keep older versions? If not, overwrite the key. If yes, what would 'version' of the key give you? You already know your version from the key. If you arrange your keys as pathOfUniqueAsset.v11, you can later issue KEYS pathOfUniqueAsset.* (or better SCAN) to get all versions. This way you can set EXPIRE individually. If you'll use HSET like #ItamarHaber suggests you can only delete values manually, but iterating a set is much faster than KEYS lookup (EDIT: actually, it depends on some factors, mostly the amount of other keys).
If you instead want a list of assets for each version kept together, you can use dedicated set of all keys associated to this version. Like
SET /pathOfUniqueAsset/v1 ...
HSET assets.v1 pathOfUniqueAsset /pathOfUniqueAsset/v1

Copy one key from one redis instance to another

I have a Redis implementation with 6 nodes (3 masters 3 slaves - cluster enabled). I have load in every master an amount of keys.
So, my question is:
Is it possible to actual copy one key from 127.0.0.1:30001 to 127.0.0.1:30002?
For example lets say that my key has the name "testkey". If i copy this key from 30001 to 30002, when i want to get the key from 30001 or from 30002 the response must fetch the value of "testkey" in both calls.
No, that not how it works.
Keys in the cluster are assigned to hash slots and slots are assigned to master nodes. The keys' assignment is done by hashing their names (or the hash tag in them) so it is consistent, meaning that a given key name always hashes to the same slot.
A key can exist only once in the keyspace, but the slot it belongs to can be moved between masters. To scale reads from that key you can use the slave of the applicable master.
A good point to start understanding how the cluster works is by referring to the [tutorial](https://redis.io/topics/cluster-tutorial].

How to implement using NHibernate UInt64 identifier generator with the option to set its initialize value

Is it possible to use NHibernate for getting unique identifier of type: UInt64.
The initialize value of this property must be unique (for more than 1 DB).
The usage: I need to get this value and increment it by 1.
This action should be a closed transaction.
usually we want to have unique keys in one DB, not for multiple databases, GUIDs are used there as far as I know. Getting the max(int64) out of both DBs and then picking the largests and adding 1 will work but that sounds rather clumsy I think? What do you need this for actually?
Hope this helps,
What about using database identities (or similar) and setting the starting value for database N as N, and the increment by value (how much you add to the current latest key every time you get a new one) equal to the number of databases?
That way each database should keep a distinct set of ids. Only problem would be in case you need to add a new database to the set.

Redis: Is it possible to get just one value of a Set by its key?

I have a Set named 'Projects' with many key-value pairs and I want to retrieve one of the values by providing its key. I checked the redis doc but I only found how to retrieve the entire Set. Is it possible to just retrieve one value by providing its key?
Your concept of Set does not match Redis'.
All members of a set in Redis are stored in a single key. Therefore you can't access members individually by a key.
You should use hashes: http://www.redis.io/commands#hash
HSET key field value does what you are looking for.