神秘果 on 十一月 15th, 2009

Mysql状态变量通过”show global status”(自Mysql上次启动以来的统计)获取,重要的参数包括各种SQL执行频率,索引使用情况、锁资源使用情况等。

长时间运行的Mysql服务器,运行flush status;可以重置一些计数器优化性能。
Read the rest of this entry »
神秘果 on 十一月 11th, 2009

Mysql主从复制是一台服务器充当主服务器,另一台或多台服务器充当从服务器,主机自动复制到从机。对于多级复制,数据服务器即可充当主机,也可充当从机。Mysql复制的基础是主服务器对数据库修改记录二进制日志binlog,从服务器通过主服务器的binlog自动执行更新。

Read the rest of this entry »

神秘果 on 十一月 4th, 2009

TCMallocThread-Caching Malloc)是google-perftools工具中的一个,与标准的glibc库的malloc相比,TCMalloc在内存的分配上效率和速度要高得多,可以提高Mysql服务器在高并发情况下的性能,降低系统负载。

Read the rest of this entry »

神秘果 on 十一月 2nd, 2009

以下是Mysql数据库服务器配置文件/etc/my.cnf的详细配置。应用场合是InnoDB引擎,4CPU 32SUSE

Read the rest of this entry »
神秘果 on 十月 29th, 2009

InnoDB引擎下发现,Mysql的主从热备存在数据不一致的问题,一些数据没有成功同步到备机。在use databases后,更新的表必须是当前选择的database才同步。譬如连上Mysql服务后操作:

Read the rest of this entry »

神秘果 on 十月 27th, 2009

长短连接区别

不同于mysql_connect的短连接,mysql_pconnect持久连接的时候,将先尝试寻找一个在同一个主机上用同样的用户名和密码已经打开的(持久)连接,如果找到,则返回此连接标识而不打开新连接。
Read the rest of this entry »
神秘果 on 十月 27th, 2009

Apache通过多路处理模块Multi-Processing ModuleMPM控制并发,常用的有两种模式:prefork(默认)和worker,通过apachectrl  -l可看到当前加载MPM模块(prefork.c或者worker.c)。

Read the rest of this entry »
神秘果 on 七月 14th, 2009

前面一篇文章介绍了mysql server has gone away的错误和解决办法,可见Mysql server has gone away连接超时。除了那几种方式外,通过程序编码方式变更也可解决连接丢失的问题。

Read the rest of this entry »

神秘果 on 六月 14th, 2009

程序客户端使用长连接链接到Mysql服务器,空闲一个晚上,客户端再次查询的时候,就会提示错误:

Error Code: 2006 – MySQL server has gone away

Read the rest of this entry »

神秘果 on 五月 24th, 2009
mysqldump -uroot -ppassword –default-character-set=latin1 –opt –routines –master-data=1 –single-transaction  –flush-logs –force DBName > tt.txt
Read the rest of this entry »