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 */
018
019package org.apache.hadoop.hbase.backup;
020
021import org.apache.hadoop.hbase.HConstants;
022import org.apache.yetus.audience.InterfaceAudience;
023
024/**
025 * BackupRestoreConstants holds a bunch of HBase Backup and Restore constants
026 */
027@InterfaceAudience.Private
028public interface BackupRestoreConstants {
029  /*
030   * Backup/Restore constants
031   */
032  String BACKUP_SYSTEM_TABLE_NAME_KEY = "hbase.backup.system.table.name";
033  String BACKUP_SYSTEM_TABLE_NAME_DEFAULT = "backup:system";
034
035  String BACKUP_SYSTEM_TTL_KEY = "hbase.backup.system.ttl";
036
037  int BACKUP_SYSTEM_TTL_DEFAULT = HConstants.FOREVER;
038  String BACKUP_ENABLE_KEY = "hbase.backup.enable";
039  boolean BACKUP_ENABLE_DEFAULT = false;
040
041  String BACKUP_MAX_ATTEMPTS_KEY = "hbase.backup.attempts.max";
042  int DEFAULT_BACKUP_MAX_ATTEMPTS = 10;
043
044  String BACKUP_ATTEMPTS_PAUSE_MS_KEY = "hbase.backup.attempts.pause.ms";
045  int DEFAULT_BACKUP_ATTEMPTS_PAUSE_MS = 10000;
046
047  /*
048   *  Drivers option list
049   */
050  String OPTION_OVERWRITE = "o";
051  String OPTION_OVERWRITE_DESC = "Overwrite data if any of the restore target tables exists";
052
053  String OPTION_CHECK = "c";
054  String OPTION_CHECK_DESC =
055      "Check restore sequence and dependencies only (does not execute the command)";
056
057  String OPTION_SET = "s";
058  String OPTION_SET_DESC = "Backup set name";
059  String OPTION_SET_RESTORE_DESC = "Backup set to restore, mutually exclusive with -t (table list)";
060  String OPTION_SET_BACKUP_DESC = "Backup set to backup, mutually exclusive with -t (table list)";
061  String OPTION_DEBUG = "d";
062  String OPTION_DEBUG_DESC = "Enable debug loggings";
063
064  String OPTION_TABLE = "t";
065  String OPTION_TABLE_DESC = "Table name. If specified, only backup images,"
066      + " which contain this table will be listed.";
067
068  String OPTION_LIST = "l";
069  String OPTION_TABLE_LIST_DESC = "Table name list, comma-separated.";
070  String OPTION_BACKUP_LIST_DESC = "Backup ids list, comma-separated.";
071
072  String OPTION_BANDWIDTH = "b";
073  String OPTION_BANDWIDTH_DESC = "Bandwidth per task (MapReduce task) in MB/s";
074
075  String OPTION_WORKERS = "w";
076  String OPTION_WORKERS_DESC = "Number of parallel MapReduce tasks to execute";
077
078  String OPTION_RECORD_NUMBER = "n";
079  String OPTION_RECORD_NUMBER_DESC = "Number of records of backup history. Default: 10";
080
081  String OPTION_PATH = "p";
082  String OPTION_PATH_DESC = "Backup destination root directory path";
083
084  String OPTION_KEEP = "k";
085  String OPTION_KEEP_DESC = "Specifies maximum age of backup (in days) to keep during bulk delete";
086
087
088  String OPTION_TABLE_MAPPING = "m";
089  String OPTION_TABLE_MAPPING_DESC =
090      "A comma separated list of target tables. "
091          + "If specified, each table in <tables> must have a mapping";
092  String OPTION_YARN_QUEUE_NAME = "q";
093  String OPTION_YARN_QUEUE_NAME_DESC = "Yarn queue name to run backup create command on";
094  String OPTION_YARN_QUEUE_NAME_RESTORE_DESC = "Yarn queue name to run backup restore command on";
095
096  String JOB_NAME_CONF_KEY = "mapreduce.job.name";
097
098  String BACKUP_CONFIG_STRING = BackupRestoreConstants.BACKUP_ENABLE_KEY
099          + "=true\n"
100          + "hbase.master.logcleaner.plugins="
101          +"YOUR_PLUGINS,org.apache.hadoop.hbase.backup.master.BackupLogCleaner\n"
102          + "hbase.procedure.master.classes=YOUR_CLASSES,"
103          +"org.apache.hadoop.hbase.backup.master.LogRollMasterProcedureManager\n"
104          + "hbase.procedure.regionserver.classes=YOUR_CLASSES,"
105          + "org.apache.hadoop.hbase.backup.regionserver.LogRollRegionServerProcedureManager\n"
106          + "hbase.coprocessor.region.classes=YOUR_CLASSES,"
107          + "org.apache.hadoop.hbase.backup.BackupObserver\n"
108          + "and restart the cluster\n";
109  String ENABLE_BACKUP = "Backup is not enabled. To enable backup, "+
110      "in hbase-site.xml, set:\n "
111      + BACKUP_CONFIG_STRING;
112
113  String VERIFY_BACKUP = "Please make sure that backup is enabled on the cluster. To enable "
114          + "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, CANCEL, DELETE, DESCRIBE, HISTORY, STATUS, CONVERT, MERGE, STOP, SHOW, HELP, PROGRESS,
127    SET, SET_ADD, SET_REMOVE, SET_DELETE, SET_DESCRIBE, SET_LIST, REPAIR
128  }
129}