improve driver
This commit is contained in:
parent
cd4e1ead62
commit
43fe67a8cb
|
@ -62,6 +62,9 @@ DB_DUMP_DIR = None
|
|||
if DB_TYPE == 'mysql':
|
||||
BASE_DB_CONF = {
|
||||
'innodb_monitor_enable': 'all',
|
||||
# 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,
|
||||
}
|
||||
elif DB_TYPE == 'postgres':
|
||||
BASE_DB_CONF = {
|
||||
|
|
|
@ -234,7 +234,10 @@ def change_conf(next_conf=None):
|
|||
assert isinstance(dconf.BASE_DB_CONF, dict), \
|
||||
(type(dconf.BASE_DB_CONF), dconf.BASE_DB_CONF)
|
||||
for name, value in sorted(dconf.BASE_DB_CONF.items()):
|
||||
lines.append('{} = {}\n'.format(name, value))
|
||||
if value is None:
|
||||
lines.append('{}\n'.format(name))
|
||||
else:
|
||||
lines.append('{} = {}\n'.format(name, value))
|
||||
|
||||
if isinstance(next_conf, str):
|
||||
with open(next_conf, 'r') as f:
|
||||
|
@ -260,7 +263,7 @@ def change_conf(next_conf=None):
|
|||
f.write(''.join(lines))
|
||||
|
||||
sudo('cp {0} {0}.ottertune.bak'.format(dconf.DB_CONF), remote_only=True)
|
||||
put(tmp_conf_out, dconf.DB_CONF, use_sudo=False)
|
||||
put(tmp_conf_out, dconf.DB_CONF, use_sudo=True)
|
||||
local('rm -f {} {}'.format(tmp_conf_in, tmp_conf_out))
|
||||
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ def put(local_path, remote_path, use_sudo=False):
|
|||
if dconf.DB_CONF_MOUNT is True:
|
||||
res = _put(local_path, remote_path, use_sudo=use_sudo)
|
||||
else:
|
||||
res = _put(local_path, local_path, use_sudo=True)
|
||||
res = _put(local_path, local_path, use_sudo=use_sudo)
|
||||
res = sudo(docker_cmd, remote_only=True)
|
||||
else:
|
||||
raise Exception('wrong HOST_CONN type {}'.format(dconf.HOST_CONN))
|
||||
|
|
Loading…
Reference in New Issue