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_RECORD_NUMBER = "n";
078  String OPTION_RECORD_NUMBER_DESC = "Number of records of backup history. Default: 10";
079
080  String OPTION_PATH = "p";
081  String OPTION_PATH_DESC = "Backup destination root directory path";
082
083  String OPTION_KEEP = "k";
084  String OPTION_KEEP_DESC = "Specifies maximum age of backup (in days) to keep during bulk delete";
085
086  String OPTION_TABLE_MAPPING = "m";
087  String OPTION_TABLE_MAPPING_DESC = "A comma separated list of target tables. "
088    + "If specified, each table in <tables> must have a mapping";
089  String OPTION_YARN_QUEUE_NAME = "q";
090  String OPTION_YARN_QUEUE_NAME_DESC = "Yarn queue name to run backup create command on";
091  String OPTION_YARN_QUEUE_NAME_RESTORE_DESC = "Yarn queue name to run backup restore command on";
092
093  String JOB_NAME_CONF_KEY = "mapreduce.job.name";
094
095  String BACKUP_CONFIG_STRING =
096    BackupRestoreConstants.BACKUP_ENABLE_KEY + "=true\n" + "hbase.master.logcleaner.plugins="
097      + "YOUR_PLUGINS,org.apache.hadoop.hbase.backup.master.BackupLogCleaner\n"
098      + "hbase.procedure.master.classes=YOUR_CLASSES,"
099      + "org.apache.hadoop.hbase.backup.master.LogRollMasterProcedureManager\n"
100      + "hbase.procedure.regionserver.classes=YOUR_CLASSES,"
101      + "org.apache.hadoop.hbase.backup.regionserver.LogRollRegionServerProcedureManager\n"
102      + "hbase.coprocessor.region.classes=YOUR_CLASSES,"
103      + "org.apache.hadoop.hbase.backup.BackupObserver\n" + "and restart the cluster\n"
104      + "For more information please see http://hbase.apache.org/book.html#backuprestore\n";
105  String ENABLE_BACKUP = "Backup is not enabled. To enable backup, " + "in hbase-site.xml, set:\n "
106    + BACKUP_CONFIG_STRING;
107
108  String VERIFY_BACKUP = "To enable backup, in hbase-site.xml, set:\n " + BACKUP_CONFIG_STRING;
109
110  /*
111   * Delimiter in table name list in restore command
112   */
113  String TABLENAME_DELIMITER_IN_COMMAND = ",";
114
115  String CONF_STAGING_ROOT = "snapshot.export.staging.root";
116
117  String BACKUPID_PREFIX = "backup_";
118
119  enum BackupCommand {
120    CREATE,
121    CANCEL,
122    DELETE,
123    DESCRIBE,
124    HISTORY,
125    STATUS,
126    CONVERT,
127    MERGE,
128    STOP,
129    SHOW,
130    HELP,
131    PROGRESS,
132    SET,
133    SET_ADD,
134    SET_REMOVE,
135    SET_DELETE,
136    SET_DESCRIBE,
137    SET_LIST,
138    REPAIR
139  }
140}