Modis implements access layer and data struct layer for OBKV, compatible with Redis protocol.
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:
config-server-url
is generated by ConfigServer, which format isconfig_url&database={database_name}
full-user-name
: the user for accessing obkv, which format isuser_name@tenant_name#cluster_name
passWord
: the password of user in fullUserName.sys-user-name
:root
orproxy
, which have privileges to access routing system viewsys-password
: the password of sys user in sysUserName.
[TODO]
Modis is under Apache License, Version 2.0 licence. For details, see the LICENSE file.
Contributions are warmly welcomed and greatly appreciated. Here are a few ways you can contribute:
- Raise us an Issue
- Submit Pull Requests. For details, see How to contribute.
In case you have any problems when using OceanBase Database, welcome reach out for help:
- GitHub Issue GitHub Issue
- Official forum Official website
- Knowledge base [Coming soon]