Tiflash的使用介绍
1、创建一个products表
mysql> CREATE TABLE products ( -> id INT PRIMARY KEY AUTO_INCREMENT, -> product_name VARCHAR(100), -> price DECIMAL(13 , 2 ) -> ); Query OK, 0 rows affected (0.17 sec)
2、查看products表结构
mysql> desc select count(*) from products;
+----------------------------+----------+-----------+----------------+---------------------------------+
| id | estRows | task | access object | operator info |
+----------------------------+----------+-----------+----------------+---------------------------------+
| StreamAgg_16 | 1.00 | root | | funcs:count(Column#6)->Column#4 |
| └─TableReader_17 | 1.00 | root | | data:StreamAgg_8 |
| └─StreamAgg_8 | 1.00 | cop[tikv] | | funcs:count(1)->Column#6 |
| └─TableFullScan_15 | 10000.00 | cop[tikv] | table:products | keep order:false, stats:pseudo |
+----------------------------+----------+-----------+----------------+---------------------------------+
4 rows in set (0.00 sec)
注意此时是cop[tikv],证明还不是tiflash的数据结构
3、为tidb的表products创建tiflash副本
mysql> ALTER TABLE products SET TIFLASH REPLICA 1;
Query OK, 0 rows affected (0.19 sec)
4、再次查看products表结构
mysql> desc select count(*) from products;
+------------------------------+----------+--------------+----------------+---------------------------------+
| id | estRows | task | access object | operator info |
+------------------------------+----------+--------------+----------------+---------------------------------+
| HashAgg_21 | 1.00 | root | | funcs:count(Column#6)->Column#4 |
| └─TableReader_23 | 1.00 | root | | data:ExchangeSender_22 |
| └─ExchangeSender_22 | 1.00 | mpp[tiflash] | | ExchangeType: PassThrough |
| └─HashAgg_9 | 1.00 | mpp[tiflash] | | funcs:count(1)->Column#6 |
| └─TableFullScan_20 | 10000.00 | mpp[tiflash] | table:products | keep order:false, stats:pseudo |
+------------------------------+----------+--------------+----------------+---------------------------------+
5 rows in set (0.00 sec)
此时为mpp[tiflash],表示已经创建了tiflash的副本
如上,我们可以看到当tidb的环境tikv与tiflash部署成功之后,想使用tiflash的引擎,按照如上的操作即可完成
1.作者:Syw 2.出处:http://www.cnblogs.com/syw20170419/ 3.本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 4.如果文中有什么错误,欢迎指出。以免更多的人被误导。 |