Pages: 6/12 First page Previous page 1 2 3 4 5 6 7 8 9 10 Next page Final page [ View by Articles | List ]
innodb到现在还是mysql下最主要的支持事务的存储引擎,那么好,现在我们又多了一种选择了,
一种新的事务存储引擎 PBXT Storage Engine

以后mysql的主要存储引擎架构趋势已成:
Open in new window

这是原作者对这种存储引擎的总结:
Quotation
PrimeBase XT (PBXT) is a transactional storage engine for MySQL which can be loaded dynamically by the pluggable storage engine API of MySQL 5.1. It has been designed for modern, web-based, high concurrency environments. Full MVCC (multi-version concurrency control) support and a unique "write-once" strategy make PBXT particularly effective under heavy update loads.


先来看一下PBXT的架构吧:
Open in new window
AICD特性完整支持! 众多特性:

Quotation
1. MVCC: Multi-version concurrency control, enables reading without locking.
2. Transactional: support for BEGIN, COMMIT and ROLLBACK and recovery on startup.
3. ACID compliant: Atomic, Consistent, Isolated, Durable (once committed changes cannot be lost).
4. Row-level locking: updates use row-level locking allowing for maximum concurrency.
5. Deadlock detection: immediate notification if client processes are deadlocked.
6. Referential Integrity: foreign key support.
7. Write-once: PBXT avoids double-writes by using a log-based architecture.
8. BLOB streaming: In combination with the BLOB Streaming engine.


06年就开始有这么个东西了,始生之物,其形必丑,没错,开始的时候不是很完善,不过经过作者这2,3年的不断改进,
更新,已经有了巨大进步了。

作者的这张和INNODB的测试的性能图可以看得出差别了
作者的测试环境:
MySQL 5.1.30
8 core, 64-bit, Linux machine
with an SSD drive and a 5 warehouse DBT2 database.
Open in new window

从这个图的表现看出,随着引擎的版本越高,这存储引擎表现越来越好,
例如1.0.08的表现似乎有超越innodb的趋势。
以后要慢慢深入研究一下这个东东了

引擎下载:http://www.primebase.org/download/
快速指南:http://www.primebase.org/download/index.php#qg_source
白皮书: http://www.primebase.org/download/pbxt_white_paper.pdf

参考资料:
http://dev.mysql.com/tech-resources/articles/pbxt-storage-engine.html
http://pbxt.blogspot.com/
         在以前的文章中《mysql同步复制M-M(master master)模式》 里,配置了这样一种双向同步机制,两台服务器都可以保持同步并且都可以读写,但是这种配置方案还不完善,生产上实际可能出现很多问题,最突出的一点就是库中某些表有自增长auto_increment字段的时候,容易产生键值冲突错误!

      熟读过mysql的replication的docs,我们发现mysql其实对这个主键冲突已经有相应的解决方案,只是互联网很多配置过程都没有加进去这点,直接拿来用,出问题的概率是比较大的。
      
      mysql的服务器变量auto_increment_increment【增长值】和auto_increment_offset【偏移量】可以协调多主服务器复制和AUTO_INCREMENT列。并且每个变量有一个默认的(并且是最小的)值1,有一个最大值65,535。把这些变量设置为非冲突的值,例如在同一个表插入新行时,多主服务器配置主的服务器就不会发生AUTO_INCREMENT值冲突,这里就可以解决这个问题,比如就这里的两台服务器A和B为例:
在A的[mysqld]字段下增加:

auto-increment-increment = 2
auto-increment-offset = 1


在B的[mysqld]字段下增加:

auto-increment-increment = 2
auto-increment-offset = 2


         这样,两台服务器同时有数据插入到有auto_increment的字段是,就不会发生冲突,一个简单的例子就是A下插入的ID为1,3,5,7……,以此类推,B下插入的ID就为2,4,6,8,……,以此类推,但即使这样,mysql建议也不要使用这种双向同步机制,主要的原因是目前的同步还不支持在多源服务器上同步更新锁协议,从而无法保证数据库数据操作的“原子性”问题。那么本文就算对上篇mysql复制文章的补充。

----------End-----------
    今天才知道,mysql从5.1.23后,安装innodb引擎,以前的--with-innodb编译参数已经无效了,需要用--with-plugins方式安装,这个选项可选参数很多,包括partition daemon_example ftexample archive blackhole csv example federated heap innobase myisam myisammrg ndbcluster这些东西,而--with-plugins默认的参数是none,也就是说不指定一些参数,上面很多新特性,都不会编译进去Mysql了,stupid

   现在新版本的innodb引擎已经出来了,现在的版本是“InnoDB Plugin, release 1.0.2 ”
这里下载: http://www.innodb.com/innodb_plugin/download/v102/
相关文档:http://www.innodb.com/doc/innodb_plugin-1.0/

要用最新的innodb,可以替换一下mysql源码里面的旧版本

简单写下过程:


tar -zxf mysql-5.1.30.tar.gz
cd mysql-5.1.30/storage
wget http://www.innodb.com/download/innodb_plugin/innodb_plugin-1.0.2.tar.gz
tar -zxf innodb-1.0.2.tar.gz
rm -fr innobase
mv innodb-1.0.2 innobase
cd ..
./configure --prefix=/usr/local/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --enable-profiling --with-mysqld-user=mysql --with-plugins=partition,heap,innobase,myisam
make
make install  

  
安装完后初始化表后就可以启动了

---------END---------

Mysql的sql模式sql_mod

[不指定 2009/02/25 13:44 | by askwan ]
      参考了这方面一些资料,这里总结一下mysql的SQL模式:
    Mysql从4.1X版本后,可以运行在不同的模式下,可以通过sql_mod选项来设置不同的模式,在不发生冲突的情形下,可以一次激活多个模式, 例如 SET [GLOBAL] sql_mod='mod1,mod2,mod3';

ansi :MYSQL服务器于ANSI SQL标准兼容。这种模式是其实是好几种模式的集合,包括real_as_float,ansi_quotes等

maxdb: 与maxdb兼容性模式

db2:与IBM DB2兼容性模式

oracle:与oracle兼容性模式

postgresql:与postgresql兼容性模式

allow_invalid_dates : 允许不合法日期时间模式

ansi_quotes : 字符串必须要用单引号括起来,并且表和数据库名必须要用双引号括起来模式

no_zero_date :视 0000-00-00这类日期为非法模式

strict_all_tables: 这个模式很有用,指在insert插入记录时,没有为默认值提供数据列的值,将触发error。

strict_tarns_tables: 和strict_all_tables类似,但这个限制更严格,区分存储存储引擎,对于innodb表,非法插入的任何数据都被无效,而对于myisam表,要分情况,如果是第一条插入记录非法,那就放弃整个后面的sql,如果是发生在插入第n条记录的时候数据非法,则从第n条开始的后面的全部放弃,而前面插入的n-1条数据还是正常的。
Tags: , ,
Pages: 6/12 First page Previous page 1 2 3 4 5 6 7 8 9 10 Next page Final page [ View by Articles | List ]