Search code examples
pieclouddb

How to full restore the metadata of the PieCloudDB data warehouse?


I am currently working with the PieCloudDB data warehouse and have encountered an issue where I need to full restore the metadata. I learned that the metadata layer of PieCloudDB is based on FoundationDB, but I don't know how to restore. Does anyone have experience with similar issues? Any help would be greatly appreciated.


Solution

  • For the full restore metadata of PieCloudDB, the recommended solution is to restore the data to a new FoundationDB cluster. The steps are as follows:

    1.After creating a new FoundationDB cluster, tenant information needs to be reconstructed based on the Tenant Map.

    `\xff\xff/management/tenant_map/xxx01' is `{"id":0,"prefix":"\\u0000\\u0000\ \u0000\\u0000\\u0000\\u0000\\u0000\\u0000"}' 
    `\xff\xff/management/tenant_map/xxx02' is `{"id":1,"prefix":"\\u0000\\u0000\ \u0000\\u0000\\u0000\\u0000\\u0000\\u0001"}'
    

    Tenants need to be re-created on the new FoundationDB in strict accordance with the order of IDs. The example is as follows:

    fdbcli --exec "createtenant xxx01"
    fdbcli --exec "createtenant xxx02"
    

    2.Full restore FoundationDB data:

    fdbrestore status -t ${tag_name} -r 'file://[backup_file_directory]' --dest-cluster-file [fdb_cluster_file_path_on_the_target_side]
    

    You can also choose to restore only a certain FoundationDB tenant:

    fdbrestore status -t ${tag_name} -r 'file://[backup_file_directory]' --dest-cluster-file [fdb_cluster_file_path_on_the_target_side] -k '[prefix_of_single_tenant]'