Migrating OpenTSDB to Another HBase Cluster

As a part of migration from CDH cluster to HDP cluster, we also had to migrate OpenTSDB which was running on CDH cluster. There are many methods to copy/transfer data between clusters and what we used here was ExportSnapshot.

opentsdb logo

So these are the steps roughly:

  1. Stop TSDs
  2. Take snapshot(s)
  3. Transfer snapshots
  4. Restore snapshots
  5. Modify and start TSDs

Steps 1 and 5 are self understood. We will look at how to take,transfer and restore snapshots.

Snapshot OpenTSDB Tables:

Fire up hbase shell and take snapshot of opentsdb tables. You can choose any name for snapshot to be created.

Transfer OpenTSDB Tables to New HBase Cluster

Here we will use ExportSnapshot utility provided by HBase. It takes snapshot name, destination cluster address as primary arguments. As it will run as a map-reduce job, you can also specify number of mapper to use.

Repeat last line for other three opentsdb tables also. This will copy all the snapshot meta data and related HFiles to destination cluster. Make sure you set correct hbase path in destination cluster.

Once done you can check for copied snapshot files in destination cluster. You also want to check owner of the copied files so that HBase can access it properly. In case of HDP cluster it needed to get changed to hbase:hdfs and here is how to do it.

You may want to repeat last line for all four opentsdb tables snapshots.

Restoring OpenTSDB Table Snapshots

Now to list and restore snapshots on destination cluster, you can do the following in HBase shell. The first command should list all the snapshot and that should include all four opentsdb table snapshots we just transferred. The second line will restore a snapshot into a table.

If you have already created tables in destination cluster then you may want to disable table first and then restore snapshot and then enable it. Repeat the second line for all four tsdb tables.

Once all tables are restored and you have verified it, you can change HBase address in TSDs and start them.

Leave a Reply