Всем привет! Есть кластер (2 ноды + 1 арбитратор). Запросы на него идут через maxscale proxy, настроенную таким образом, чтобы все запросы (и чтения и записи) шли на одну ноду, а в случает если нода окажется недоступна - на вторую.
Собственно, проблема в сабже.
Запросы могут быть как SELECT, так и UPDATE, INSERT в нормальных условиях выполняются значительно быстрее секунды, но некоторые остаются в PROCESS LIST в статусе query end. Иногда таких запросов висит сразу пачка - и тогда кластер становится колом, из новых запросов обрабатывает только SELECT. KILL процессов не работает, они так и остаются висеть как KILLED. Помогает только перезагрузка ноды, на которую идет запись.
На обоих серверах 2x Intel Xeon E5-2670 2.6Ghz , 192Gb, RAID1 из 2 SSD. ОC Debian 8, mariadb-server-10.2 из репозитория.
my.cnf
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
#
# * Fine Tuning
#
max_connections = 2000
max_allowed_packet = 16M
thread_cache_size = 50
skip_name_resolve
#
# * MyISAM
#
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched. On error, make copy and try a repair.
myisam_recover_options = BACKUP
key_buffer = 1024M
thread_concurrency = 17
#
# * Query Cache Configuration
#
# Cache only tiny result sets, so we can fit more in the query cache.
query_cache_type = 0
#query_cache_limit = 0
#query_cache_size = 0
# for more write intensive setups, set to DEMAND or OFF
#query_cache_type = DEMAND
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# we do want to know about network errors and such
log_warnings = 2
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log[={0|1}]
#slow_query_log_file = /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit = 1000
#log_slow_verbosity = query_plan
#log-queries-not-using-indexes
#log_slow_admin_statements
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#report_host = master1
#auto_increment_increment = 2
#auto_increment_offset = 1
log_bin = /var/lib/mysql/mariadb-bin
log_bin_index = /var/lib/mysql/mariadb-bin.index
# not fab for performance, but safer
sync_binlog = 0
expire_logs_days = 10
max_binlog_size = 5000M
#
# If applications support it, this stricter sql_mode prevents some
# mistakes like inserting invalid dates etc.
#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine = InnoDB
# you can't just change log file size, requires special procedure
#innodb_log_file_size = 50M
innodb_buffer_pool_size = 147456M
#innodb_log_buffer_size = 16M
innodb_file_per_table = 1
innodb_thread_concurrency = 17
innodb_buffer_pool_instances = 64
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit=1
# Tuning
thread_cache = 24
tmp_table_size = 2048M
max_heap_table_size = 2048M
optimizer_switch='derived_merge=off,derived_with_keys=off'
thread_handling = pool-of-threads
thread_pool_size = 64
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completion
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
galera.cnf
[mysqld]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
# Galera Provider Configuration
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
# Galera Cluster Configuration
wsrep_cluster_name="galera-cluster"
wsrep_cluster_address="gcomm://айпи_ноды1,айпи_ноды1"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
#wsrep_sst_method=xtrabackup
# Galera Node Configuration
wsrep_node_address="айпи_ноды1"
wsrep_node_name="galera-node1"
# Tuning
wsrep_retry_autocommit = 4
wsrep_slave_threads = 64
wsrep_provider_options="gcache.size=5G; gcs.fc_limit = 320; gcs.fc_factor = 0.8; repl.commit_order=1;"