Elasticsearch not included in Kaltura CE 14.7.0


#1

I want to use the elasticsearch functionality but it seems my install of Kaltura Ce 14.7.0 on Cent OS v6.9 is missing Elasticsearch.

How do I install / enable elastic_search on my version of Kaltura CE?


#3

Hi @userza_123987,

We’ll package the needed dependencies for the eSearch service as part of the 14.10.0 release [next Kaltura Server version]. You may use the following script to configure it on your existing ENV, pro tem:

#!/bin/sh -e

if [ -r /etc/kaltura.d/system.ini ];then
        . /etc/kaltura.d/system.ini
fi
BASE_ES_DIR=/root/es
TIME_STAMP=`date +%Y_%m`
ES_HOST=127.0.0.1
ES_PORT=9200
yum localinstall https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.1.rpm
cp $BASE_ES_DIR/kaltura-elastic-populate /etc/init.d/kaltura-elastic-populate
cp $BASE_ES_DIR/kaltura_synonyms_contraction.txt /etc/elasticsearch/analysis/kaltura_synonyms_contraction.txt
sed -i 's@^\(\s*"type" : \)"boolean"\s*@\1"keyword"@g' $APP_DIR/configurations/elastic/mapping/*.json
mv /etc/elasticsearch/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml.orig
sed -e "s#@BASE_DIR@#$BASE_DIR#g" -e "s#@LOG_DIR@#$LOG_DIR#g" -e "s#@HOSTNAME@#`hostname`#g" $BASE_ES_DIR/elasticsearch.template.yml > /etc/elasticsearch/elasticsearch.yml

for D in $LOG_DIR/elasticsearch $BASE_DIR/var/lib/elasticsearch $BASE_DIR/var/lib/elasticsearch/tmp /etc/elasticsearch/analysis;do
        mkdir -p $D
        chown elasticsearch $D
done
echo "ES_JAVA_OPTS=\"-Djna.tmpdir=$BASE_DIR/var/lib/elasticsearch/tmp -Djava.io.tmpdir=$BASE_DIR/var/lib/elasticsearch/tmp\"" >> /etc/sysconfig/elasticsearch
service elasticsearch restart
if [ ! -d /usr/share/elasticsearch/plugins/analysis-icu ];then
        /usr/share/elasticsearch/bin/elasticsearch-plugin  install analysis-icu
fi
mkdir -p $APP_DIR/configurations/elastic/populate
chown kaltura $APP_DIR/configurations/elastic/populate
set +e
while ! curl -f http://$ES_HOST:$ES_PORT/;do
        sleep 1
done

curl -f -XPUT -H "Content-Type: application/json" "http://$ES_HOST:$ES_PORT/kaltura_entry" -d @$APP_DIR/configurations/elastic/mapping/entry_mapping.json
curl -f -XPUT -H "Content-Type: application/json" "http://$ES_HOST:$ES_PORT/kaltura_category" -d @$APP_DIR/configurations/elastic/mapping/category_mapping.json
curl -f -XPUT -H "Content-Type: application/json" "http://$ES_HOST:$ES_PORT/kaltura_kuser" -d @$APP_DIR/configurations/elastic/mapping/kuser_mapping.json
curl -f -XPUT -H "Content-Type: application/json" "http://$ES_HOST:$ES_PORT/kaltura_search_history" -d @$APP_DIR/configurations/elastic/mapping/search_history_mapping.json
curl -f -XPOST -H "Content-Type: application/json" "http://$ES_HOST:$ES_PORT/_aliases?pretty" -d '{"actions": [{"add":{"index":"kaltura_search_history","alias": "search_history_index"}},{"add":{"index":"kaltura_search_history","alias": "search_history_search"}}]}'
curl -f -XPUT http://$ES_HOST:$ES_PORT/beacon_entry_index_$TIME_STAMP --data-binary @$APP_DIR/plugins/beacon/config/mapping/beacon_entry_index.json -H 'Content-Type: application/json'
curl -f -XPUT http://$ES_HOST:$ES_PORT/beacon_entry_server_node_index_$TIME_STAMP --data-binary @$APP_DIR/plugins/beacon/config/mapping/beacon_entry_server_node_index.json -H 'Content-Type: application/json'
curl -f -XPUT http://$ES_HOST:$ES_PORT/beacon_scheduled_resource_index_$TIME_STAMP --data-binary @$APP_DIR/plugins/beacon/config/mapping/beacon_scheduled_resource_index.json -H 'Content-Type: application/json'
curl -f -XPUT http://$ES_HOST:$ES_PORT/beacon_server_node_index_$TIME_STAMP --data-binary @$APP_DIR/plugins/beacon/config/mapping/beacon_server_node_index.json -H 'Content-Type: application/json'

sed -i "s#@TIME_STAMP@#$TIME_STAMP#g" $BASE_ES_DIR/aliases.json
curl -f -XPOST 'http://$ES_HOST:$ES_PORT/_aliases?pretty' -H 'Content-Type: application/json' -d @$BASE_ES_DIR/aliases.json


for ITEM in beacon_entry_index_$TIME_STAMP beacon_entry_server_node_index_$TIME_STAMP beacon_scheduled_resource_index_$TIME_STAMP beacon_server_node_index_$TIME_STAMP kaltura_entry kaltura_kuser kaltura_category;do 
        curl -f -XPUT http://$ES_HOST:$ES_PORT/$ITEM/_settings -H 'Content-Type: application/json' -d'{"index" : {"number_of_replicas" : "1"}}';
done

echo "elasticCluster = kaltura
elasticServer = $ES_HOST 
elasticPort = $ES_PORT
" >/opt/kaltura/app/configurations/elastic/populate/`hostname`.ini
service kaltura-elastic-populate restart
sed -i 's#^;ElasticSearch#ElasticSearch#g' $APP_DIR/configurations/plugins.ini
sed -i -e "s#@ELASTIC_PORT@#$ES_PORT#g" -e "s#@ELASTIC_HOST@#$ES_HOST#g" $APP_DIR/configurations/elastic.ini
php $APP_DIR/deployment/base/scripts/installPlugins.php 
find $APP_DIR/cache/ -type f -exec rm {} \;
php $APP_DIR/generator/generate.php
service apache2 restart
service memcached restart

Before you run the above, make sure to place the files introduced in the below commit in the same directory as where you’ve placed the script: