mirror of https://github.com/sysown/proxysql
Merge pull request #2413 from val214/v2.0.9-select-config-file
V2.0.9 select config file [FR]pull/2443/head
commit
b59fad2d42
@ -0,0 +1,30 @@
|
||||
#ifndef __PROXYSQL_CONFIG_H__
|
||||
#define __PROXYSQL_CONFIG_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
class SQLite3DB;
|
||||
|
||||
class ProxySQL_Config {
|
||||
SQLite3DB* admindb;
|
||||
public:
|
||||
ProxySQL_Config(SQLite3DB* db);
|
||||
virtual ~ProxySQL_Config();
|
||||
|
||||
int Read_Global_Variables_from_configfile(const char *prefix);
|
||||
int Read_MySQL_Users_from_configfile();
|
||||
int Read_MySQL_Query_Rules_from_configfile();
|
||||
int Read_MySQL_Servers_from_configfile();
|
||||
int Read_Scheduler_from_configfile();
|
||||
int Read_ProxySQL_Servers_from_configfile();
|
||||
|
||||
void addField(std::string& data, const char* name, const char* value, const char* dq="\"");
|
||||
int Write_Global_Variables_to_configfile(std::string& data);
|
||||
int Write_MySQL_Users_to_configfile(std::string& data);
|
||||
int Write_MySQL_Query_Rules_to_configfile(std::string& data);
|
||||
int Write_MySQL_Servers_to_configfile(std::string& data);
|
||||
int Write_Scheduler_to_configfile(std::string& data);
|
||||
int Write_ProxySQL_Servers_to_configfile(std::string& data);
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,369 @@
|
||||
########################################################################################
|
||||
# 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"
|
||||
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"
|
||||
connpoll_reset_queue_length="mysql"
|
||||
default_character_set_results="mysql"
|
||||
default_charset="mysql"
|
||||
default_collation_connection="mysql"
|
||||
default_isolation_level="mysql"
|
||||
default_max_join_size="mysql"
|
||||
default_max_latency_ms="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_mode="mysql"
|
||||
default_sql_safe_updates="mysql"
|
||||
default_sql_select_limit="mysql"
|
||||
default_time_zone="mysql"
|
||||
default_transaction_read="mysql"
|
||||
default_tx_isolation="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"
|
||||
}
|
||||
)
|
||||
proxysql_servers:
|
||||
(
|
||||
{
|
||||
hostname="hostname"
|
||||
port=3333
|
||||
weight=12
|
||||
comment="comment"
|
||||
}
|
||||
)
|
||||
@ -0,0 +1,151 @@
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <string>
|
||||
#include <mysql.h>
|
||||
|
||||
#include "tap.h"
|
||||
#include "command_line.h"
|
||||
|
||||
#define MYSQL_QUERY(mysql, query) \
|
||||
do { \
|
||||
if (mysql_query(mysql, query)) { \
|
||||
fprintf(stderr, "File %s, line %d, Error: %s\n", \
|
||||
__FILE__, __LINE__, mysql_error(mysql)); \
|
||||
return exit_status(); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
int show_variable(MYSQL *mysql, const std::string& var_name, std::string& var_value) {
|
||||
char query[128];
|
||||
|
||||
snprintf(query, sizeof(query),"show variables like '%s'", var_name.c_str());
|
||||
if (mysql_query(mysql, query)) {
|
||||
fprintf(stderr, "Failed to execute SHOW VARIABLES LIKE : no %d, %s\n",
|
||||
mysql_errno(mysql), mysql_error(mysql));
|
||||
return -1;
|
||||
}
|
||||
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
result = mysql_store_result(mysql);
|
||||
|
||||
row = mysql_fetch_row(result);
|
||||
var_value = row[1];
|
||||
mysql_free_result(result);
|
||||
}
|
||||
|
||||
int select_config_file(MYSQL* mysql, std::string& resultset) {
|
||||
if (mysql_query(mysql, "select config file")) {
|
||||
fprintf(stderr, "File %s, line %d, Error: %s\n",
|
||||
__FILE__, __LINE__, mysql_error(mysql));
|
||||
return exit_status();
|
||||
}
|
||||
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
result = mysql_store_result(mysql);
|
||||
if (result) {
|
||||
row = mysql_fetch_row(result);
|
||||
resultset = row[0];
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
fprintf(stderr, "error\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
CommandLine cl;
|
||||
|
||||
if(cl.getEnv())
|
||||
return exit_status();
|
||||
|
||||
plan(1);
|
||||
diag("Testing SELECT CONFIG FILE");
|
||||
|
||||
MYSQL* mysql = mysql_init(NULL);
|
||||
if (!mysql)
|
||||
return exit_status();
|
||||
|
||||
if (!mysql_real_connect(mysql, cl.host, cl.admin_username, cl.admin_password, NULL, cl.admin_port, NULL, 0)) {
|
||||
fprintf(stderr, "File %s, line %d, Error: %s\n",
|
||||
__FILE__, __LINE__, mysql_error(mysql));
|
||||
return exit_status();
|
||||
}
|
||||
|
||||
MYSQL_QUERY(mysql, "delete from global_variables");
|
||||
MYSQL_QUERY(mysql, "delete from mysql_users");
|
||||
MYSQL_QUERY(mysql, "delete from mysql_servers");
|
||||
MYSQL_QUERY(mysql, "delete from mysql_query_rules");
|
||||
MYSQL_QUERY(mysql, "delete from mysql_replication_hostgroups");
|
||||
MYSQL_QUERY(mysql, "delete from mysql_group_replication_hostgroups");
|
||||
MYSQL_QUERY(mysql, "delete from mysql_galera_hostgroups");
|
||||
MYSQL_QUERY(mysql, "delete from mysql_aws_aurora_hostgroups");
|
||||
MYSQL_QUERY(mysql, "delete from scheduler");
|
||||
MYSQL_QUERY(mysql, "delete from proxysql_servers");
|
||||
|
||||
MYSQL_QUERY(mysql, "insert into proxysql_servers (hostname, port, weight, comment) values ('hostname', 3333, 12, 'comment');");
|
||||
MYSQL_QUERY(mysql, "insert into scheduler (id, active, interval_ms, filename, arg1, arg2, arg3, arg4, arg5, comment) values "
|
||||
" (1,1,1000,'filename','a1','a2','a3','a4','a5','comment');");
|
||||
MYSQL_QUERY(mysql, "insert into mysql_aws_aurora_hostgroups (writer_hostgroup, reader_hostgroup, active, aurora_port, "
|
||||
" domain_name, max_lag_ms, check_interval_ms, check_timeout_ms, writer_is_also_reader, new_reader_weight, "
|
||||
" add_lag_ms, min_lag_ms, lag_num_checks, comment) "
|
||||
" values (1,2,1,3,'.domain.net',20,106,107,1,9,10,20,1,'comment');");
|
||||
MYSQL_QUERY(mysql, "insert into mysql_galera_hostgroups (writer_hostgroup, backup_writer_hostgroup, reader_hostgroup, offline_hostgroup, "
|
||||
" active, max_writers, writer_is_also_reader, max_transactions_behind, comment) values (1,2,3,4,1,23,1,1,'comment');");
|
||||
MYSQL_QUERY(mysql, "insert into mysql_group_replication_hostgroups (writer_hostgroup, backup_writer_hostgroup, reader_hostgroup, offline_hostgroup, "
|
||||
" active, max_writers, writer_is_also_reader, max_transactions_behind, comment) values (1,2,3,4,1,23,1,1,'comment');");
|
||||
MYSQL_QUERY(mysql, "insert into mysql_replication_hostgroups (writer_hostgroup, reader_hostgroup, check_type, comment) "
|
||||
" values (10,20,'read_only','Master / Slave App 1');");
|
||||
MYSQL_QUERY(mysql, "insert into mysql_servers (hostgroup_id, hostname, port, gtid_port, status, weight, compression, max_connections, "
|
||||
" max_replication_lag, use_ssl, max_latency_ms, comment) values (0,'127.0.0.1',3306,0,'ONLINE',1,0,1000,0,0,0,'comment2');");
|
||||
MYSQL_QUERY(mysql, "insert into mysql_query_rules (rule_id, active, username, schemaname, flagIN, client_addr, proxy_addr, proxy_port, digest, "
|
||||
" match_digest, match_pattern, negate_match_pattern, re_modifiers, flagOUT, replace_pattern, destination_hostgroup, cache_ttl, cache_empty_result, "
|
||||
" cache_timeout, reconnect, timeout, retries, delay, next_query_flagIN, mirror_flagOUT, mirror_hostgroup, "
|
||||
" error_msg, OK_msg, sticky_conn, multiplex, gtid_from_hostgroup, log, apply, comment) values "
|
||||
" (1, 1, 'user', 'schema', 0, '.domain.com', '.proxy.com', 3333, 'ABC1', 'ABC', '^SELECT *', 0, 'CASE', 0, 1, 1, "
|
||||
" 1, 1, 100, 1, 1, 100, 100, 0, 0, 1, 'Error', 'OK', 0, 0, 0, 0, 0, 'comm1')");
|
||||
MYSQL_QUERY(mysql, "insert into mysql_users (username, password, active, use_ssl, default_hostgroup, default_schema, schema_locked, "
|
||||
" transaction_persistent, fast_forward, backend, frontend, max_connections, comment) values "
|
||||
" ('user', 'password', 1, 0, 0, 'schema', 1, 0, 1, 1, 1, 10, 'comm1')");
|
||||
|
||||
MYSQL_QUERY(mysql, "update global_variables set variable_value='admin' where variable_name like 'admin-%'");
|
||||
MYSQL_QUERY(mysql, "update global_variables set variable_value='mysql' where variable_name like 'mysql-%'");
|
||||
|
||||
MYSQL_QUERY(mysql, "load mysql servers to runtime");
|
||||
|
||||
std::string resultset;
|
||||
resultset.reserve(100000);
|
||||
select_config_file(mysql, resultset);
|
||||
|
||||
{
|
||||
std::ifstream inFile;
|
||||
inFile.open("./tests/proxysql_reference_select_config_file.cnf"); //open the input file
|
||||
|
||||
std::stringstream strStream;
|
||||
strStream << inFile.rdbuf(); //read the file
|
||||
std::string str = strStream.str(); //str holds the content of the file
|
||||
|
||||
ok(!str.compare(resultset), "Files are equal");
|
||||
}
|
||||
|
||||
MYSQL_QUERY(mysql, "load mysql variables from disk");
|
||||
MYSQL_QUERY(mysql, "load admin variables from disk");
|
||||
MYSQL_QUERY(mysql, "load mysql users from disk");
|
||||
MYSQL_QUERY(mysql, "load mysql servers from disk");
|
||||
MYSQL_QUERY(mysql, "load scheduler from disk");
|
||||
MYSQL_QUERY(mysql, "load proxysql servers from disk");
|
||||
|
||||
mysql_close(mysql);
|
||||
|
||||
return exit_status();
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue