CGRateS安装和配置

## CGRateS安装和配置

Debian 11

```bash
apt-get install -y mariadb-server redis-server
mysql_secure_installation
wget -O - https://apt.cgrates.org/apt.cgrates.org.gpg.key | apt-key add -
echo "deb http://apt.cgrates.org/debian/ nightly main" | tee /etc/apt/sources.list.d/cgrates.list
apt-get update
apt-get install cgrates -y

cd /usr/share/cgrates/storage/mysql/
./setup_cgr_db.sh root CGRateS.org localhost
cgr-migrator -exec=*set_versions -stordb_passwd=CGRateS.org

cp ./cgrates.json /etc/cgrates/cgrates.json
systemctl restart cgrates.service

git clone https://github.com/nickvsnetworking/CGrates_Tutorial
cd CGrates_Tutorial
cgr-loader -verbose -path=./ -flush_stordb

# Trying it Out
cgr-console 'cost Category="call" Tenant="cgrates.org" Subject="3005" Destination="614" AnswerTime="2014-08-04T13:00:00Z" Usage="60s"' 
```

## 参考资料:

-
-
-
-
-
-
 

附cgrates.json内容:

{

"general": {
    "log_level": 10,
	"node_id":"CGRKamailio",
},

"listen": {
	"rpc_json": ":2012",
	"rpc_gob": ":2013",
	"http": ":2080",
},

"schedulers": {
	"enabled": true,
},

"rals": {
	"enabled": true,
	"thresholds_conns": ["*localhost"],
	"stats_conns": ["*localhost"],
},

"cdrs": {
	"enabled": true,
	"stats_conns": ["*localhost"],
	"chargers_conns": ["*internal"],
	"rals_conns": ["*localhost"],
	"sessions_cost_retries": 5,
},

"chargers": {
	"enabled": true,
	"attributes_conns": ["*internal"],
},

"sessions": {
	"enabled": true,
	"rals_conns": ["*localhost"],
	"cdrs_conns": ["*localhost"],
	"resources_conns": ["*localhost"],
	"routes_conns": ["*localhost"],
	"attributes_conns": ["*localhost"],
	"stats_conns": ["*localhost"],
	"thresholds_conns": ["*localhost"],
	"chargers_conns": ["*internal"],
	"debit_interval": "5s",
	"channel_sync_interval":"7s",
},

"attributes": {
	"enabled": true,
	"string_indexed_fields": ["*req.Account"],
},

"resources": {
	"enabled": true,
	"string_indexed_fields": ["*req.Account"],
},

"stats": {
	"enabled": true,
	"string_indexed_fields": ["*req.Account","*req.RunID","*req.Destination"],
},

"thresholds": {
	"enabled": true,
	"string_indexed_fields": ["*req.Account"],
},

"routes": {
	"enabled": true,
	"resources_conns": ["*internal"],
	"stats_conns": ["*internal"],
	"rals_conns": ["*internal"],
	"string_indexed_fields": ["*req.Account"],
},

"apiers": {
	"enabled": true,
	"scheduler_conns": ["*internal"],
},

"data_db": {
 	"db_type": "*redis",
 	"db_host": "127.0.0.1",
 	"db_port": 6379,
 	"db_name": "10",
 	"db_user": "cgrates",
 	"db_password": "",
 	"remote_conns":[],
 	"remote_conn_id": "",
 	"replication_conns":[],
 	"replication_filtered": false,
 	"replication_cache": "",
 	"items":{
 		"*accounts": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*reverse_destinations": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*destinations": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*rating_plans": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*rating_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*actions": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*action_plans": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*account_action_plans": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*action_triggers": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*shared_groups": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*timings": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*resource_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*resources": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*statqueue_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*statqueues": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*threshold_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*thresholds": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*filters": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*route_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*attribute_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*charger_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*dispatcher_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*dispatcher_hosts": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*load_ids": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*versions": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*resource_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*stat_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*threshold_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*route_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*attribute_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*charger_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*dispatcher_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*reverse_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 	},
 	"opts":{
 		"redisSentinel": "",
 		"redisCluster": false,
 		"redisClusterSync": "5s",
 		"redisClusterOndownDelay": "0",
 		"mongoQueryTimeout":"10s",
 		"redisTLS": false,
 		"redisClientCertificate":"",
 		"redisClientKey":"",
 		"redisCACertificate":"",
 	}
 },

 "stor_db": {
 	"db_type": "*mysql",
 	"db_host": "127.0.0.1",
 	"db_port": 3306,
 	"db_name": "cgrates",
 	"db_user": "cgrates",
 	"db_password": "CGRateS.org",
 	"string_indexed_fields": [],
 	"prefix_indexed_fields":[],
 	"items":{
 		"*session_costs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*cdrs": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_timings": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_destinations": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_rates": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_destination_rates": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_rating_plans": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_rating_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_shared_groups": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_actions": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_action_plans": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_action_triggers": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_account_actions": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_resources": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_stats": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_thresholds": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_filters": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_routes": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_attributes": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_chargers": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*versions": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_dispatcher_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 		"*tp_dispatcher_hosts": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false},
 	},
 },

"kamailio_agent": {
 	"enabled": true,
 	"sessions_conns": ["*birpc_internal"],
 	"create_cdr": false,
 	"timezone": "",
 	"evapi_conns":[
 		{"address": "127.0.0.1:8448", "reconnects": 5}
 	],
},

}

你可能感兴趣的:(CGRateS)