Tagged: mysql RSS

  • bixuan 14:18 on 2011 年 02 月 25 日 链接地址 | 回复
    Tags: , mysql, 故障   

    一个mysql的小故障 

    今天机器重启后,发现一个innodb(mysql-5.0.45)的表提示如下错误:Incorrect information in file: ‘./MD/t_monitor_client.frm’,

    原因是:表结构出现错误。

    解决方法:
    1、停止mysql;
    2、在其他的机器上重该表,
    3、将t_monitor_client.frm复制到故障机器上,
    4、启动mysql,
    5、检查,没问题就成功了。

     
  • bixuan 00:28 on 2011 年 02 月 19 日 链接地址 | 回复
    Tags: mysql,   

     
  • bixuan 01:25 on 2010 年 12 月 05 日 链接地址 | 回复
    Tags: mysql   

    mysql中在线修改慢查询变量:

    mysql> set global long_query_time=1;

     
  • bixuan 00:19 on 2010 年 11 月 22 日 链接地址 | 回复
    Tags: , mysql, , VoltDB   

    一般认为NoSQL数据库在性能方面要优于传统的SQL数据库。但是有两个SQL的解决方案宣布:对于大型系统的高可扩展性需求,SQL仍然是可行的解决方案!这两个SQL解决方案分别是MySQL加NoSQL层插件和支持SQL的VoltDB数据库。

    MySQL + HandlerSocket

    Yoshinori Matsunobu是Sun/Oracle的前雇员,从事MySQL的研发工作,目前是DeNA的首席数据库和基础设施架构师,他以插件的方式为MySQL/InnoDB提供解决方案,可以在一台2.53GHZ、8核CPU、32G内存的Nehalem服务器上把每秒的查询数量(qps)提升到750,000以上。在同样的硬件环境下,无插件的MySQL只能提供100,000左右的qps,如果使用memecached的话,可以增加到大约400,000。经过对RDBMS的分析,Matsunobu意识到大部分时间都花在SQL的开销上,比如调用MYSQLparse()、MYSQLlex()、make_join_statistics()和JOIN::optimize()等。他写到:

    很显然性能降低的原因主要在SQL层,而不是“InnoDB(存储)”层。MySQL必须做很多事情……但memcached/NoSQL是不需要做这些额外工作的。

    SQL层的功能包括解析SQL语句、打开/锁定/解锁/关闭表、解决并发问题等。Matsunobu的解决方案就是增加额外的NoSQL层:

    我们认为最好的方式就是在MySQL内部实现一个NoSQL的网络服务器。也就是说,编写一个网络服务器作为MySQL的插件(守护插件),用来监听特定端口,接收NoSQL的协议和API,然后通过MySQL内部存储引擎API直接访问InnoDB。这种方式很像NDBAPI,不同的是它可以与InnoDB交互。

    他的团队开发了HandlerSocket插件,有了这个插件,MySQL更像一个NoSQL数据库,通过监听一个独立的端口,接收从SQL层来的简单查询请求,例如主键查询,索引扫描和插入/更新/删除。这一变化把数据库性能提升到了750K qps以上。常用端口可以接收处理复杂查询,其核心仍然是SQL数据库。DeNA采用SQL/NoSQL混合的方式取得了成功,据Matsunobu所言,在相同的时间内,这种解决方案把多个memcached和MySQL主从服务器的方案远远甩在了后面。

    VoltDB

    另一个很有希望的SQL解决方案是VoltDB,这是一个内存中的开源OLTP SQL数据库,能够保证事务的完整性(ACID)。VoltDB是由原Ingres和Postgres的架构师Mike Stonebraker设计的。该数据库主要特征如下:

    • 为了获得最大化吞吐量,数据保存在内存中(而不是在硬盘),这样可以有效消除缓冲区管理。
    • VoltDB通过SQL引擎把数据分发给集群服务器的每个CPU进行处理。
    • 每个单线程分区自主执行,消除锁定和闩锁的需求。
    • VoltDB可以通过简单的在集群中增加附加节点的方式实现性能的线性增加。

    正如其开发者宣称的那样,该数据库的性能使其成为NoSQL解决方案的有力竞争者:

    • VoltDB在单节点上可以每秒处理53000个事务请求(TPS),其他DBMS在相同的硬件环境下只能处理1155个。VoltDB的扩展是近似线性的──在12个节点的VoltDB集群上进行同样测试,可以处理560,000 TPS。
    • 基准案例:某个客户的在线游戏在12个节点的VoltDB集群上处理了130万 TPS。
    • VoltDB还针对NoSQL的键-值存储方式作了基准测试,VoltDB在处理各种键-值存储负载的情况下获得了相同或更好的性能。

    除了它的性能,VoltDB的主要优势是可以与SQL用户进行交流,这些SQL用户是很好的资源。

    近期还会推出VoltDB的企业版本,包括基于浏览器的数据库管理系统,提供、管理和监控数据库集群。除了免费的社区版本,针对企业版的支持也开始了。

    查看英文原文:MySQL/HandlerSocket and VoltDB: Contenders to NoSQL

    From: http://hi.baidu.com/%CA%AB%D5%B9/blog/item/30e9aed38d3af024960a1649.html

     
  • bixuan 03:22 on 2010 年 11 月 01 日 链接地址 | 回复
    Tags: , mysql   

    MySQL+HandlerSocket安装 

    HandlerSocket是啥东东,请参看http://www.ourlinux.net/database/using-mysql-as-a-nosql-a-story-for-exceeding-750000-qps-on-a-commodity-server/,做个简单的摘记:

    下载

    wget -c http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.51.tar.gz/from/http://ftp.jaist.ac.jp/pub/mysql/

    wget -c http://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL/tarball/master

    安装Mysql

    PREFIX=/opt/app
    tar zxvf mysql-5.1.51.tar.gz
    cd mysql-5.1.51
    ./configure  –prefix=$PREFIX/mysql-5.1.51 –enable-assembler –with-client-ldflags=-all-static –with-unix-socket-path=/tmp/mysql.sock –with-charset=utf8  –enable-thread-safe-client –with-pthread  –without-debug –with-big-tables  –enable-community-features –enable-profiling  –enable-local-infile  –with-fast-mutexes  –with-plugins=innobase,innodb_plugin && \
    make -j 5 && \
    strip sql/mysqld && \
    make install && \
    cd $PREFIX/mysql-5.1.51 && \
    bin/mysql_install_db –user=mysql && \
    cd ..

    安装HandlerSocket

    tar zxvfp ahiguti-HandlerSocket-Plugin-for-MySQL-a25ce9a.tar.gz && \
    cd ahiguti-HandlerSocket-Plugin-for-MySQL-a25ce9a && \
    ./autogen.sh
    ./configure –prefix=$PREFIX/HandlerSocket-Plugin –with-mysql-source=/home/kingnet/mysql/mysql-5.1.51 –with-mysql-bindir=$PREFIX/mysql-5.1.51/bin  –with-mysql-plugindir=$PREFIX/mysql-5.1.51/lib/mysql/plugin && \
    make && make install
    在mysql里加载HandlerSocket插件:
    mysql> INSTALL PLUGIN handlersocket SONAME ‘handlersocket.so’;
    mysql>SHOW PLUGINS; # 查看插件是否加载成功
    在my.cnf的[mysqld]加如下配置:
    loose_handlersocket_port = 9998
    # the port number to bind to (for read requests)
    loose_handlersocket_port_wr = 9999
    # the port number to bind to (for write requests)
    loose_handlersocket_threads = 16
    # the number of worker threads (for read requests)
    loose_handlersocket_threads_wr = 1
    # the number of worker threads (for write requests)
    open_files_limit = 65535

    安装perl模块

    cd libhsclient && \
    rsync -av ./*.hpp /usr/include/
    # 需要将必要的include文件copy到系统目录。
    cd ../perl-Net-HandlerSocket/
    perl Makefile.PL && \
    make && \
    make test && \
    make install

    perl测试脚本

    #!/usr/bin/perl
    use strict;
    use warnings;
    use Net::HandlerSocket;
    #1. establishing a connection
    my $args = { host => ’192.168.4.75′, port => 9998 };
    my $hs = new Net::HandlerSocket($args);
    #2. initializing an index so that we can use in main logics.
    # MySQL tables will be opened here (if not opened)
    my $res = $hs->open_index(0, ‘test’, ‘user’, ‘PRIMARY’,
    ‘user_name,user_email,created’);
    die $hs->get_error() if $res != 0;
    #3. main logic
    #fetching rows by id
    #execute_single (index id, cond, cond value, max rows, offset)
    $res = $hs->execute_single(0, ‘=’, [ '101' ], 1, 0);
    die $hs->get_error() if $res->[0] != 0;
    shift(@$res);
    for (my $row = 0; $row < 1; ++$row) {
    my $user_name= $res->[$row + 0];
    my $user_email= $res->[$row + 1];
    my $created= $res->[$row + 2];
    print “$user_name\t$user_email\t$created\n”;
    }
    #4. closing the connection
    $hs->close();
    执行:perl t.pl,返回:
    bi_101  bi_101@test.com      2010-10-26 10:11:11
     
  • bixuan 14:12 on 2010 年 10 月 26 日 链接地址 | 回复
    Tags: , mysql   

    Using MySQL as a NoSQL – A story for exceeding 750,000 qps on a commodity server 

    原文:http://yoshinorimatsunobu.blogspot.com/2010/10/using-mysql-as-nosql-story-for.html
    相关的日文PPT:http://www.slideshare.net/akirahiguchi/handlersocket-plugin-for-mysql-4664154

    啥也不说了,期待php的扩展出现。

     
  • bixuan 09:18 on 2010 年 01 月 07 日 链接地址 | 回复
    Tags: , , mysql,   

    lsof操作实例 

    lsof 工具可列出某个Unix 进程所打开文件信息的清单,被打开文件的类型可能包括了:本地文件,目录,网络共享文件,块设备文件,字符设备文件,共享库,管道,软链接,套接字等等.

    以下是具体的lsof 操作实例总结:

    1,列出所有被打开文件信息

    #lsof

    2,查看某个被打开文件信息

    #lsof /path/to/file
    #lsof /path/to/file1 /path/to/file2

    3,列出某个目录下的被打开文件

    #lsof +D /path
    #lsof | grep “/path”

    4,列出某个用户下的被打开文件

    #lsof -u nobody
    #lsof -u nobody,root

    5,列出某个进程下的被打开文件

    #lsof -c httpd
    #lsof -c httpd -c mysqld

    6,复合查询(OR)被打开文件信息

    #lsof -u nobody -c httpd

    7,复合查询(AND)被打开文件信息

    #lsof -a -u root -c httpd

    8,查看除root之外所有用户的被打开文件

    #lsof -u ^root

    9,查看具体进程PID的被打开文件

    #lsof -p 10101
    #lsof -p 10101,10102,10103

    10,列出所有网络连接

    #lsof -i

    11,列出所有网络TCP或者UDP连接

    #lsof -i tcp
    #lsof -i udp

    12,查看具体网络端口信息

    #lsof -i :80
    #lsof -i tcp:80
    #lsof -i udp:53

    13,查看具体用户下所有网络连接

    #lsof -a -u www -i

    14,列出NFS 文件

    #lsof -N

    15,列出Unix 套接字文件

    #lsof -U

    16,列出某个特定文件描述符相关联的文件

    #lsof -d 2
    #lsof -d 0-2
    #lsof -d mem

    0 1 2 => FD: standard input, output, and error

    17,列出所有网络连接关联的PID

    #lsof -t -i

    #kill -9 `lsof -t -i`  => kill all process use network

    18,重复lsof 输出

    #lsof -r 1 -a -u www -i

    from: http://feedproxy.google.com/~r/blogspot/HpnK/~3/v-rLmhbiVmA/lsof.html

     
  • bixuan 16:40 on 2009 年 10 月 17 日 链接地址 | 回复
    Tags: , mysql, ,   

    [招聘]PHP|Mysql|Linux人才 

    朋友公司招聘PHP|Mysql|Linux人才:

    要求:有对高负载站点的PHP开发、mysql管理、Linux系统管理、优化丰富经验即可!
    PHP+mysql(1人):2万月薪 + 干股
    ———— 或 —————–
    php(1人): 8K-10k月薪
    mysql+sa(1人):18K月薪

    上班地点:上海陆家嘴软件园(东方路和峨山路口)

    有兴趣的朋友,可以联系我gtalk:bixuan@gmail.com(邮件也可以) 或者QQ:6149968

     
    • maque0312 16:46 on 2009 年 11 月 17 日 链接地址

      工资待遇真好啊。

  • bixuan 15:48 on 2008 年 09 月 03 日 链接地址 | 回复
    Tags: , asstats, asterisk, blog, , db4o, developer, elgg, flex, , , httpclient, infoworld, inssider, jboss drools, mediawiki, mysql, nagios, NDISwrapper, networking, open, phpmyadmin, prototype, puppy linux, scalix, soapui, source, tbb, tools, vnc, Vyatta, wifi, Wireshark, , xen, zenoss core, 开源   

    2008年度最佳开源软件大奖 

    为开源社区贡献绵薄之力

     InfoWorld历年的开源软件大奖都相当有分量,不过国内知道或者关注这个奖项的用户并不是特别多。InfoWorld 2008年的“开源软件大奖”最新出炉,CHIP软件社区乘此机会将InfoWorld 2008年的“开源软件大奖”中文化并进行整理,希望能够为中国用户带来便利,也希望能够为开源社区共享绵薄之力。
    由于InfoWorld的评选软件范围广、类别多,很多时候在同一个类别中,桌面版软件和服务器版软件常常混杂在一起,限于时间和水平,这个专题的组织和本地化肯定有不妥甚至是错漏之处,欢迎用户和网友批评指正。

      (阅读全文 …)

     
  • bixuan 10:13 on 2008 年 08 月 07 日 链接地址 | 回复
    Tags: GPL, mysql, , , tutorial   

    Q4M 

    What is Q4M?

    Q4M (Queue for MySQL) is a message queue licensed under GPL that works as a pluggable storage engine of MySQL 5.1, designed to be robust, fast, flexible. The development started in late December of 2007, and although it is very primitive, operates quite swiftly.
    To start using Q4M, download either a binary or source distribution from the install page, and follow the installation instructions. A small tutorial is also avialable. You may use SQL to access Q4M queues, or there is a wrapper module available for perl (Queue::Q4M).
    For more information, please read the developer’s weblog (Kazuho@Cybozu Labs) or subscribe to the mailing list
    看上去非常不错,自己没实际用过,希望有用过的朋友分享一下经验。
     
  • bixuan 19:30 on 2008 年 06 月 29 日 链接地址 | 回复
    Tags: amavisd-new, , dovecot, mail, mysql, postfix, rhms, , spf, squirrelmail, ssl   

    rhms-0.5.0 发布了 

    邮件服务器解决方案 rhms-0.5.0 发布了。这个版本的亮点主要有:

    * 增加了 SPF 检测功能,有效抵挡垃圾邮件;
    * 增加了 DKIM/DomainKeys 的检测和签署功能;
    * 增加了 Horde WebMail 1.1;
    * 为 Apache 增加了 TLS/SSL 支持;
    * 更灵活的用户收发邮件权限控制;
    * 增加了对已有 MySQL 环境的支持;
    * Postfix, Dovecot, Amavisd-new, SquirrelMail 都升级到了最新版本;

    下载地址:
    (阅读全文 …)

     
  • bixuan 17:27 on 2008 年 06 月 26 日 链接地址 | 回复
    Tags: api, async, mysql   

    异步MySQL API 

    I’ve been telling to people that we need async MySQL client API. The fact that you have to block while database box is thinking (doesn’t happen too often, but still..) is holding back some nice response-time oriented coding practices.

    (阅读全文 …)

     
  • bixuan 11:43 on 2007 年 12 月 16 日 链接地址 | 回复
    Tags: cluster, mysql, , replication   

    比较关注的几个和mysql相关的GPL软件 


    MySQL Proxy: http://forge.mysql.com/wiki/MySQL_Proxy
    MySQL Cluster: http://www.mysql.com/products/database/cluster/
    MySQL Replication: http://dev.mysql.com/doc/refman/5.0/en/replication.html

     
c
写新的
j
下一篇文章/下一个回复
k
前一篇文章/以前的回复
r
回复
e
编辑
o
显示/隐藏 回复
t
回到顶部
l
go to login
h
show/hide help
esc
取消