HW 2 – Key-value data stores. Redis

(5 points)

  1. Design the data structures based on the analytical tasks (see HW 1) that are intended to be solved with Redis.
    • The structures must be designed so that the target queries are feasible.
    • Use native Redis data types (HASH/SET/ZSET/STREAM; BITMAP/HLL if needed). Avoid storing everything as plain strings/JSON.
  2. Insert the data into Redis from the dataset produced in HW 0 (CSV/JSON).
    • Select and import only the subset/fields strictly required to execute your Redis tasks (do not import unnecessary data).
    • Document the selection/transformation rules (filters, projections, denormalization) so the same subset can be reproduced.
    • The import script must be idempotent: repeated runs must not create duplicates.
  3. Implement and run the queries (see HW 1).
  4. Prepare a report and include:
    • the text from HW 0 and HW 1 (edited if necessary);
    • the structure-creation commands with explanations of why these structures were chosen;
    • the data import code;
    • the queries used to solve the analytical tasks. For each task, provide:
      • the task number (as in the HW 1);
      • the verbal description of the task;
      • the command(s) with a short explanation;
      • a screenshot of the query result.

Note. If some analytical tasks turn out to be infeasible under Redis’ data model or performance constraints, replace them with other meaningful tasks and propagate the corresponding changes to the earlier work (HW 0/HW 1).

Submit to the BRUTE system:

  • HW2.docx file.
  • hw2_redis.py — Python script for subset extraction/transformation and/or import (idempotent; uses the HW 0 dataset as the only source).

Submit a hw2_redis.txt file containing Redis commands with short comments to the NoSQL server nosql.felk.cvut.cz.

  • Execute the following shell command to evaluate the whole REDIS script
    • cat $ScriptFile | redis-cli -p $Port -a $Password
    • $ScriptFile is a file with REDIS commands to be executed, i.e. hw2_redis.txt
    • $Password is an initial password (see the first email)
  • If you cannot connect to your Redis instance remotely, create an ssh tunnel first:
    • ssh -L $Port:127.0.0.1:$Port $Username@nosql.felk.cvut.cz
    • Then from your local device you can connect to redis on localhost (127.0.0.1) using your port and password, e.g.:
    • redis-cli -h 127.0.0.1 -p  $Port -a  $Password
  • Your script will be tested on the server. Before submitting it, run the code and check if it works.
courses/be4m36ds2/homework/hw2.txt · Last modified: 2025/09/21 18:41 by prokoyul