Support Questions

Find answers, ask questions, and share your expertise

Phoenix backup

avatar

We are primarily using the phoenix interface to access hbase (created tables, store and delete data). what is the best way to back up phoenix tables. Is there a way of doing it automatically in ambari or is anyone following a practice for this.

1 ACCEPTED SOLUTION

avatar

Phoenix tables are the same as HBase tables so as per your need, you can use any backup method available in hbase.

http://hbase.apache.org/book.html#ops.backup

Taking a snapshot of all SYSTEM tables and user tables and exporting in some cold storage is an good option until incremental backup and restore feature in hbase got released (though active development is going on so expected to be released soon in HDP).

View solution in original post

8 REPLIES 8

avatar
Super Collaborator

Currently there is no backup functionality specific for Phoenix. Meanwhile you may use HBase snapshots. You need to snapshot SYSTEM tables as well as user tables. In the next release of HDP there will be HBase backup functionality. And hopefully quite soon we will see Phoenix backup based on it.

avatar
@ARUN

Right now there is now way we can do it in ambari.

You will have to write custom scripts to take the backup. Use import/export or snapshot features of HBase to take the backups.

avatar

Phoenix tables are the same as HBase tables so as per your need, you can use any backup method available in hbase.

http://hbase.apache.org/book.html#ops.backup

Taking a snapshot of all SYSTEM tables and user tables and exporting in some cold storage is an good option until incremental backup and restore feature in hbase got released (though active development is going on so expected to be released soon in HDP).

avatar

Thanks, Ankit. but if we need to restore the hbase tables from snapshots and if they gets restored as hbase tables. will we need to build a view on top of the hbase tables to access it as phoenix tables.

avatar

when you restore SYSTEM tables too, the metadata of all tables will be available , so you don't need to create any metadata again(like view/table) to access the user tables.

avatar

Thanks Ankit. this helps.

avatar

Here is what I wrote:

cat <<EOF | /usr/hdp/current/phoenix-client/bin/sqlline.py localhost:2181:/hbase-unsecure &> /dev/null
!brief
!set outputformat csv
!set showwarnings false
!set silent true
!set headerinterval 0
!set showelapsedtime false
!set incremental true
!set showheader true
!record /shared/backup.csv
select * from d.test_table;
!record
!quit
EOF

Working well so far (13M rows) after implementing suggestions here: https://community.hortonworks.com/content/supportkb/49037/phoenix-sqlline-query-on-larger-data-set-f...

avatar
Explorer

Hi all,

Do you have any suggestion for backing up and restore only 1 Phoenix table ? I believe if we restore the system table, it will have impact to all others, won't it ?

Many thanks,

Tu