001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.backup; 019 020import org.apache.hadoop.hbase.HConstants; 021import org.apache.yetus.audience.InterfaceAudience; 022 023/** 024 * BackupRestoreConstants holds a bunch of HBase Backup and Restore constants 025 */ 026@InterfaceAudience.Private 027public interface BackupRestoreConstants { 028 /* 029 * Backup/Restore constants 030 */ 031 String BACKUP_SYSTEM_TABLE_NAME_KEY = "hbase.backup.system.table.name"; 032 String BACKUP_SYSTEM_TABLE_NAME_DEFAULT = "backup:system"; 033 034 String BACKUP_SYSTEM_TTL_KEY = "hbase.backup.system.ttl"; 035 036 int BACKUP_SYSTEM_TTL_DEFAULT = HConstants.FOREVER; 037 String BACKUP_ENABLE_KEY = "hbase.backup.enable"; 038 boolean BACKUP_ENABLE_DEFAULT = false; 039 040 String BACKUP_MAX_ATTEMPTS_KEY = "hbase.backup.attempts.max"; 041 int DEFAULT_BACKUP_MAX_ATTEMPTS = 10; 042 043 String BACKUP_ATTEMPTS_PAUSE_MS_KEY = "hbase.backup.attempts.pause.ms"; 044 int DEFAULT_BACKUP_ATTEMPTS_PAUSE_MS = 10000; 045 046 /* 047 * Drivers option list 048 */ 049 String OPTION_OVERWRITE = "o"; 050 String OPTION_OVERWRITE_DESC = "Overwrite data if any of the restore target tables exists"; 051 052 String OPTION_CHECK = "c"; 053 String OPTION_CHECK_DESC = 054 "Check restore sequence and dependencies only (does not execute the command)"; 055 056 String OPTION_SET = "s"; 057 String OPTION_SET_DESC = "Backup set name"; 058 String OPTION_SET_RESTORE_DESC = "Backup set to restore, mutually exclusive with -t (table list)"; 059 String OPTION_SET_BACKUP_DESC = "Backup set to backup, mutually exclusive with -t (table list)"; 060 String OPTION_DEBUG = "d"; 061 String OPTION_DEBUG_DESC = "Enable debug loggings"; 062 063 String OPTION_TABLE = "t"; 064 String OPTION_TABLE_DESC = 065 "Table name. If specified, only backup images, which contain this table will be listed."; 066 067 String OPTION_LIST = "l"; 068 String OPTION_TABLE_LIST_DESC = "Table name list, comma-separated."; 069 String OPTION_BACKUP_LIST_DESC = "Backup ids list, comma-separated."; 070 071 String OPTION_BANDWIDTH = "b"; 072 String OPTION_BANDWIDTH_DESC = "Bandwidth per task (MapReduce task) in MB/s"; 073 074 String OPTION_WORKERS = "w"; 075 String OPTION_WORKERS_DESC = "Number of parallel MapReduce tasks to execute"; 076 077 String OPTION_IGNORECHECKSUM = "i"; 078 String OPTION_IGNORECHECKSUM_DESC = 079 "Ignore checksum verify between source snapshot and exported snapshot." 080 + " Especially when the source and target file system types are different," 081 + " we should use -i option to skip checksum-checks."; 082 083 String OPTION_RECORD_NUMBER = "n"; 084 String OPTION_RECORD_NUMBER_DESC = "Number of records of backup history. Default: 10"; 085 086 String OPTION_PATH = "p"; 087 String OPTION_PATH_DESC = "Backup destination root directory path"; 088 089 String OPTION_KEEP = "k"; 090 String OPTION_KEEP_DESC = "Specifies maximum age of backup (in days) to keep during bulk delete"; 091 092 String OPTION_TABLE_MAPPING = "m"; 093 String OPTION_TABLE_MAPPING_DESC = "A comma separated list of target tables. " 094 + "If specified, each table in <tables> must have a mapping"; 095 String OPTION_YARN_QUEUE_NAME = "q"; 096 String OPTION_YARN_QUEUE_NAME_DESC = "Yarn queue name to run backup create command on"; 097 String OPTION_YARN_QUEUE_NAME_RESTORE_DESC = "Yarn queue name to run backup restore command on"; 098 099 String JOB_NAME_CONF_KEY = "mapreduce.job.name"; 100 101 String BACKUP_CONFIG_STRING = 102 BackupRestoreConstants.BACKUP_ENABLE_KEY + "=true\n" + "hbase.master.logcleaner.plugins=" 103 + "YOUR_PLUGINS,org.apache.hadoop.hbase.backup.master.BackupLogCleaner\n" 104 + "hbase.procedure.master.classes=YOUR_CLASSES," 105 + "org.apache.hadoop.hbase.backup.master.LogRollMasterProcedureManager\n" 106 + "hbase.procedure.regionserver.classes=YOUR_CLASSES," 107 + "org.apache.hadoop.hbase.backup.regionserver.LogRollRegionServerProcedureManager\n" 108 + "hbase.coprocessor.region.classes=YOUR_CLASSES," 109 + "org.apache.hadoop.hbase.backup.BackupObserver\n" + "and restart the cluster\n" 110 + "For more information please see http://hbase.apache.org/book.html#backuprestore\n"; 111 String ENABLE_BACKUP = "Backup is not enabled. To enable backup, " + "in hbase-site.xml, set:\n " 112 + BACKUP_CONFIG_STRING; 113 114 String VERIFY_BACKUP = "To enable backup, in hbase-site.xml, set:\n " + BACKUP_CONFIG_STRING; 115 116 /* 117 * Delimiter in table name list in restore command 118 */ 119 String TABLENAME_DELIMITER_IN_COMMAND = ","; 120 121 String CONF_STAGING_ROOT = "snapshot.export.staging.root"; 122 123 String BACKUPID_PREFIX = "backup_"; 124 125 enum BackupCommand { 126 CREATE, 127 CANCEL, 128 DELETE, 129 DESCRIBE, 130 HISTORY, 131 STATUS, 132 CONVERT, 133 MERGE, 134 STOP, 135 SHOW, 136 HELP, 137 PROGRESS, 138 SET, 139 SET_ADD, 140 SET_REMOVE, 141 SET_DELETE, 142 SET_DESCRIBE, 143 SET_LIST, 144 REPAIR 145 } 146}