Search
Description
The search service requires a separate Elastic Search installation and service setup.
Use of the service is justified in the following cases:
Use of DVR-based services: access to TV program archive and EPG VOD
VOD usage
The search is done by:
names of the channels available to the subscriber according to the current tariff plan.
the name of the TV channels available to the subscriber according to the current tariff plan and the depth of the archive.
VOD library items
Installing
Elasticsearch can be installed either on the server with TMS or separately, depending on available resources. Setup is performed with the setup-search command of the tms_ctl utility:
sudo tms_ctl setup-search
The command works interactively and offers two modes:
install Elasticsearch on the same server - the utility will install the
elasticsearchpackage from the TVIP repository, configure/etc/elasticsearch/elasticsearch.yml, the memory limit (2 GB by default; you can set your own value or 0 - no limit), create thetmsuser and increase the shard limit (5000 by default, the recommended range is 5000 to 10000);connect to an existing Elasticsearch on another server - the utility will check the server availability, version and cluster settings.
In both modes, the command automatically writes the connection parameters to the search manager configuration and restarts the manager-tvip-tms-search service.
Note
The search indicator in the TMS web panel may remain red for up to 5 minutes after the setup is complete - this is not an error.
To check the current search configuration and connectivity to Elasticsearch, use the diagnostics (makes no changes):
sudo tms_ctl setup-search doctor
Elasticsearch on a separate server
If Elasticsearch is deployed on a separate server, first prepare that server with the command:
sudo tms_ctl setup-search --prepare-db
The command will add the TVIP repository, install and configure Elasticsearch to accept network connections, and display the server addresses. Then, on the server with TMS, run sudo tms_ctl setup-search and choose to connect to an existing Elasticsearch, specifying the address of the prepared server and the tms user.
Manual setup
The commands below are used in non-standard scenarios or as an alternative to tms_ctl setup-search. Manual setup repeats the steps that the command performs automatically.
Install Elasticsearch from the TVIP repository:
sudo echo "deb http://deb.packages.tvip.tv/ xenial main" >> /etc/apt/sources.list.d/tms.list
sudo wget --quiet -O - http://deb.packages.tvip.tv/deploy/key.asc | apt-key add -
sudo apt-get update
sudo apt-get install elasticsearch
Edit the options in the /etc/elasticsearch/elasticsearch.yml configuration file:
indices.memory.index_buffer_size: "30%"
network.host: 0.0.0.0
http.port: 9200
discovery.type: single-node
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
enabled: false
xpack.security.transport.ssl:
enabled: false
http.host: 0.0.0.0
Attention
The http.host 0.0.0.0 option is only required in the configuration if Elasticsearch and TMS are installed on different servers, otherwise it is not mandatory.
Attention
When installing Elasticsearch on a server with TMS, we recommend also setting the RAM usage limit with the -Xmx*g parameter in /etc/elasticsearch/jvm.options. * is the value in Gb.
Enabling elasticsearch autoloading and startup:
sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch
Add a tms user with super user rights and a strong password:
/usr/share/elasticsearch/bin/elasticsearch-users useradd tms -r superuser -p your_password
Edit the TVIP TMS Search Manager configuration according to the Elastic Search settings.
After editing the configuration file it is necessary to restart the manager-tvip-tms-search
systemctl restart manager-tvip-tms-search
Attention
After installing Elasticsearch, we recommend increasing the maximum allowed number of shards using the following command:
curl -u tms:<password> -X PUT "localhost:9200/_cluster/settings" -H "Content-Type: application/json" -d'
{
"persistent": {
"cluster.max_shards_per_node": <number>
}
}
'
where <password> is the password set earlier for the tms user using the elasticsearch-users utility, and <number> is the maximum number of shards to be set. The recommended number of shards is from 5000 to 10000.