Skip to content

Modis implements access layer and data struct layer for OBKV, compatible with Redis protocol.

License

Notifications You must be signed in to change notification settings

oceanbase/modis

Modis

Modis implements access layer and data struct layer for OBKV, compatible with Redis protocol.

Quick Start

Build Modis

bash build_modis.sh

Create table in the OceanBase database:

-- string
create table modis_string_table(
  db bigint not null,
  rkey varbinary(16384) not null, # 16K
  value varbinary(1048576) not null, # 1M
  expire_ts timestamp(6) default null,
  primary key(db, rkey)) 
  TTL(expire_ts + INTERVAL 0 SECOND) 
  partition by key(db, rkey) partitions 3;

-- hash
CREATE TABLE modis_hash_table(
  db bigint not null,
  rkey varbinary(8192) not null, # 8K
  is_data tinyint(1) default 1,
  insert_ts timestamp(6) DEFAULT NULL,
  expire_ts timestamp(6) default null,
  field varbinary(8192) not null, # 8K
  value varbinary(1048576) default null, # 1M
  PRIMARY KEY(db, rkey, is_data, field))
  KV_ATTRIBUTES ='{"Redis": {"isTTL": true, "model": "hash"}}'
  PARTITION BY KEY(db, rkey) PARTITIONS 3;

-- set
CREATE TABLE modis_set_table(
  db bigint not null,
  rkey varbinary(1024) not null, # 1K
  is_data tinyint(1) default 1,
  insert_ts timestamp(6) DEFAULT NULL,
  expire_ts timestamp(6) default null,
  member varbinary(15360) not null, # 15K
  PRIMARY KEY(db, rkey, is_data, member))
  KV_ATTRIBUTES ='{"Redis": {"isTTL": true, "model": "zset"}}'
  PARTITION BY KEY(db, rkey) PARTITIONS 3;

-- list
CREATE TABLE modis_list_table(
  db BIGINT NOT NULL,
  rkey VARBINARY(16384) NOT NULL, # 16K
  is_data tinyint(1) default 1,
  insert_ts TIMESTAMP(6) DEFAULT NULL, 
  expire_ts timestamp(6) default null,
  value VARBINARY(1048576) DEFAULT NULL, # 1M
  `index` BIGINT NOT NULL,             
  PRIMARY KEY(db, rkey, is_data, `index`)
)
KV_ATTRIBUTES ='{"Redis": {"isTTL": true, "model": "list"}}'
PARTITION BY KEY(db, rkey)            
PARTITIONS 3;

-- zset
CREATE TABLE modis_zset_table(
  db bigint not null,
  rkey varbinary(1024) not null, # 1K 
  is_data tinyint(1) default 1,
  insert_ts timestamp(6) DEFAULT NULL,
  expire_ts timestamp(6) default null,
  member varbinary(15360) not null, # 15k
  score double default null,
  index index_score(db, rkey, score) local,
  PRIMARY KEY(db, rkey, is_data, member))
  KV_ATTRIBUTES ='{"Redis": {"isTTL": true, "model": "zset"}}'
  PARTITION BY KEY(db, rkey) PARTITIONS 3;

config.yaml file exmaple:

{
  "server": {
    "listen": ":8085",
    "max-connection": 1000, # limit 10000
    "password": "",
    "databases": 256, # databases idx range [0, databases)
    "channel-size": 10,
    "supervised": "no",
    "TLS": {
      "ssl-cert-file": "",
      "ssl-key-file": ""
    }
  },
  "log": {
    "filepath": "./", # filename is fixed as modis.log
    "single-file-max-size": 256, # MB
    "max-backup-file-size": 10, # 0 is not delete
    "max-age-file-rem": 30, # 30 day
    "compress": false,
    "level": "info" # info/error/warn/debug
  },
  "storage": {
    "backend": "obkv",
    "obkv": {
      "config-server-url": "",
      "full-user-name": "",
      "password": "",
      "sys-user-name": "root",
      "sys-password": "",
      "connection-pool-size": 64
    }
  }
}

NOTE:

  1. config-server-url is generated by ConfigServer, which format is config_url&database={database_name}
  2. full-user-name: the user for accessing obkv, which format is user_name@tenant_name#cluster_name
  3. passWord: the password of user in fullUserName.
  4. sys-user-name: root or proxy, which have privileges to access routing system view
  5. sys-password: the password of sys user in sysUserName.

Documentation

[TODO]

Licencing

Modis is under Apache License, Version 2.0 licence. For details, see the LICENSE file.

Contributing

Contributions are warmly welcomed and greatly appreciated. Here are a few ways you can contribute:

Support

In case you have any problems when using OceanBase Database, welcome reach out for help:

About

Modis implements access layer and data struct layer for OBKV, compatible with Redis protocol.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •