Red5 Documentation

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

Node checker process can not be run as root

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 for security reasons, Chrome will not start under the root user profile.

To add a new user in Ubuntu run adduser <new-username>. You will be prompted to enter a password for that user and confirm it. In addition, you will be prompted for Full Name, Room Number, Work Phone, Home Phone, and Other – each for which you can use the default (blank).

After creating the account, type su <new-username> to launch the process (step 4 below) as your new user.

Installation

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

4 – The Node Checker server can then be started with the following command (see above for instructions on creating a non-root account, as you will not be able to run the check as the root user):

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 to 8001.
  • SM_HOST = The Hostname of the Stream Manager including https://.
  • SM_TOKEN = The rest.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 to 3.
  • MAX_FAILURES = The number of health checks that a node can fail before being reported to the Stream Manager – defaults to 2. It should be noted that the player may try to subscribe just before a stream is unpublished, 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 to 0.
  • 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 to 15000 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 general CHECK-INTERVAL > ((# of edges / {CONCURRENTCHECKS}) * {TIMEOUT}). For example, if your nodegroup has 10 edges, and you set the CONCURRENTCHECKS 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