Kubernetes-记录在容器云Galera集群中测试导入数据

Kubernetes-在Caicloud容器平台Galera集群中测试导入数据

平台:Caicloud Compass(才云compass容器云管理平台)
mysql版本:5.7.20
Kubernetes-记录在容器云Galera集群中测试导入数据_第1张图片
Galera集群信息:

mysql> show status like "wsrep_cluster_size";
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| wsrep_cluster_size | 3     |
+--------------------+-------+
1 row in set (0.00 sec)

mysql> SHOW GLOBAL STATUS LIKE 'wsrep_%';
+------------------------------+-------------------------------------------------------+
| Variable_name                | Value                                                 |
+------------------------------+-------------------------------------------------------+
| wsrep_local_state_uuid       | 3d0f6095-a622-11ea-b10f-7f51e86538e3                  |
| wsrep_protocol_version       | 7                                                     |
| wsrep_last_committed         | 300008                                                |
| wsrep_replicated             | 0                                                     |
| wsrep_replicated_bytes       | 0                                                     |
| wsrep_repl_keys              | 0                                                     |
| wsrep_repl_keys_bytes        | 0                                                     |
| wsrep_repl_data_bytes        | 0                                                     |
| wsrep_repl_other_bytes       | 0                                                     |
| wsrep_received               | 100783                                                |
| wsrep_received_bytes         | 30795431                                              |
| wsrep_local_commits          | 0                                                     |
| wsrep_local_cert_failures    | 0                                                     |
| wsrep_local_replays          | 0                                                     |
| wsrep_local_send_queue       | 0                                                     |
| wsrep_local_send_queue_max   | 1                                                     |
| wsrep_local_send_queue_min   | 0                                                     |
| wsrep_local_send_queue_avg   | 0.000000                                              |
| wsrep_local_recv_queue       | 0                                                     |
| wsrep_local_recv_queue_max   | 30                                                    |
| wsrep_local_recv_queue_min   | 0                                                     |
| wsrep_local_recv_queue_avg   | 0.079299                                              |
| wsrep_local_cached_downto    | 200009                                                |
| wsrep_flow_control_paused_ns | 119076643                                             |
| wsrep_flow_control_paused    | 0.000000                                              |
| wsrep_flow_control_sent      | 12                                                    |
| wsrep_flow_control_recv      | 25                                                    |
| wsrep_cert_deps_distance     | 65.707360                                             |
| wsrep_apply_oooe             | 0.000000                                              |
| wsrep_apply_oool             | 0.000000                                              |
| wsrep_apply_window           | 1.000000                                              |
| wsrep_commit_oooe            | 0.000000                                              |
| wsrep_commit_oool            | 0.000000                                              |
| wsrep_commit_window          | 1.000000                                              |
| wsrep_local_state            | 4                                                     |
| wsrep_local_state_comment    | Synced                                                |
| wsrep_cert_index_size        | 35                                                    |
| wsrep_causal_reads           | 0                                                     |
| wsrep_cert_interval          | 0.000000                                              |
| wsrep_incoming_addresses     | 192.168.1.79:3306,192.168.5.71:3306,192.168.4.50:3306 |
| wsrep_desync_count           | 0                                                     |
| wsrep_evs_delayed            |                                                       |
| wsrep_evs_evict_list         |                                                       |
| wsrep_evs_repl_latency       | 0/0/0/0/0                                             |
| wsrep_evs_state              | OPERATIONAL                                           |
| wsrep_gcomm_uuid             | c47eea04-a632-11ea-b0ab-7e4e4ad55ea7                  |
| wsrep_cluster_conf_id        | 9                                                     |
| wsrep_cluster_size           | 3                                                     |
| wsrep_cluster_state_uuid     | 3d0f6095-a622-11ea-b10f-7f51e86538e3                  |
| wsrep_cluster_status         | Primary                                               |
| wsrep_connected              | ON                                                    |
| wsrep_local_bf_aborts        | 0                                                     |
| wsrep_local_index            | 0                                                     |
| wsrep_provider_name          | Galera                                                |
| wsrep_provider_vendor        | Codership Oy <info@codership.com>                     |
| wsrep_provider_version       | 3.22(r4d7d231)                                        |
| wsrep_ready                  | ON                                                    |
+------------------------------+-------------------------------------------------------+
57 rows in set (0.00 sec)

构造并插入十万条测试数据

mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> create table tb_test (id int auto_increment primary key,name char(10),identification int default 20);
Query OK, 0 rows affected (0.06 sec)

mysql> 
mysql> 
mysql> delimiter $$
mysql> create procedure  sp_tb_test() 
    -> begin 
    ->  declare i int;
    -> set i = 1;
    -> while i <= 100000
    -> do  insert into tb_test(name,identification) values (concat('huang',i),i); 
    -> set i = i +1;
    -> end while;
    -> end$$
Query OK, 0 rows affected (0.02 sec)

mysql> delimiter ;
mysql> call sp_tb_test;
^G
^G^G^G^G^G^G^G^G^G^GQuery OK, 1 row affected (52.26 sec)

mysql> 
mysql> select count(*) from test.tb_test;
+----------+
| count(*) |
+----------+
|   100000 |
+----------+
1 row in set (0.02 sec)

我们可以看到插入10万条数据花费了52秒,以容器的方式构造的集群因为虚拟化方面的损耗还是较大,但是这对于测试环境已经够用了。

这里再看看以事务的方式提交,这样可以快不少。

mysql> begin;
Query OK, 0 rows affected (0.00 sec)

mysql> call sp_tb_test;
Query OK, 1 row affected (2.16 sec)

mysql> commit;
^GQuery OK, 0 rows affected (1.67 sec)

你可能感兴趣的:(容器云,Database)