我对Galera多主机系统有问题。当我在node1中运行query(SELECT)进行 0.025 秒时,但在node2上执行相同的查询 5.172 秒,在node3中的结果为 4.347 秒。
Node1配置:
[mysqld]
log_error=/var/log/mariadb.log
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://192.168.2.47,192.168.2.48,192.168.2.49,172.29.44.11"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_cluster_name="CCCluster"
bind-address=0.0.0.0
wsrep_node_address="192.168.2.47"
wsrep_node_name=”node1"
wsrep_sst_method=rsync
Node2配置:
[mysqld]
log_error=/var/log/mariadb.log
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://192.168.2.47,192.168.2.48,192.168.2.49,172.29.44.11"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_cluster_name="CCCluster"
bind-address=0.0.0.0
wsrep_node_address="192.168.2.48"
wsrep_node_name="node2"
wsrep_sst_method=rsync
Node3配置:
[mysqld]
log_error=/var/log/mariadb.log
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://192.168.2.47,192.168.2.48,192.168.2.49,172.29.44.11"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_cluster_name="CCCluster"
bind-address=0.0.0.0
wsrep_node_address="192.168.2.49"
wsrep_node_name="node1"
wsrep_sst_method=rsync
我正在节点上执行的查询是:
select `users`.*, `upd`.`first_name`, `upd`.`middle_name`, `upd`.`last_name`,
CONCAT_WS(upd.first_name, upd.middle_name, upd.last_name) AS full_name
from `users`
inner join `users_personal_data` as `upd` ON `upd`.`user_id` = `users`.`id`
order by `id` desc
limit 20 offset 0;
此问题来自哪里?
答案 0 :(得分:0)
EXPLAIN SELECT的结果是:
+------+-------------+-------+------+-------------------------------------+------+---------+------+------+-------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+------+-------------------------------------+------+---------+------+------+-------------------------------------------------+
| 1 | SIMPLE | users | ALL | PRIMARY | NULL | NULL | NULL | 1 | Using temporary; Using filesort |
| 1 | SIMPLE | upd | ALL | users_personal_data_user_id_foreign | NULL | NULL | NULL | 1 | Using where; Using join buffer (flat, BNL join) |
+------+-------------+-------+------+-------------------------------------+------+---------+------+------+-------------------------------------------------+