Make sure that the golang development environment is installed
git clone https://github.com/cdnbye/cbsignal_redis.git
cd cbsignal
make
or directly use compiled linux file cbsignal .
Make sure you have set up redis server, then edit config.yaml
:
redis:
host: REDIS_IP
port: 6379
dbname: 0
is_cluster: false
Upload binary file, admin.sh and config.yaml to server, create cert
directory with signaler.pem
and signaler.key
, then start service:
chmod +x admin.sh
sudo ./admin.sh start
import Hls from 'cdnbye';
var hlsjsConfig = {
p2pConfig: {
wsSignalerAddr: 'ws://YOUR_SIGNAL',
// Other p2pConfig options provided by hlsjs-p2p-engine
}
};
// Hls constructor is overriden by included bundle
var hls = new Hls(hlsjsConfig);
// Use `hls` just like the usual hls.js ...
GET /info
Response:
Status: 200
{
"ret": 0,
"data": {
"version"
"current_connections"
"cluster_mode"
"num_goroutine"
"num_per_map"
}
}
Redis list is used to communicate between all nodes. You just need to add more instances to the same local network.
The default redis address in default config is 127.0.0.1:6379
sudo docker run --net host --restart=unless-stopped -d cdnbye/cbsignal_redis:latest
mkdir config && cd config
touch config.yaml
Then cony your config to config.yaml, you can copy your SSL cert to this directory, then:
sudo docker run --net host --restart=unless-stopped -d -v "$(pwd)"/config:/cbsignal_redis/config cdnbye/cbsignal_redis:latest
- cbsignal_node - High performance CDNBye signaling service written in node.js
请先确保已安装golang开发环境
git clone https://github.com/cdnbye/cbsignal_redis.git
cd cbsignal
make
或者直接使用已经编译好的linux可执行文件 cbsignal
首先确保内网中已经有redis服务, 编辑 config.yaml
:
redis:
host: REDIS_IP
port: 6379
dbname: 0
is_cluster: false
将编译生成的二进制文件、admin.sh和config.yaml上传至服务器,并在同级目录创建cert
文件夹,将证书和秘钥文件分别改名为signaler.pem
和signaler.key
放入cert,之后启动服务:
chmod +x admin.sh
echo -17 > /proc/$(pidof cbsignal)/oom_adj # 防止进程被OOM killer杀死
sudo ./admin.sh start
import Hls from 'cdnbye';
var hlsjsConfig = {
p2pConfig: {
wsSignalerAddr: 'ws://YOUR_SIGNAL',
// Other p2pConfig options provided by hlsjs-p2p-engine
}
};
// Hls constructor is overriden by included bundle
var hls = new Hls(hlsjsConfig);
// Use `hls` just like the usual hls.js ...
GET /info
响应:
Status: 200
{
"ret": 0,
"data": {
"version"
"current_connections"
"cluster_mode"
"num_goroutine"
"num_per_map"
}
}
节点之间采用Redis list进行通信,只需要在同一个内网中部署更多实例即可。
默认配置连接redis地址是127.0.0.1:6379
sudo docker run --net host --restart=unless-stopped -d cdnbye/cbsignal_redis:latest
mkdir config && cd config
touch config.yaml
config.yaml是你的自定义配置,可以在此配置证书文件等,然后运行:
sudo docker run --net host --restart=unless-stopped -d -v "$(pwd)"/config:/cbsignal_redis/config cdnbye/cbsignal_redis:latest
- cbsignal_node - 基于node.js开发的高性能CDNBye信令服务