https://github.com/oceanbase/modis
Modis implements access layer and data struct layer for OBKV, compatible with Redis protocol.
https://github.com/oceanbase/modis
database golang kv
Last synced: 6 months ago
JSON representation
Modis implements access layer and data struct layer for OBKV, compatible with Redis protocol.
- Host: GitHub
- URL: https://github.com/oceanbase/modis
- Owner: oceanbase
- License: apache-2.0
- Created: 2024-04-26T06:34:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-23T02:19:43.000Z (over 1 year ago)
- Last Synced: 2024-05-23T03:28:21.710Z (over 1 year ago)
- Topics: database, golang, kv
- Language: Go
- Homepage:
- Size: 210 KB
- Stars: 0
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Modis
Modis implements access layer and data struct layer for [OBKV](https://github.com/oceanbase/obkv-table-client-go), compatible with Redis protocol.
## Quick Start
Build Modis
``` bash
bash build_modis.sh
```
Create table in the OceanBase database:
``` sql
-- 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:
``` yaml
{
"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](https://ask.oceanbase.com/t/topic/35601923), 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](http://www.apache.org/licenses/LICENSE-2.0) licence. For details, see the [LICENSE](LICENSE) file.
## Contributing
Contributions are warmly welcomed and greatly appreciated. Here are a few ways you can contribute:
- Raise us an [Issue](https://github.com/oceanbase/modis/issues)
- Submit Pull Requests. For details, see [How to contribute](CONTRIBUTING.md).
## Support
In case you have any problems when using OceanBase Database, welcome reach out for help:
- GitHub Issue [GitHub Issue](https://github.com/oceanbase/modis/issues)
- Official forum [Official website](https://open.oceanbase.com)
- Knowledge base [Coming soon]