diff --git a/client/driver/driver_config.py b/client/driver/driver_config.py index 7451385..37be5b3 100644 --- a/client/driver/driver_config.py +++ b/client/driver/driver_config.py @@ -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 = { diff --git a/client/driver/fabfile.py b/client/driver/fabfile.py index 99a5d14..06e47c3 100644 --- a/client/driver/fabfile.py +++ b/client/driver/fabfile.py @@ -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)) diff --git a/client/driver/utils.py b/client/driver/utils.py index 712046f..37f4f49 100644 --- a/client/driver/utils.py +++ b/client/driver/utils.py @@ -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))