diff --git a/data/conf/samples/tutmongo/cgrates.json b/data/conf/samples/tutmongo/cgrates.json index 6286b22e0..5bb324d5c 100644 --- a/data/conf/samples/tutmongo/cgrates.json +++ b/data/conf/samples/tutmongo/cgrates.json @@ -7,23 +7,23 @@ "reply_timeout": "30s", }, + "listen": { "rpc_json": ":2012", "rpc_gob": ":2013", "http": ":2080", }, + "data_db": { "db_type": "mongo", - "db_host": "127.0.0.1", "db_port": 27017, }, + "stor_db": { "db_type": "mongo", - "db_host": "127.0.0.1", "db_port": 27017, - "db_password":"", }, @@ -43,10 +43,12 @@ ], }, + "scheduler": { "enabled": true, }, + "cdrs": { "enabled": true, "cdrstats_conns": [ @@ -54,37 +56,39 @@ ], }, + "cdrstats": { "enabled": true, }, + "pubsubs": { "enabled": true, }, + "users": { "enabled": true, "indexes": ["Uuid"], }, + "aliases": { "enabled": true, }, + "resources": { "enabled": true, - "stats_conns": [ - //{"address": "*internal"} - ], - "cache_dump_interval": "0s", - "usage_ttl": "3h", }, + "stats": { "enabled": true, "store_interval": "0s", }, + "sm_generic": { "enabled": true, }, diff --git a/data/conf/samples/tutmysql/cgrates.json b/data/conf/samples/tutmysql/cgrates.json index a33ff2314..e8b0f8b49 100644 --- a/data/conf/samples/tutmysql/cgrates.json +++ b/data/conf/samples/tutmysql/cgrates.json @@ -7,34 +7,17 @@ "log_level": 7, }, + "listen": { "rpc_json": ":2012", "rpc_gob": ":2013", "http": ":2080", }, -"data_db": { // database used to store runtime data (eg: accounts, cdr stats) - "db_type": "redis", // data_db type: - "db_host": "192.168.100.40", // data_db host address - "db_port": 6379, // data_db port to reach the database - "db_name": "10", // data_db database name to connect to - "db_user": "cgrates", // username to use when connecting to data_db - "db_password": "", // password to use when connecting to data_db - "load_history_size": 10, // Number of records in the load history -}, -"stor_db": { // database used to store offline tariff plans and CDRs - "db_type": "mysql", // stor database type to use: - "db_host": "192.168.100.40", // the host to connect to - "db_port": 3306, // the port to reach the stordb - "db_name": "cgrates", // stor database name - "db_user": "cgrates", // username to use when connecting to stordb - "db_password": "CGRateS.org", // password to use when connecting to stordb - "max_open_conns": 100, // maximum database connections opened, not applying for mongo - "max_idle_conns": 10, // maximum database connections idle, not applying for mongo - "conn_max_lifetime": 0, // maximum amount of time in seconds a connection may be reused (0 for unlimited), not applying for mongo - "cdrs_indexes": [], // indexes on cdrs table to speed up queries, used only in case of mongo -}, +"stor_db": { + "db_password": "CGRateS.org", +}, "cache":{ @@ -72,6 +55,7 @@ ], }, + "scheduler": { "enabled": true, }, @@ -87,7 +71,7 @@ "cdre": { "TestTutITExportCDR": { - "content_fields": [ // template of the exported content fields + "content_fields": [ {"tag": "CGRID", "type": "*composed", "value": "CGRID"}, {"tag": "RunID", "type": "*composed", "value": "RunID"}, {"tag":"OriginID", "type": "*composed", "value": "OriginID"}, @@ -106,39 +90,45 @@ "cdrstats": { - "enabled": true, // starts the cdrstats service: + "enabled": true, }, "pubsubs": { - "enabled": true, // starts PubSub service: . + "enabled": true, }, "users": { - "enabled": true, // starts User service: . - "indexes": ["Uuid"], // user profile field indexes + "enabled": true, + "indexes": ["Uuid"], }, + "resources": { "enabled": true, }, + "stats": { "enabled": true, "store_interval": "0s", }, + "historys": { "enabled": true, }, + "aliases": { - "enabled": true, // starts Aliases service: . + "enabled": true, }, + "sm_generic": { "enabled": true, }, -} + +} \ No newline at end of file diff --git a/data/conf/samples/tutpostgres/cgrates.json b/data/conf/samples/tutpostgres/cgrates.json index f40477ccb..77b78db03 100644 --- a/data/conf/samples/tutpostgres/cgrates.json +++ b/data/conf/samples/tutpostgres/cgrates.json @@ -1,21 +1,24 @@ - { +{ // CGRateS Configuration file // // Used for cgradmin // Starts rater, scheduler + "listen": { "rpc_json": ":2012", // RPC JSON listening address "rpc_gob": ":2013", // RPC GOB listening address "http": ":2080", // HTTP listening address }, + "stor_db": { "db_type": "postgres", // stor database type to use: "db_port": 5432, // the port to reach the stordb "db_password": "CGRateS.org", }, + "rals": { "enabled": true, // enable Rater service: "cdrstats_conns": [ @@ -32,10 +35,12 @@ ], }, + "scheduler": { "enabled": true, // start Scheduler service: }, + "cdrs": { "enabled": true, // start the CDR Server service: "cdrstats_conns": [ @@ -43,10 +48,12 @@ ], }, + "cdrstats": { "enabled": true, // starts the cdrstats service: }, + "pubsubs": { "enabled": true, // starts PubSub service: . }, @@ -57,14 +64,20 @@ "indexes": ["Uuid"], // user profile field indexes }, + "aliases": { "enabled": true, // starts Aliases service: . }, +"resources": { + "enabled": true, +}, + + "sm_generic": { "enabled": true, }, -} +} \ No newline at end of file diff --git a/engine/resources.go b/engine/resources.go index 451a817c2..90491093c 100755 --- a/engine/resources.go +++ b/engine/resources.go @@ -238,9 +238,9 @@ type ResourceService struct { scEventResources *ltcache.Cache // short cache map[ruID], used to keep references to matched resources for events in allow queries lcEventResources *ltcache.Cache // cache recording resources for events in alocation phase storedResources utils.StringMap // keep a record of resources which need saving, map[resID]bool - srMux sync.RWMutex - stopBackup chan struct{} // control storing process - storeInterval time.Duration + srMux sync.RWMutex // protects storedResources + storeInterval time.Duration // interval to dump data on + stopBackup chan struct{} // control storing process } // Called to start the service