mycnf

package
v0.20.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const InnoDBBufferPoolRatioPercent = 70

InnoDBBufferPoolRatioPercent is the ratio of InnoDB buffer pool size to resource.requests.memory. Note that the pool size can't be lower than 128MiB, which is the default value of `innodb_buffer_pool_size`.

Variables

View Source
var ConstMycnf = map[string]map[string]string{
	"mysqld": {
		"port":             strconv.Itoa(constants.MySQLPort),
		"socket":           filepath.Join(constants.RunPath, "mysqld.sock"),
		"datadir":          filepath.Join(constants.MySQLDataPath, "data"),
		"secure_file_priv": "NULL",

		"skip_name_resolve": "ON",

		"slow_query_log_file": filepath.Join(constants.LogDirPath, constants.MySQLSlowLogName),

		"enforce_gtid_consistency": "ON",
		"gtid_mode":                "ON",
		"binlog_format":            "ROW",
		"log_slave_updates":        "ON",
		"relay_log_recovery":       "OFF",

		"mysqlx_port": strconv.Itoa(constants.MySQLXPort),
		"admin_port":  strconv.Itoa(constants.MySQLAdminPort),

		"pid_file": filepath.Join(constants.RunPath, "mysqld.pid"),

		"read_only":        "ON",
		"super_read_only":  "ON",
		"skip_slave_start": "ON",

		"loose_replication_optimize_for_static_plugin_config": "ON",

		"loose_replication_sender_observe_commit_only": "OFF",
	},
	"client": {
		"port":   strconv.Itoa(constants.MySQLPort),
		"socket": filepath.Join(constants.RunPath, "mysqld.sock"),

		"loose_default_character_set": "utf8mb4",
	},
	"mysql": {
		"auto_rehash":  "OFF",
		"init_command": `"SET autocommit=0"`,
	},
}

ConstMycnf is the mysqld configurations that MOCO applies forcibly.

View Source
var DefaultMycnf = map[string]string{
	"tmpdir":               constants.TmpPath,
	"innodb_tmpdir":        constants.TmpPath,
	"character_set_server": "utf8mb4",
	"collation_server":     "utf8mb4_unicode_ci",

	"default_time_zone": "+0:00",

	"back_log":            "900",
	"max_connections":     "100000",
	"max_allowed_packet":  "1G",
	"max_heap_table_size": "64M",
	"sort_buffer_size":    "4M",
	"join_buffer_size":    "2M",
	"thread_cache_size":   "100",
	"wait_timeout":        "604800",
	"lock_wait_timeout":   "60",

	"table_open_cache":       "65536",
	"table_definition_cache": "65536",

	"transaction_isolation": "READ-COMMITTED",
	"tmp_table_size":        "64M",
	"slow_query_log":        "ON",
	"long_query_time":       "2",
	"log_error_verbosity":   "3",
	"log_slow_extra":        "ON",

	"max_sp_recursion_depth": "20",

	"print_identified_with_as_hex": "ON",

	"loose_binlog_transaction_compression": "ON",

	"temptable_use_mmap": "OFF",

	"information_schema_stats_expiry": "0",

	"disabled_storage_engines": "MyISAM",
	"default_storage_engine":   "InnoDB",

	"innodb_flush_method":                 "O_DIRECT",
	"innodb_lock_wait_timeout":            "60",
	"innodb_print_all_deadlocks":          "1",
	"innodb_online_alter_log_max_size":    "1073741824",
	"innodb_adaptive_hash_index":          "ON",
	"loose_innodb_numa_interleave":        "ON",
	"innodb_buffer_pool_in_core_file":     "OFF",
	"innodb_log_file_size":                "800M",
	"innodb_log_files_in_group":           "2",
	"innodb_buffer_pool_dump_pct":         "100",
	"innodb_buffer_pool_dump_at_shutdown": "1",
	"innodb_buffer_pool_load_at_startup":  "0",

	"loose_innodb_validate_tablespace_paths": "OFF",

	"innodb_flush_neighbors":      "0",
	"innodb_random_read_ahead":    "false",
	"innodb_read_ahead_threshold": "0",
	"innodb_log_write_ahead_size": "512",

	"innodb_undo_log_truncate": "OFF",
}

DefaultMycnf is the default options of mysqld. These can be overridden by users.

Functions

func Generate

func Generate(userConf map[string]string, memTotal int64) string

Generate generates my.cnf contents.

If `userConf` does not specify `innodb_buffer_pool_size`, this will automatically set it to 70% of `memTotal`.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL