Data Callback

Last updated: 2018-06-26 15:10:51

PDF

Users can use the rollback tool to roll back a database or table on Tencent Cloud platform. Based on cold backup and binlog, the tool can be used to roll back data in real time.

The CDB rollback tool can roll back the cloud database or table to the specified time with regular images and real-time flow reconstruction, and ensure that all data have the same time slice. During the rollback, the access to the original database or table is not affected,and a new database or table will be generated. After the rollback is finished, the user can see the original database or table, as well as the new database or table.

Note: Cloud database will not change any user data. The data damage due to personal cause can be repaired through rollback.

1. Permission Control

In order to ensure the security of data in the database or table, the tool will authenticate a request.

1.1 Service Limits

Environment limit

This tool can only run on a CVM.

Data limit

Only data within 3 days can be rolled back.

Requests limit

As data rollback is a resource-consuming service, the number of requests that can be made by an application is limited. After a rollback command is initiated, the system will verify the maximum number of requests of the application. If the rollback is not allowed, please contact us and submit a ticket.

2. Tool Instructions

2.1 Installation Instructions

1.Download the CDB rollback tool:

Version Release Date Description
CdbRollbackTools_x64_v1.1.0.zip April 18, 2013 Rollback of a single database and a single table is supported. (For Guangzhou)
CdbRollbackTools.zip Jan 20, 2015 Rollback of a single database and a single table is supported. (For Shanghai)

2.Save the tool to the local, then upload it to the CVM, and decompress the toolkit.
The decompression process is as follows:

unzip CdbRollbackTools_x64_v1.1.0.zip

3.After the decompression, there will be a binary executable file. The file is described as follows:
CdbRollbackTools: Cloud Database rollback tool.
4.Run the tool directly on the CVM (Linux CVM only) without installation.

2.2 Command Description

1. View the tool helper to get tool command description

$ ./CdbRollbackTools -h

2. View tool version

$ ./CdbRollbackTools -v

3. Execute database rollback

$ ./CdbRollbackTools start appid instanceName dbName destdbName rollbackPoint user passwd strategy token

4. Execute table rollback

$ ./CdbRollbackTools start appid instanceName dbName tableName destTableName rollbackPoint user passwd strategy token

2.3 Executing Rollback Task

1. Command Example

$ ./CdbRollbackTools start 125000000 16_test_2011_10_31 rb_database rb_table rb_dest_table_1 201209251650 user passwd full e827a9de-06f0-11e2-81d1-781dbace8354

2. Input Parameter Description

Name Description
start Command type. It means initiating a rollback task.
appid Cloud service account of the application for rollback, beginning with 125 (it can be queried on the overview page). The machine using the rollback tool must be under this account.
instanceName Name of instance to be rolled back. It must be under the appid.
dbName Name of database to be rolled back. It must be under the instanceName.
tableName Name of table to be rolled back. It must be under the dbName.
destdbName Name of the destination database, which cannot exist. A new database with this name will be created under the instanceName. The rolled back data will be in this database.
destTableName Name of the destination table, which cannot exist. A new table with this name will be created under the dbName. The rolled back data will be in this table.
rollbackPoint Time to which the data need to be rolled back. It must be in such a format as 201209251650, meaning September 25, 2012, 16:50.
user Username of dbName.
passwd Password of dbName. If the password contains special symbols such as $ and *, you need to include the password in single quotation marks, for example 'cdb$123*CDB'.
strategy Rollback types:

db: Roll back images and flows of dbName database. It is suitable for sql operations within the same database.
full: Roll back all images and flows. It is suitable for all types of sql operations, but is less efficient.

token Key for rollback. Please enter: rollback-tencent-cloud-token.

If the rollback is not allowed, please contact us and submit a ticket.

3.Execution Results

If the command execution succeeds, the tool will output the following results:

start ok, appId:125000000 instName:16_test_2011_10_31 dbName:rb_database tableName:rb_table timePoint:201209251650 destTableName:rb_dest_table_1

If the command execution fails, the tool will output the following results:

execute failed:cdb rollback internal error

4.Error Code Description

Error Code Description
0 Task is initiated successfully
-1 Task is received and is in queue
-50 Cloud database internal error
-51 Cloud database is under maintenance
-100 Permission error. Please check whether the downloaded tool has execution permission
-110 token does not exist
-111 token has been used
-120 Incorrect timepoint format
-121 timepoint is too early
-122 timepoint is too late

2.4 Querying Rollback Progress

1. Command Example

$ ./CdbRollbackTools query 125000000

2. Input Parameter Description

Name Description
query Command type. It means querying a rollback task.
app_id Cloud service account of the application for query, beginning with 125 (it can be queried on the overview page). The query command will make all the rollback tasks under the app_id listed.

3. Execution Results

If the command execution succeeds, the tool will output the following results:

appId:125000000 instName:16_test_2011_10_31 dbName:rb_database tableName:rb_table rollbackPoint:201209251650 NewTableName:rb_dest_table_1 strategy:full stat:100% createTime:2012-9-25 17:11:5

If the command execution fails, the tool will output the following results:

execute failed:cdb rollback internal error

4. Output Parameter Description

Name Description
appId Cloud service account for rollback
instName Name of instance to be rolled back
dbName Name of database to be rolled back
tableName Name of table to be rolled back
newdbName Destination database name for rollback
newTableName Destination table name for rollback
rollbackPoint Rollback timepoint
strategy Strategy selected for rollback
stat Status of rollback task:

100%: Task completed
0% - 99%: Task in progress
Failed: Task failed

createTime Task initiation time