Copy videos between servers with different versions of kaltura

Hello,

We have two servers with kaltura

SERVER 1: Community Edition 10.10.0
NEW SERVER 2: fresh install of Community Edition 10.21.0.

Is it possible copy videos between those servers?

Hello,

Are you only interested in moving the videos over or all data? i.e partners, metadata, etc?
If you want to move the whole data, copying over /opt/kaltura/web/ to the new server, while preserving permissions, as well as exporting all the Kaltura DBs [you can use /opt/kaltura/bin/kaltura-export-db.sh for that] will do it.
Note that if the hostname on the new server is different, you should replace the old service URL with the new one in the dumped SQL before importing it back.

If you are only interested in importing the videos themselves, the easiest way would probably be to get the download URL for each video using the API and then use bulk upload on the new server to import them in.

Bulk upload file examples are available from the KMC->upload menu.

to get the URLs for existing media files, you can use:

<?php
if ($argc < 4){
    echo "\nUsage: ".$argv[0] . ' <partner id> <admin secret> <service url>'."\n\n";
    exit (1);
}
require_once('/opt/kaltura/web/content/clientlibs/php5/KalturaClient.php');
$userId = null;
$expiry = null;
$privileges = null;
$partnerId=$argv[1];
$secret = $argv[2];
$type = KalturaSessionType::ADMIN;
$config = new KalturaConfiguration($partnerId);
$config->serviceUrl = $argv[3];
$client = new KalturaClient($config);
$ks = $client->session->start($secret, $userId, $type, $partnerId, $expiry, $privileges);
$client->setKs($ks);
$filter=null;
$total_media_entries = $client->media->count($filter);
$pager = new KalturaFilterPager();
$page_index=1;
$pager->pageSize = 500;
$processed_entries=0;

while ($processed_entries < $total_media_entries){
    $pager->pageIndex=$page_index;
    $result = $client->media->listAction($filter, $pager);
        foreach ($result->objects as $entry) {
            $filter = new KalturaAssetFilter();
            $filter->entryIdEqual = $entry->id;
            $filter->tagsLike = 'source';
            $pager = null;
            $result = $client->flavorAsset->listAction($filter, $pager);
            if(isset($result->objects[0]->id)){
                $result = $client->flavorAsset->geturl($result->objects[0]->id, null, null, null);
            }
            if(is_string($result)){
                echo ( $result."\n");
            }
            $processed_entries++;
        }
    $page_index++;
}

Exactly what I need. Tks a lot!

After copying content of /opt/kaltura/web, follow these steps:

  1. I made a dump of the Kaltura database tables;
  2. Ran a commands:
    sed -i ‘s/xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy/g’ Dump20151022.sql
    sed -i ‘s/old_hostname/new_hostname/g’ Dump20151022.sql
    mysql -u root -p -h 127.0.0.1 < Dump20151022.sql
    /opt/kaltura/bin/kaltura-config-all.sh
    /opt/kaltura/bin/kaltura-db-update.sh

When I enter the system, by clicking CONTENT appears the error “Internal database error”.

Is there anything else what I have to do?

My guess would be you did not copy /opt/kaltura/web with the proper permissions:)
You can re-run the config scripts to set them.
After making sure the perms are correct, run:
# kaltlog
from the server’s shell in parallel to making the request and look for errors outputted to STDOUT.

In addition, use an HTTP sniffer [like the dev tools in your browser] to look for failing requests.

I set permissions and run config again…

Hi,

That’s not enough information, I’m afraid. Did you make sure the file permissions are correct?
Also, look at /opt/kaltura/log/kaltura_api_v3.log and track down what’s causing the issue.

When I copied files, i used rsync with -a option like down:

rsync -avzP root@xxx.xxx.xxx.xxx:/opt/kaltura/web/ /opt/kaltura/web/

So, I believe that the permissions are right.

What kind of information I need to find in kaltura_api_v3.log?

The logs should include errors and exceptions.
Check for this pattern “ERR:|PHP|trace|CRIT|[error]” in the log and then look at the lines before the error to understand how the code flow got there.

Feel free to post your findings here so I can help you analyse them.

Hi! Follow the file…
Tks for your help…

Another piece of file…

Hello,

You’re problem starts here:
‘Exception’ with message ‘SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘metadata_profile.FILE_SYNC_VERSION’ in ‘field list’’ in /opt/kaltura/app/infra/log/KalturaLog.php:83

This indicates that the old server and they new one do not run the same exact Kaltura version and the schemas are different.

What is the output for:
# rpm -q kaltura-base
on each machine?

Old server: kaltura-base-10.10.0-3.noarch
New server: kaltura-base-10.21.0-11.noarch

Right. So, this is the problem.
You can fix it by installing the new server with version kaltura-base-10.10.0-3 which you can do if you set the repos to be:
baseurl = http://installrepo.kaltura.org/releases/10.10.0/RPMS/$basearch/
http://installrepo.kaltura.org/releases/10.10.0/RPMS/noarch
in /etc/yum.repos.d/kaltura.repo

Import the data as before, including running:
/opt/kaltura/bin/kaltura-sphinx-reindex.sh
to reindex the Sphinx.

and then upgrade the server to latest as normal.

Another way is to upgrade the old server to latest and then reimport the data to the new server.

Perfect!

I Updated the old server and import to new server with sucess.

Tks for reply!

Senger

Hi Senger,

Great, glad all is well:)
Happy Kalturing,

BTW, would love for you to participate in our survey here:
http://surveys.kaltura.org/index.php/877436/lang-en

We will raffle 10 complete Rasperry Pi Kits and a 12 months sponsored Kaltura.com account among the participants who completed the survey.

Thanks,