Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis database support #343

Closed
Jibin-Tomy-Narvar opened this issue Jun 21, 2018 · 4 comments
Closed

Redis database support #343

Jibin-Tomy-Narvar opened this issue Jun 21, 2018 · 4 comments
Assignees
Labels
kind/enhancement This is an enhancement of an existing feature

Comments

@Jibin-Tomy-Narvar
Copy link

Add support for databases in a Redis cluster.

@rao-vasireddy rao-vasireddy added the kind/enhancement This is an enhancement of an existing feature label Jun 21, 2018
@kmuthukk
Copy link
Collaborator

Hi @Jibin-Tomy-Narvar

So the ask is for namespacing (via the "select <db_index>" like operation that Redis supports), too allow for different namespaces to co-exist, and be created/dropped independent of each other, correct?

regards,
Kannan

@Jibin-Tomy-Narvar
Copy link
Author

Jibin-Tomy-Narvar commented Jun 21, 2018

Hi @kmuthukk ,

My expectation was to be able to create a database with a name and connect to it. After that all the subsequent operations should be performed with respect to that database.

Thanks
Jibin

@kmuthukk
Copy link
Collaborator

Makes sense. Thanks.

@amitanandaiyer : Assigning this one to you.

yugabyte-ci pushed a commit that referenced this issue Aug 6, 2018
Summary:
Server side only.
Added test(s). Changes to client/Jedis to follow in a separate diff.

Depends on https://phabricator.dev.yugabyte.com/D5217

Test Plan: Added test. Wait for jenkins.

Reviewers: karthik, kannan, hector, sergei, robert, venkatesh

Reviewed By: venkatesh

Subscribers: bogdan, bharat, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D5172
@rkarthik007
Copy link
Collaborator

Redis Database Support

Motivation

This feature allows apps to interact with only their data by creating “databases” in order to achieve this. With YugaByte DB (which offers a persistent and elastic Redis database across multiple nodes) this feature has a lot of value.

Usage

By default, all queries are applied to the database 0.

NOTE: YEDIS will support <db-id> being any free form string or number.

New commands have been added for this feature. These commands may be issued from the redis-cli or any other client that supports issuing free form commands (unlike java/jedis).

  • CreateDB
    Databases other than the default (“0”) database are expected to be pre-created before being used.

  • ListDB
    This API will list all databases.

  • DeleteDB
    This command will delete a database.

  • Select
    To select another database, the client issues the following command:
    select <db-id>
    All operations following the above from that client will be carried out against the chosen <db-id> until the next select command is issued.

To process a select statement, the query layer will confirm that the target database already exists. It then updates the RedisConnectionContext to start using the selected database.

Design

In YugaByte DB, each Redis database is modeled as a separate DocDB table.

Database X would map to the redis table redis_X (with the exception of database 0 which maps to redis for backward compatibility).

For example:

  • Database “0” would map to redis
  • Database “1” would map to redis_1
  • Database “foo” would map to redis_foo

The Redis connection context will maintain the information about the database currently in use by each client connection.

The Redis service will translate the database-id from the Redis connection context into an appropriate redis-table-name. and use it for communicating with the tablets using the ybclient.

New Commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This is an enhancement of an existing feature
Projects
None yet
Development

No branches or pull requests

5 participants