0% found this document useful (0 votes)
177 views6 pages

Redis Course Credit 6

The default persistence mode in Redis is RDB. The best way to achieve persistence is AOF. The configuration setting that specifies the file where the RDB snapshot is saved is the filename. Redis hashes store key value pairs. ZRANGEBYEX is not a command of sorted sets. DISCARD is used to flush the transaction queue and exit from the transaction.

Uploaded by

uncos Story
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
177 views6 pages

Redis Course Credit 6

The default persistence mode in Redis is RDB. The best way to achieve persistence is AOF. The configuration setting that specifies the file where the RDB snapshot is saved is the filename. Redis hashes store key value pairs. ZRANGEBYEX is not a command of sorted sets. DISCARD is used to flush the transaction queue and exit from the transaction.

Uploaded by

uncos Story
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Which is the default persistence mode in Redis?

RDB

Which is the best way to achieve persistence in Redis?

AOF

Which configuration setting specifies the file to which the RDB snapshot dump is
saved?
dfilename

The following are all Key Value databases, except __________


mongodb

sets the key to expire within the given number of seconds.


expire

Consider "a" as a shared key among two processes, A and B.

Process A: Set a 10, INCRBY a 2, get a.


Process B: INCR a, get a.

12 13

The data structure commonly used in Redis is

sets

The _________ command is used to remove the expiration from a key.

Persist

__ returns an array of values.

HGET

Which of the following does the Redis Hashes store?

Key value pairs

The following are commands of sorted sets, except

ZRANGEBYEX

_________ is used to flush the transaction queue and exit from the transaction.

Discard

__ is a type of lock that allows you to limit the number of processes that can
concurrently access a resource to some fixed number.
Optimistic locking wrong

In a Redis transaction, we can use ________ command to enter into the transaction
and queue the transaction commands instead of executing them.
multi

Which is the short structure that Redis provides for the compact representation of
Sets?

ziplist wrong

Which among the following factors helps in calculating the number of shards in
Redis?

Number of keys in a single shard

________ implies the maximum allowed size of each individual element in the data
structure to be encoded to ziplist short structure.
list-max-ziplist-value

Which of the following commands is used to post the message to the channel?

publish

is the number of sentinels that need to agree to the fact that the master is not
reachable and make a failover procedure promoting the slave to the master.
Quorum

is the memory eviction policy where keys are evicted by removing the less recently
used keys first but only among keys that have an 'expire' field set, to make space
for the newly added data.

Volatile-lru

The persistent server should be the _________ once the whole environment is
started.
Master Server

Twemproxy is a proxy developed at Twitter for Redis protocol for automatic


partitioning among multiple Redis instances and optional ejection of the node if it
is not available.
true

is an implementation of partitioning where you can send your query to a random


instance, and the instance will forward your query to the right node.

Proxy assisted partitioning wrong

The ____________ command is used to set a lock in string dataset.

SET wrong

Consider an example where a range of users from 0 to 10000 goes to a Redis instance
R0, and another range of users 10001 to 20000 goes to R1. This is _________
partitioning.
Range partitioning

Which among the following is a benefit of Pipelining?

Speed
________ is used for failover process when a master is not working, promoting the
slave to master.

Sentinel

is the memory policy that returns errors when the memory limit is reached, and the
client is trying to execute commands that result in higher memory usage.

noeviction

is the technique of breaking down data into multiple parts.

Optimizing

Which is the mechanism to enforce limits on the access of a resource when multiple
threads are executed?

Locking

In Redis context, senders are named as _________ and receivers are named as
Subscribers.
Publishers

The environment continues to work even if a slave fails.

True

In a key-value pair, _________ is represented by a string.

Key

command provides a check-and-set behavior to Redis commands


WATCH

is required in the distributed backend systems where cache state needs to be


maintained uniformly across the systems.

Centralized cache

Redis provides the output of all commands in ____________.

A single step

Which file is configured to change the persistence mode?


redis.confi

HANDSON 1

Go Ahead and CODE!


JUST DO same as said in ques.
HANDSON 2

Redis Strings
after installation
run below command

redis-cli ping
redis-cli

set reder-x 50000


set yphone 20000
set trapo 25000

INCRby trapo 2000

INCRby yphone 3000

decrby reder-x 1000

HANDSON 3

Redis
Lists

Redis
Strings
after installation
run below command

redis-cli ping
redis-cli

Using lists, write a command to add the list of avaiable items under key ava

lpush Thorta avail_items Snackss

LPUSH avail_items soaps snacks chocolates shampoos

LPUSH soaps Aegis Busk camo

LPUSH snacks Adge limeh Axen Bevy Berm

LPUSH chocolates himp Aegis Akin

LPUSH shampoos capitol Bisk


LPUSH chocolates Mary Laiy

rough

LREM chocolates -4 Mary


LREM chocolates -5 Laiy
LREM Thorta -3 Chocolates
LREM Thorta -4 Shampoos

LLEN chocolates

HANDSON 4

Redis Sets
after installation
run below command

redis-cli ping
redis-cli

SADD avail_depts ECE


SADD avail_depts CSE
SADD avail_depts EEE

SADD ece Ayne


SADD ece Anson
SADD ece Barl
SADD ece Baretzi

SADD cse Plex


SADD cse Adam
SADD cse Scott

SADD eee Priye


SADD eee Slorena

HANDSON 5
Hands
On - Redis Hashes

install and run below command

redis-cli

https://stackoverflow.com/questions/62992675/how-to-store-a-json-
structure-as-a-hash-data-structure-in-redis

rename file acdetails to accdetails.txt

HMSET roomrate:New_Delhi:Maidens_Hotel:2017-10-06:single occupancy 2 avail_count 13


booked_count 4 currencyisocode INR currency_name Rupee

HMSET roomrate:New_Delhi:Maidens_Hotel:2017-10-06:single:provider name


makemytrip competitor_type partner

SADD roomrate:New_Delhi:Maidens_Hotel:2017-10-
06:single:availroomnumbers 3 7 23 29 41

HANDSON 6

Sorted Sets

run below command

redis-cli

ZADD myset1 1 'a' 2 'b' 3 'c'

ZADD myset2 4 'b' 1 'c' 0 'd'

ZINTERSTORE out 2 myset1 myset2 WEIGHTS 2 3


ZRANGE out 0 -1 WITHSCORES

ZUNIONSTORE unout 2 myset1 myset2 WEIGHTS 2 3


ZRANGE unout 0 -1 WITHSCORES

You might also like