MySQL消息存储引擎Q4M试玩_MySQL
程序员文章站
2024-04-05 20:51:55
...
bitsCN.com
1. 安装下载二进制包:由于我的mysql是5.1.48,从官网选择对应的包http://q4m.kazuhooku.com/dist/old/下载后解压a. 将support-files/q4m-forward 拷贝到mysql安装目录/bin下b. 将libqueue_engine.so 拷贝到mysql安装目录/lib/mysql/plugin下执行:$cat support-files/install.sql INSTALL PLUGIN queue SONAME 'libqueue_engine.so';CREATE FUNCTION queue_wait RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_end RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_abort RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_rowid RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_set_srcid RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_compact RETURNS INT SONAME 'libqueue_engine.so';这时候Queue引擎的状态还是disable,重启一下mysqld就变成active了。root@test 05:50:59>show plugins;+---------------------+--------+--------------------+---------------------+---------+| Name | Status | Type | Library | License |+---------------------+--------+--------------------+---------------------+---------+| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL || partition | ACTIVE | STORAGE ENGINE | NULL | GPL || CSV | ACTIVE | STORAGE ENGINE | NULL | GPL || MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL || MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL || MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL || InnoDB | ACTIVE | STORAGE ENGINE | ha_innodb_plugin.so | GPL || INNODB_TRX | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_CMP | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || QUEUE | ACTIVE | STORAGE ENGINE | libqueue_engine.so | GPL |+---------------------+--------+--------------------+---------------------+---------+安装完毕,可以开始玩一把了。2.a.创建一个QUEUE表root@test 05:52:29>create table t1 (a int , b varchar(100)) engine=queue;Query OK, 0 rows affected (0.00 sec)尝试插入一条数据: root@test 05:52:51>insert into t1 values (1,"sd");ERROR 1598 (HY000): Binary logging not possible. Message: Statement cannot be logged to the binary log in row-based nor statement-based format咿?插入失败,看样子Queue不支持binlog复制。好吧,重启把binlog禁用掉。再次执行root@test 05:57:03>insert into t1 values (1,"sd"); Query OK, 1 row affected (0.01 sec)这下插入成功了root@test 05:57:13>insert into t1 values (2,"sda"),(3,"fio"),(4,"sas");Query OK, 3 rows affected (0.00 sec)---------------------////--------------------以下内容有些是参考自官方的一个PPT。------------------////-------------------------那么QUEUE存储引擎和其他存储引擎(例如Innodb)有什么不同呢?——不支持主键和索引——支持insert/delete,但不支持update——根据插入数据的顺序进行排序——缓存select count(*)另外该存储引擎使用了多个定义的函数来简化操作,堪称傻瓜式!!!! 针对每个连接有两种模式:OWNER模式和Non-Owner模式,在进入owner模式后,该连接所拥有的数据对其他连接而言是不可见的。模式的切换使用函数来实现:a).进入Owner模式通常情况下,在发起连接后,处于Non-Owner模式,当调用函数Queue_wait()时,进入Owner 模式,根据传递给queue_wait函数的参数,会等待直到可以获得一行数据,在这之后,这行数据对其他连接而言是不可见的。Queue_wait的参数类似于如下格式:select * from t1 where queue_wait(“t1”); 等待获得t1内的一行数据,默认超时时间为60秒Select * from t1 where queue_wait(“t1: a
1. 安装下载二进制包:由于我的mysql是5.1.48,从官网选择对应的包http://q4m.kazuhooku.com/dist/old/下载后解压a. 将support-files/q4m-forward 拷贝到mysql安装目录/bin下b. 将libqueue_engine.so 拷贝到mysql安装目录/lib/mysql/plugin下执行:$cat support-files/install.sql INSTALL PLUGIN queue SONAME 'libqueue_engine.so';CREATE FUNCTION queue_wait RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_end RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_abort RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_rowid RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_set_srcid RETURNS INT SONAME 'libqueue_engine.so';CREATE FUNCTION queue_compact RETURNS INT SONAME 'libqueue_engine.so';这时候Queue引擎的状态还是disable,重启一下mysqld就变成active了。root@test 05:50:59>show plugins;+---------------------+--------+--------------------+---------------------+---------+| Name | Status | Type | Library | License |+---------------------+--------+--------------------+---------------------+---------+| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL || partition | ACTIVE | STORAGE ENGINE | NULL | GPL || CSV | ACTIVE | STORAGE ENGINE | NULL | GPL || MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL || MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL || MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL || InnoDB | ACTIVE | STORAGE ENGINE | ha_innodb_plugin.so | GPL || INNODB_TRX | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_CMP | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | ha_innodb_plugin.so | GPL || QUEUE | ACTIVE | STORAGE ENGINE | libqueue_engine.so | GPL |+---------------------+--------+--------------------+---------------------+---------+安装完毕,可以开始玩一把了。2.a.创建一个QUEUE表root@test 05:52:29>create table t1 (a int , b varchar(100)) engine=queue;Query OK, 0 rows affected (0.00 sec)尝试插入一条数据: root@test 05:52:51>insert into t1 values (1,"sd");ERROR 1598 (HY000): Binary logging not possible. Message: Statement cannot be logged to the binary log in row-based nor statement-based format咿?插入失败,看样子Queue不支持binlog复制。好吧,重启把binlog禁用掉。再次执行root@test 05:57:03>insert into t1 values (1,"sd"); Query OK, 1 row affected (0.01 sec)这下插入成功了root@test 05:57:13>insert into t1 values (2,"sda"),(3,"fio"),(4,"sas");Query OK, 3 rows affected (0.00 sec)---------------------////--------------------以下内容有些是参考自官方的一个PPT。------------------////-------------------------那么QUEUE存储引擎和其他存储引擎(例如Innodb)有什么不同呢?——不支持主键和索引——支持insert/delete,但不支持update——根据插入数据的顺序进行排序——缓存select count(*)另外该存储引擎使用了多个定义的函数来简化操作,堪称傻瓜式!!!! 针对每个连接有两种模式:OWNER模式和Non-Owner模式,在进入owner模式后,该连接所拥有的数据对其他连接而言是不可见的。模式的切换使用函数来实现:a).进入Owner模式通常情况下,在发起连接后,处于Non-Owner模式,当调用函数Queue_wait()时,进入Owner 模式,根据传递给queue_wait函数的参数,会等待直到可以获得一行数据,在这之后,这行数据对其他连接而言是不可见的。Queue_wait的参数类似于如下格式:select * from t1 where queue_wait(“t1”); 等待获得t1内的一行数据,默认超时时间为60秒Select * from t1 where queue_wait(“t1: a
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
上一篇: php问题$market
推荐阅读