mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 15:18:44 +05:00
Make Indexes storable in MySQL and Postgres
This commit is contained in:
committed by
Dan Christian Bogos
parent
7722265e11
commit
0da0f69e1c
@@ -20,24 +20,13 @@
|
||||
"db": { // database used to store runtime data (eg: accounts, cdr stats)
|
||||
"db_conns": {
|
||||
"*default": { // The id of the DB connection
|
||||
"db_type": "redis", // db type: <internal|redis|mysql|mongo|postgres>
|
||||
"db_host": "127.0.0.1",
|
||||
"db_port": 6379, // db port to reach the database
|
||||
"db_name": "10", // db database name to connect to
|
||||
"db_user": "cgrates",
|
||||
},
|
||||
"StorDB": { // The id of the DB connection
|
||||
"db_type": "mysql", // db type: <internal|redis|mysql|mongo|postgres>
|
||||
"db_host": "127.0.0.1", // the host to connect to
|
||||
"db_port": 3306, // db port to reach the database
|
||||
"db_name": "cgrates", // db database name to connect to
|
||||
"db_user": "cgrates", // username to use when connecting to the database
|
||||
"db_password": "CGRateS.org" // password to use when connecting to the database
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
|
||||
"*load_ids": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -19,26 +19,14 @@
|
||||
"db": { // database used to store runtime data (eg: accounts, cdr stats)
|
||||
"db_conns": {
|
||||
"*default": {
|
||||
"db_type": "redis", // data_db type: <redis|mongo>
|
||||
"db_host": "127.0.0.1",
|
||||
"db_port": 6379, // data_db port to reach the database
|
||||
"db_name": "10", // data_db database name to connect to
|
||||
"db_user": "cgrates",
|
||||
},
|
||||
"StorDB": { // The id of the DB connection
|
||||
"db_type": "postgres", // db type: <internal|redis|mysql|mongo|postgres>
|
||||
"db_host": "127.0.0.1",
|
||||
"db_port": 5432, // db port to reach the database
|
||||
"db_name": "cgrates", // the host to connect to
|
||||
"db_user": "cgrates",
|
||||
"db_password": "CGRateS.org" // password to use when connecting to the database
|
||||
},
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
|
||||
"*accounts": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"},
|
||||
"*load_ids": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"}
|
||||
}
|
||||
},
|
||||
|
||||
"cdrs": {
|
||||
|
||||
140
data/conf/samples/tutredis/cgrates.json
Normal file
140
data/conf/samples/tutredis/cgrates.json
Normal file
@@ -0,0 +1,140 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
//
|
||||
|
||||
|
||||
"general": {
|
||||
"reply_timeout": "50s",
|
||||
},
|
||||
|
||||
"logger": {
|
||||
"level": 7
|
||||
},
|
||||
|
||||
"listen": {
|
||||
"rpc_json": ":2012",
|
||||
"rpc_gob": ":2013",
|
||||
"http": ":2080",
|
||||
},
|
||||
|
||||
"db": { // database used to store runtime data (eg: accounts, cdr stats)
|
||||
"db_conns": {
|
||||
"*default": { // The id of the DB connection
|
||||
"db_type": "redis", // db type: <internal|redis|mysql|mongo|postgres>
|
||||
"db_host": "127.0.0.1",
|
||||
"db_port": 6379, // db port to reach the database
|
||||
"db_name": "10", // db database name to connect to
|
||||
"db_user": "cgrates",
|
||||
},
|
||||
"StorDB": { // The id of the DB connection
|
||||
"db_type": "mysql", // db type: <internal|redis|mysql|mongo|postgres>
|
||||
"db_host": "127.0.0.1", // the host to connect to
|
||||
"db_port": 3306, // db port to reach the database
|
||||
"db_name": "cgrates", // db database name to connect to
|
||||
"db_user": "cgrates", // username to use when connecting to the database
|
||||
"db_password": "CGRateS.org" // password to use when connecting to the database
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false, "dbConn": "StorDB"}
|
||||
}
|
||||
},
|
||||
|
||||
"cdrs": {
|
||||
"enabled": true,
|
||||
"chargers_conns":["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"attributes": {
|
||||
"enabled": true,
|
||||
"stats_conns": ["*localhost"],
|
||||
"resources_conns": ["*localhost"],
|
||||
"accounts_conns": ["*localhost"]
|
||||
},
|
||||
|
||||
"chargers": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"resources": {
|
||||
"enabled": true,
|
||||
"store_interval": "1s",
|
||||
"thresholds_conns": ["*internal"]
|
||||
},
|
||||
|
||||
|
||||
"stats": {
|
||||
"enabled": true,
|
||||
"store_interval": "1s",
|
||||
"thresholds_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"thresholds": {
|
||||
"enabled": true,
|
||||
"store_interval": "1s",
|
||||
},
|
||||
|
||||
|
||||
"routes": {
|
||||
"enabled": true,
|
||||
"prefix_indexed_fields":["*req.Destination"],
|
||||
"stats_conns": ["*internal"],
|
||||
"resources_conns": ["*internal"],
|
||||
"rates_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"routes_conns": ["*internal"],
|
||||
"resources_conns": ["*internal"],
|
||||
"attributes_conns": ["*internal"],
|
||||
"rates_conns": ["*internal"],
|
||||
"cdrs_conns": ["*internal"],
|
||||
"chargers_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"migrator":{
|
||||
|
||||
"users_filters":["Account"],
|
||||
},
|
||||
|
||||
|
||||
"admins": {
|
||||
"enabled": true,
|
||||
"scheduler_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"rates": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
|
||||
"actions": {
|
||||
"enabled": true,
|
||||
"accounts_conns": ["*localhost"]
|
||||
},
|
||||
|
||||
|
||||
"accounts": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
|
||||
"filters": {
|
||||
"stats_conns": ["*internal"],
|
||||
"resources_conns": ["*internal"],
|
||||
"accounts_conns": ["*internal"],
|
||||
},
|
||||
|
||||
"tpes": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
}
|
||||
@@ -235,3 +235,17 @@ CREATE TABLE load_ids (
|
||||
`load_ids` JSON NOT NULL,
|
||||
PRIMARY KEY (`pk`)
|
||||
);
|
||||
|
||||
DROP TABLE IF EXISTS indexes;
|
||||
CREATE TABLE indexes (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`tenant` VARCHAR(40),
|
||||
`type` VARCHAR(40) NOT NULL,
|
||||
`key` VARCHAR(64),
|
||||
`value` JSON NOT NULL,
|
||||
PRIMARY KEY (`pk`),
|
||||
UNIQUE KEY unique_tenant_type_key (`tenant`, `type`, `key`)
|
||||
);
|
||||
CREATE INDEX indexes_key_idx ON indexes (`key`);
|
||||
CREATE INDEX indexes_type_idx ON indexes (`type`);
|
||||
CREATE INDEX indexes_type_key_idx ON indexes (`type`, `key`);
|
||||
|
||||
@@ -229,4 +229,17 @@ DROP TABLE IF EXISTS load_ids;
|
||||
CREATE TABLE load_ids (
|
||||
pk SERIAL PRIMARY KEY,
|
||||
load_ids JSONB NOT NULL
|
||||
);
|
||||
);
|
||||
|
||||
DROP TABLE IF EXISTS indexes;
|
||||
CREATE TABLE indexes (
|
||||
pk SERIAL PRIMARY KEY,
|
||||
tenant VARCHAR(40),
|
||||
type VARCHAR(40) NOT NULL,
|
||||
key VARCHAR(40),
|
||||
value JSONB NOT NULL,
|
||||
UNIQUE (tenant, type, key)
|
||||
);
|
||||
CREATE INDEX indexes_key_idx ON indexes ("key");
|
||||
CREATE INDEX indexes_type_idx ON indexes ("type");
|
||||
CREATE INDEX indexes_type_key_idx ON indexes ("type", "key");
|
||||
|
||||
Reference in New Issue
Block a user