ottertune/client/driver/driver_config.py

191 lines
5.6 KiB
Python
Raw Permalink Normal View History

import os
#==========================================================
# HOST LOGIN
#==========================================================
# Location of the database host relative to this driver
2020-04-23 00:46:58 -07:00
# Valid values: local, remote, docker or remote_docker
HOST_CONN = 'local'
# The name of the Docker container for the target database
# (only required if HOST_CONN = docker)
CONTAINER_NAME = None # e.g., 'postgres_container'
# Host SSH login credentials (only required if HOST_CONN=remote)
LOGIN_NAME = None
LOGIN_HOST = None
2020-04-23 00:46:58 -07:00
LOGIN_PASSWORD = None
LOGIN_PORT = None # Set when using a port other than the SSH default
#==========================================================
# DATABASE OPTIONS
#==========================================================
2020-04-23 00:46:58 -07:00
# Postgres, Oracle or Mysql
DB_TYPE = 'postgres'
# Database version
DB_VERSION = '9.6'
# Name of the database
DB_NAME = 'tpcc'
# Database username
DB_USER = 'dbuser'
# Password for DB_USER
DB_PASSWORD = 'dbpassword'
2019-11-18 08:23:15 -08:00
# Database admin username (for tasks like restarting the database)
ADMIN_USER = DB_USER
# Database host address
DB_HOST = 'localhost'
# Database port
DB_PORT = '5432'
2020-05-03 23:24:33 -07:00
# If set to True, DB_CONF file is mounted to database container file
# Only available when HOST_CONN is docker or remote_docker
2020-05-03 23:33:07 -07:00
DB_CONF_MOUNT = False
2020-05-03 23:24:33 -07:00
# Path to the configuration file on the database server
2020-05-03 23:24:33 -07:00
# If DB_CONF_MOUNT is True, the path is on the host server, not docker
DB_CONF = '/etc/postgresql/9.6/main/postgresql.conf'
# Path to the directory for storing database dump files
2020-04-26 01:38:28 -07:00
DB_DUMP_DIR = None
# Base config settings to always include when installing new configurations
2020-04-23 00:46:58 -07:00
if DB_TYPE == 'mysql':
BASE_DB_CONF = {
'innodb_monitor_enable': 'all',
2020-05-21 12:21:46 -07:00
# Do not generate binlog, otherwise the disk space will grow continuely during the tuning
# Be careful about it when tuning a production database, it changes your binlog behavior.
'skip-log-bin': None,
2020-04-23 00:46:58 -07:00
}
elif DB_TYPE == 'postgres':
BASE_DB_CONF = {
'track_counts': 'on',
'track_functions': 'all',
'track_io_timing': 'on',
'autovacuum': 'off',
}
else:
BASE_DB_CONF = None
# Name of the device on the database server to monitor the disk usage, or None to disable
DATABASE_DISK = None
# Set this to a different database version to override the current version
OVERRIDE_DB_VERSION = None
# POSTGRES-SPECIFIC OPTIONS >>>
PG_DATADIR = '/var/lib/postgresql/9.6/main'
# ORACLE-SPECIFIC OPTIONS >>>
ORACLE_AWR_ENABLED = False
ORACLE_FLASH_BACK = True
RESTORE_POINT = 'tpcc_point'
RECOVERY_FILE_DEST = '/opt/oracle/oradata/ORCL'
RECOVERY_FILE_DEST_SIZE = '15G'
#==========================================================
# DRIVER OPTIONS
#==========================================================
# Path to this driver
DRIVER_HOME = os.path.dirname(os.path.realpath(__file__))
# Path to the directory for storing results
RESULT_DIR = os.path.join(DRIVER_HOME, 'results')
2020-04-27 17:14:18 -07:00
# Set this to add user defined metrics
2020-04-27 21:21:04 -07:00
ENABLE_UDM = False
2020-04-27 17:14:18 -07:00
# Path to the User Defined Metrics (UDM), only required when ENABLE_UDM is True
UDM_DIR = os.path.join(DRIVER_HOME, 'userDefinedMetrics')
# Path to temp directory
TEMP_DIR = '/tmp/driver'
# Path to the directory for storing database dump files
2020-04-23 00:46:58 -07:00
if DB_DUMP_DIR is None:
2020-04-26 01:38:28 -07:00
if HOST_CONN == 'local':
DB_DUMP_DIR = os.path.join(DRIVER_HOME, 'dumpfiles')
2020-04-26 01:57:04 -07:00
if not os.path.exists(DB_DUMP_DIR):
os.mkdir(DB_DUMP_DIR)
2020-04-26 01:38:28 -07:00
else:
2020-04-26 01:57:04 -07:00
DB_DUMP_DIR = os.path.expanduser('~/')
# Reload the database after running this many iterations
RELOAD_INTERVAL = 10
# The maximum allowable disk usage percentage. Reload the database
# whenever the current disk usage exceeds this value.
MAX_DISK_USAGE = 90
# Execute this many warmup iterations before uploading the next result
# to the website
WARMUP_ITERATIONS = 0
# Let the database initialize for this many seconds after it restarts
2020-04-23 00:46:58 -07:00
RESTART_SLEEP_SEC = 30
#==========================================================
# OLTPBENCHMARK OPTIONS
#==========================================================
# Path to OLTPBench directory
OLTPBENCH_HOME = os.path.expanduser('~/oltpbench')
# Path to the OLTPBench configuration file
OLTPBENCH_CONFIG = os.path.join(OLTPBENCH_HOME, 'config/tpcc_config_postgres.xml')
# Name of the benchmark to run
OLTPBENCH_BENCH = 'tpcc'
#==========================================================
# CONTROLLER OPTIONS
#==========================================================
2020-05-28 21:17:35 -07:00
# Controller observation time, OLTPBench will be disabled for
# monitoring if the time is specified
CONTROLLER_OBSERVE_SEC = 100
# Path to the controller directory
2020-04-23 00:46:58 -07:00
CONTROLLER_HOME = DRIVER_HOME + '/../controller'
# Path to the controller configuration file
2020-04-26 01:38:28 -07:00
CONTROLLER_CONFIG = os.path.join(CONTROLLER_HOME, 'config/{}_config.json'.format(DB_TYPE))
#==========================================================
# LOGGING OPTIONS
#==========================================================
LOG_LEVEL = 'DEBUG'
# Path to log directory
LOG_DIR = os.path.join(DRIVER_HOME, 'log')
# Log files
DRIVER_LOG = os.path.join(LOG_DIR, 'driver.log')
OLTPBENCH_LOG = os.path.join(LOG_DIR, 'oltpbench.log')
CONTROLLER_LOG = os.path.join(LOG_DIR, 'controller.log')
#==========================================================
# WEBSITE OPTIONS
#==========================================================
# OtterTune website URL
WEBSITE_URL = 'http://127.0.0.1:8000'
# Code for uploading new results to the website
UPLOAD_CODE = 'I5I10PXK3PK27FM86YYS'