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.hadoop.hbase.NamespaceDescriptor; 022import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; 023import org.apache.yetus.audience.InterfaceAudience; 024 025/** 026 * BackupRestoreConstants holds a bunch of HBase Backup and Restore constants 027 */ 028@InterfaceAudience.Private 029public interface BackupRestoreConstants { 030 /* 031 * Backup/Restore constants 032 */ 033 String BACKUP_SYSTEM_TABLE_NAME_KEY = "hbase.backup.system.table.name"; 034 String BACKUP_SYSTEM_TABLE_NAME_DEFAULT = 035 NamespaceDescriptor.BACKUP_NAMESPACE_NAME_STR + ":system"; 036 037 String BACKUP_SYSTEM_TTL_KEY = "hbase.backup.system.ttl"; 038 039 int BACKUP_SYSTEM_TTL_DEFAULT = HConstants.FOREVER; 040 String BACKUP_ENABLE_KEY = "hbase.backup.enable"; 041 boolean BACKUP_ENABLE_DEFAULT = false; 042 043 String BACKUP_MAX_ATTEMPTS_KEY = "hbase.backup.attempts.max"; 044 int DEFAULT_BACKUP_MAX_ATTEMPTS = 10; 045 046 String BACKUP_ATTEMPTS_PAUSE_MS_KEY = "hbase.backup.attempts.pause.ms"; 047 int DEFAULT_BACKUP_ATTEMPTS_PAUSE_MS = 10000; 048 049 /* 050 * Drivers option list 051 */ 052 String OPTION_OVERWRITE = "o"; 053 String OPTION_OVERWRITE_DESC = "Overwrite data if any of the restore target tables exists"; 054 055 String OPTION_CHECK = "c"; 056 String OPTION_CHECK_DESC = 057 "Check restore sequence and dependencies only (does not execute the command)"; 058 059 String OPTION_SET = "s"; 060 String OPTION_SET_DESC = "Backup set name"; 061 String OPTION_SET_RESTORE_DESC = "Backup set to restore, mutually exclusive with -t (table list)"; 062 String OPTION_SET_BACKUP_DESC = "Backup set to backup, mutually exclusive with -t (table list)"; 063 String OPTION_DEBUG = "d"; 064 String OPTION_DEBUG_DESC = "Enable debug loggings"; 065 066 String OPTION_TABLE = "t"; 067 String OPTION_TABLE_DESC = 068 "Table name. If specified, only backup images, which contain this table will be listed."; 069 070 String OPTION_LIST = "l"; 071 String OPTION_TABLE_LIST_DESC = "Table name list, comma-separated."; 072 String OPTION_BACKUP_LIST_DESC = "Backup ids list, comma-separated."; 073 074 String OPTION_BANDWIDTH = "b"; 075 String OPTION_BANDWIDTH_DESC = "Bandwidth per task (MapReduce task) in MB/s"; 076 077 String OPTION_WORKERS = "w"; 078 String OPTION_WORKERS_DESC = "Number of parallel MapReduce tasks to execute"; 079 080 String OPTION_IGNORECHECKSUM = "i"; 081 String OPTION_IGNORECHECKSUM_DESC = 082 "Ignore checksum verify between source snapshot and exported snapshot." 083 + " Especially when the source and target file system types are different," 084 + " we should use -i option to skip checksum-checks."; 085 086 String OPTION_RECORD_NUMBER = "n"; 087 String OPTION_RECORD_NUMBER_DESC = "Number of records of backup history. Default: 10"; 088 089 String OPTION_PATH = "p"; 090 String OPTION_PATH_DESC = "Backup destination root directory path"; 091 092 String OPTION_KEEP = "k"; 093 String OPTION_KEEP_DESC = "Specifies maximum age of backup (in days) to keep during bulk delete"; 094 095 String OPTION_TABLE_MAPPING = "m"; 096 String OPTION_TABLE_MAPPING_DESC = "A comma separated list of target tables. " 097 + "If specified, each table in <tables> must have a mapping"; 098 String OPTION_YARN_QUEUE_NAME = "q"; 099 String OPTION_YARN_QUEUE_NAME_DESC = "Yarn queue name to run backup create command on"; 100 String OPTION_YARN_QUEUE_NAME_RESTORE_DESC = "Yarn queue name to run backup restore command on"; 101 102 String JOB_NAME_CONF_KEY = "mapreduce.job.name"; 103 104 String BACKUP_CONFIG_STRING = BackupRestoreConstants.BACKUP_ENABLE_KEY + "=true\n" 105 + "hbase.master.logcleaner.plugins=" 106 + "YOUR_PLUGINS,org.apache.hadoop.hbase.backup.master.BackupLogCleaner\n" 107 + "hbase.procedure.master.classes=YOUR_CLASSES," 108 + "org.apache.hadoop.hbase.backup.master.LogRollMasterProcedureManager\n" 109 + "hbase.procedure.regionserver.classes=YOUR_CLASSES," 110 + "org.apache.hadoop.hbase.backup.regionserver.LogRollRegionServerProcedureManager\n" 111 + CoprocessorHost.REGION_COPROCESSOR_CONF_KEY + "=YOUR_CLASSES," 112 + BackupObserver.class.getSimpleName() + "\n" + CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY 113 + "=YOUR_CLASSES," + BackupMasterObserver.class.getSimpleName() + "\nand restart the cluster\n" 114 + "For more information please see http://hbase.apache.org/book.html#backuprestore\n"; 115 String ENABLE_BACKUP = "Backup is not enabled. To enable backup, " + "in hbase-site.xml, set:\n " 116 + BACKUP_CONFIG_STRING; 117 118 String VERIFY_BACKUP = "To enable backup, in hbase-site.xml, set:\n " + BACKUP_CONFIG_STRING; 119 120 /* 121 * Delimiter in table name list in restore command 122 */ 123 String TABLENAME_DELIMITER_IN_COMMAND = ","; 124 125 String CONF_STAGING_ROOT = "snapshot.export.staging.root"; 126 127 String BACKUPID_PREFIX = "backup_"; 128 129 enum BackupCommand { 130 CREATE, 131 CANCEL, 132 DELETE, 133 DESCRIBE, 134 HISTORY, 135 STATUS, 136 CONVERT, 137 MERGE, 138 STOP, 139 SHOW, 140 HELP, 141 PROGRESS, 142 SET, 143 SET_ADD, 144 SET_REMOVE, 145 SET_DELETE, 146 SET_DESCRIBE, 147 SET_LIST, 148 REPAIR 149 } 150}