Installing the Node Checker
It is recommended to install the Node Checker on a dedicated instance which will run continuously to monitor a Red5 Pro autoscale environment. Depending on how many concurrent checks you want to run, you will want at least 2 CPUs/4G memory for that instance.
IMPORTANT: at this time, the node checker can not be run if your environment has multiple nodegroups
1 - Install Google Chrome, Node.js and other prerequisites with the following commands:
sudo apt-get update
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install -y nodejs
sudo apt-get install build-essential
sudo npm install forever -g
2 - Download the entire Node Checker repository: git clone https://github.com/red5pro/nodejs-checker
3 - cd into the nodejs-checker directory, and install dependencies by running npm install
If you are logged in as the root user you will need to create a new user to run the Node Checker server. That is because the Node Checker internally starts a Chrome process but Chrome will not start for security reasons if the Node Checker is running under the root user. To add a new user in Ubuntu run adduser userNameHere
. Enter password and other needed info to create a user account on the Ubuntu server. You will then need to su userNameHere
to run the following as your new user.
4 - The Node Checker server can then be started with the following command:
PORT=<Node-Checker-Port> SM_HOST=https://<Hostname-of-Stream-Manager> SM_TOKEN=<Token-Of-Stream-Manager> MAX_SUBSCRIBE_RETRIES=<Max-Retries> MAX_FAILURES=<Max-Failures> CHECK_INTERVAL=<Check-Interval> TIMEOUT=<Timeout> CONCURRENTCHECKS=<Concurrent-Checks> forever start index.js
If you want to stop the process, type forever stop index.js
Where:
PORT
= The Port used by the Node Checker server - defaults to8001
.SM_HOST
= The Hostname of the Stream Manager includinghttps://
.SM_TOKEN
= Therest.administratorToken
of your Stream Manager.MAX_SUBSCRIBE_RETRIES
= The number of times the nodechecker will retry to subscribe to the provided live stream using the provided edge before reporting it as bad to the Node Checker server - defaults to3
.MAX_FAILURES
= The number of health checks that a node can fail before being reported to the Stream Manager - defaults to2
. It should be noted that the player may try to subscribe just before a stream is unpublished, and thus making the edge fail the health check as a result. Therefore, it is recommended to check at least twice before reporting to the Stream Manager. Every time a node has a good health check (it can successfully subscribe), the health check failure counter of the node is reset to0
.CHECK_INTERVAL
= The period of the health checks in milliseconds - defaults to 30,000 milliseconds (30 seconds).TIMEOUT
= The maximum time in milliseconds given to the Chrome Instance to report if it could subscribe or not - defaults to15000
milliseconds.CONCURRENTCHECKS
= The maximum number of edges that the Node Checker server can check at the same time - defaults to 5.
It should be noted that the server will create
{CONCURRENTCHECKS}
Chrome instances at the same time. If there are more edges than{CONCURRENTCHECKS}
, then they will be divided in groups of size smaller or equal to{CONCURRENTCHECKS}
. When there is more than one check group, the Node Checker server may increase the value of{CHECKINTERVAL}
to guarantee that there are never more than{CONCURRENTCHECKS}
Google Chrome instances at any given time. In generalCHECK-INTERVAL
> ((# of edges /{CONCURRENTCHECKS}
) *{TIMEOUT}
). For example, if your nodegroup has 10 edges, and you set theCONCURRENTCHECKS
value to 5, then the checks will be run against half of the edge servers every
Example: PORT=8001 SM_HOST=https://my.streammanager.com SM_TOKEN=xyz123 MAX_SUBSCRIBE_RETRIES=3 MAX_FAILURES=2 CHECK_INTERVAL=30000 TIMEOUT=15000 CONCURRENTCHECKS=5 forever start index.js
Nodechecker Logging
To view the log output, type forever list
. That will return the path where the log is written