########################################################################################
# This config file is parsed using libconfig , and its grammar is described in:
# http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-File-Grammar
# Grammar is also copied at the end of this file
########################################################################################

########################################################################################
# IMPORTANT INFORMATION REGARDING THIS CONFIGURATION FILE:
########################################################################################
# On startup, ProxySQL reads its config file (if present) to determine its datadir.
# What happens next depends on if the database file (disk) is present in the defined
# datadir (i.e. "/var/lib/proxysql/proxysql.db").
#
# If the database file is found, ProxySQL initializes its in-memory configuration from
# the persisted on-disk database. So, disk configuration gets loaded into memory and
# then propagated towards the runtime configuration.
#
# If the database file is not found and a config file exists, the config file is parsed
# and its content is loaded into the in-memory database, to then be both saved on-disk
# database and loaded at runtime.
#
# IMPORTANT: If a database file is found, the config file is NOT parsed. In this case
#            ProxySQL initializes its in-memory configuration from the persisted on-disk
#            database ONLY. In other words, the configuration found in the proxysql.cnf
#            file is only used to initial the on-disk database read on the first startup.
#
# In order to FORCE a re-initialise of the on-disk database from the configuration file
# the ProxySQL service should be started with "service proxysql initial".
#
########################################################################################
admin_variables =
{
	admin_credentials="admin"
	checksum_mysql_query_rules="admin"
	checksum_mysql_servers="admin"
	checksum_mysql_users="admin"
	cluster_check_interval_ms="admin"
	cluster_check_status_frequency="admin"
	cluster_mysql_query_rules_diffs_before_sync="admin"
	cluster_mysql_query_rules_save_to_disk="admin"
	cluster_mysql_servers_diffs_before_sync="admin"
	cluster_mysql_servers_save_to_disk="admin"
	cluster_mysql_users_diffs_before_sync="admin"
	cluster_mysql_users_save_to_disk="admin"
	cluster_password="admin"
	cluster_proxysql_servers_diffs_before_sync="admin"
	cluster_proxysql_servers_save_to_disk="admin"
	cluster_username="admin"
	hash_passwords="admin"
	mysql_ifaces="admin"
	prometheus_memory_metrics_interval="admin"
	read_only="admin"
	refresh_interval="admin"
	restapi_enabled="admin"
	restapi_port="admin"
	stats_credentials="admin"
	stats_mysql_connection_pool="admin"
	stats_mysql_connections="admin"
	stats_mysql_query_cache="admin"
	stats_mysql_query_digest_to_disk="admin"
	stats_system_cpu="admin"
	stats_system_memory="admin"
	telnet_admin_ifaces="admin"
	telnet_stats_ifaces="admin"
	vacuum_stats="admin"
	version="admin"
	web_enabled="admin"
	web_port="admin"
}

mysql_variables = 
{
	add_ldap_user_comment="mysql"
	auditlog_filename="mysql"
	auditlog_filesize="mysql"
	aurora_max_lag_ms_only_read_from_replicas="mysql"
	auto_increment_delay_multiplex="mysql"
	autocommit_false_is_transaction="mysql"
	autocommit_false_not_reusable="mysql"
	automatic_detect_sqli="mysql"
	binlog_reader_connect_retry_msec="mysql"
	client_found_rows="mysql"
	client_multi_statements="mysql"
	client_session_track_gtid="mysql"
	commands_stats="mysql"
	connect_retries_delay="mysql"
	connect_retries_on_failure="mysql"
	connect_timeout_server="mysql"
	connect_timeout_server_max="mysql"
	connection_delay_multiplex_ms="mysql"
	connection_max_age_ms="mysql"
	connection_warming="mysql"
	connpoll_reset_queue_length="mysql"
	default_CHARSET="mysql"
	default_action="mysql"
	default_character_set_client="mysql"
	default_character_set_connection="mysql"
	default_character_set_database="mysql"
	default_character_set_results="mysql"
	default_charset="mysql"
	default_collation_connection="mysql"
	default_group_concat_max_len="mysql"
	default_isolation_level="mysql"
	default_max_join_size="mysql"
	default_max_latency_ms="mysql"
	default_names="mysql"
	default_net_write_timeout="mysql"
	default_query_delay="mysql"
	default_query_timeout="mysql"
	default_reconnect="mysql"
	default_schema="mysql"
	default_session_track_gtids="mysql"
	default_sql_auto_is_null="mysql"
	default_sql_log_bin="mysql"
	default_sql_mode="mysql"
	default_sql_safe_updates="mysql"
	default_sql_select_limit="mysql"
	default_time_zone="mysql"
	default_transaction_read="mysql"
	default_tx_isolation="mysql"
	default_wsrep_sync_wait="mysql"
	enforce_autocommit_on_reads="mysql"
	eventslog_default_log="mysql"
	eventslog_filename="mysql"
	eventslog_filesize="mysql"
	eventslog_format="mysql"
	firewall_whitelist_enabled="mysql"
	firewall_whitelist_errormsg="mysql"
	forward_autocommit="mysql"
	free_connections_pct="mysql"
	handle_unknown_charset="mysql"
	have_compress="mysql"
	have_ssl="mysql"
	hostgroup_manager_verbose="mysql"
	init_connect="mysql"
	interfaces="mysql"
	keep_multiplexing_variables="mysql"
	kill_backend_connection_when_disconnect="mysql"
	ldap_user_variable="mysql"
	log_unhealthy_connections="mysql"
	long_query_time="mysql"
	max_allowed_packet="mysql"
	max_connections="mysql"
	max_stmts_cache="mysql"
	max_stmts_per_connection="mysql"
	max_transaction_time="mysql"
	min_num_servers_lantency_awareness="mysql"
	mirror_max_concurrency="mysql"
	mirror_max_queue_length="mysql"
	monitor_connect_interval="mysql"
	monitor_connect_timeout="mysql"
	monitor_enabled="mysql"
	monitor_galera_healthcheck_interval="mysql"
	monitor_galera_healthcheck_max_timeout_count="mysql"
	monitor_galera_healthcheck_timeout="mysql"
	monitor_groupreplication_healthcheck_interval="mysql"
	monitor_groupreplication_healthcheck_max_timeout_count="mysql"
	monitor_groupreplication_healthcheck_timeout="mysql"
	monitor_groupreplication_max_transactions_behind_count="mysql"
	monitor_history="mysql"
	monitor_password="mysql"
	monitor_ping_interval="mysql"
	monitor_ping_max_failures="mysql"
	monitor_ping_timeout="mysql"
	monitor_query_interval="mysql"
	monitor_query_timeout="mysql"
	monitor_read_only_interval="mysql"
	monitor_read_only_max_timeout_count="mysql"
	monitor_read_only_timeout="mysql"
	monitor_replication_lag_interval="mysql"
	monitor_replication_lag_timeout="mysql"
	monitor_replication_lag_use_percona_heartbeat="mysql"
	monitor_slave_lag_when_null="mysql"
	monitor_threads_max="mysql"
	monitor_threads_min="mysql"
	monitor_threads_queue_maxsize="mysql"
	monitor_username="mysql"
	monitor_wait_timeout="mysql"
	monitor_writer_is_also_reader="mysql"
	multiplexing="mysql"
	ping_interval_server_msec="mysql"
	ping_timeout_server="mysql"
	poll_timeout="mysql"
	poll_timeout_on_failure="mysql"
	query_cache_size_MB="mysql"
	query_cache_stores_empty_result="mysql"
	query_digests="mysql"
	query_digests_lowercase="mysql"
	query_digests_max_digest_length="mysql"
	query_digests_max_query_length="mysql"
	query_digests_no_digits="mysql"
	query_digests_normalize_digest_text="mysql"
	query_digests_replace_null="mysql"
	query_digests_track_hostname="mysql"
	query_processor_iterations="mysql"
	query_processor_regex="mysql"
	query_retries_on_failure="mysql"
	reset_connection_algorithm="mysql"
	server_capabilities="mysql"
	server_version="mysql"
	servers_stats="mysql"
	session_idle_ms="mysql"
	session_idle_show_processlist="mysql"
	sessions_sort="mysql"
	set_query_lock_on_hostgroup="mysql"
	show_processlist_extended="mysql"
	shun_on_failures="mysql"
	shun_recovery_time_sec="mysql"
	ssl_p2s_ca="mysql"
	ssl_p2s_cert="mysql"
	ssl_p2s_cipher="mysql"
	ssl_p2s_key="mysql"
	stacksize="mysql"
	stats_time_backend_query="mysql"
	stats_time_query_processor="mysql"
	tcp_keepalive_time="mysql"
	threads="mysql"
	threshold_query_length="mysql"
	threshold_resultset_size="mysql"
	throttle_connections_per_sec_to_hostgroup="mysql"
	throttle_max_bytes_per_second_to_client="mysql"
	throttle_ratio_server_to_client="mysql"
	use_tcp_keepalive="mysql"
	verbose_query_error="mysql"
	wait_timeout="mysql"
}
mysql_users:
(
	{
		username="user"
		password="password"
		active=1
		use_ssl=0
		default_hostgroup=0
		default_schema="schema"
		schema_locked=1
		transaction_persistent=0
		fast_forward=1
		backend=1
		frontend=1
		max_connections=10
		comment="comm1"
	}
)
mysql_query_rules:
(
	{
		rule_id=1
		active=1
		username="user"
		schemaname="schema"
		flagIN=0
		client_addr=".domain.com"
		proxy_addr=".proxy.com"
		proxy_port=3333
		digest="ABC1"
		match_digest="ABC"
		match_pattern="^SELECT *"
		negate_match_pattern=0
		re_modifiers="CASE"
		flagOUT=0
		replace_pattern="1"
		destination_hostgroup=1
		cache_ttl=1
		cache_empty_result=1
		cache_timeout=100
		reconnect=1
		timeout=1
		retries=100
		delay=100
		next_query_flagIN=0
		mirror_flagOUT=0
		mirror_hostgroup=1
		error_msg="Error"
		OK_msg="OK"
		sticky_conn=0
		multiplex=0
		gtid_from_hostgroup=0
		log=0
		apply=0
		comment="comm1"
	}
)
mysql_servers:
(
	{
		hostgroup_id=0
		hostname="127.0.0.1"
		port=3306
		gtid_port=0
		status="ONLINE"
		weight=1
		compression=0
		max_connections=1000
		max_replication_lag=0
		use_ssl=0
		max_latency_ms=0
		comment="comment2"
	}
)
mysql_replication_hostgroups:
(
	{
		writer_hostgroup=10
		reader_hostgroup=20
		check_type="read_only"
		comment="Master / Slave App 1"
	}
)
mysql_group_replication_hostgroups:
(
	{
		writer_hostgroup=1
		backup_writer_hostgroup=2
		reader_hostgroup=3
		offline_hostgroup=4
		active=1
		max_writers=23
		writer_is_also_reader=1
		max_transactions_behind=1
		comment="comment"
	}
)
mysql_galera_hostgroups:
(
	{
		writer_hostgroup=1
		backup_writer_hostgroup=2
		reader_hostgroup=3
		offline_hostgroup=4
		active=1
		max_writers=23
		writer_is_also_reader=1
		max_transactions_behind=1
		comment="comment"
	}
)
mysql_aws_aurora_hostgroups:
(
	{
		writer_hostgroup=1
		reader_hostgroup=2
		active=1
		aurora_port=3
		domain_name=".domain.net"
		max_lag_ms=20
		check_interval_ms=106
		check_timeout_ms=107
		writer_is_also_reader=1
		new_reader_weight=9
		add_lag_ms=10
		min_lag_ms=20
		lag_num_checks=1
		comment="comment"
	}
)
scheduler:
(
	{
		id=1
		active=1
		interval_ms=1000
		filename="filename"
		arg1="a1"
		arg2="a2"
		arg3="a3"
		arg4="a4"
		arg5="a5"
		comment="comment"
	}
)
restapi:
(
	{
		id=1
		active=1
		interval_ms=1000
		method=GET
		uri="test"
		script="./scripts/script.py"
		comment="comment"
	}
)
proxysql_servers:
(
	{
		hostname="hostname"
		port=3333
		weight=12
		comment="comment"
	}
)
