Tag Archives: nosql

Notes on Redis DB

  • Redis provides atomic operations on keys
  • Keys can have TTL (-2 expired, -1 never expire, n seconds to expire)
  • Values are stored as a list.
    • The list is indexed and can be queried with ranges.
  • List items can be popped, Left/Right pushed.
  • Values can also be stored as set.
    • Set operations: add, remove, is_member, members, union
  • Values also support sorted sets, using a user defined sorting key
  • Another value type is Hashed values.
    • key : {key: value, key:value}
    • HSET user name "test" address "earth"
    • HGET user name
    • Atomic operations are available on hash values too.
  • Keys can optionally follow a schema.
    • usr:123:id
    • An O(N) search is possible on a prefix of the key

Reference

Advertisements

Mongo DB: Good to know things

  • Mongo DB is a No-SQL, free, open-source solution that is highly scalable, highly available and high performance solution.
  • Engine is coded in C++
  • Works in a client-server model
  • Major components:
    • mongod: The storage server
    • mongos: The sharding server
    • config server(s):
      • Stores metadata that accomplish sharding
      • Is actually a mongod process
  • Mongo provides write operations durability with journaling (write ahead logging)
  • User data is seen as a database of collection of records
    • Collection is roughly similar to a table in RDBMS
    • Record could be map to a row in a table (incorrect but helps understanding)
  • Mongo stores data in BSON format (on-wire and on-disk)