highdb.com
percona – Arster's blog
http://highdb.com/tag/percona
My articles and thoughts. MySQL slave 延迟复制 延迟复制是一个很简单的概念,区别于传统的异步复制(接近实时), 比如用户误操作, 删除了重要的表, 延迟复制特性保证了用户有机会从延迟的 slave 中恢复误删除的表. 该特性的问题在于需要保证用户有足够的时间从 slave 阻止误操作复制的发生. 要理解该特性如何实现, 我们先简单回顾下 MySQL replication 如何实现, 见下图: 当 master 有一个更新操作(create, drop, delete, insert, update 等), 该更新操作应用到本地的磁盘并写到 binary log 里,之后更新操作异步(接近于实时)的从master…. Pt-osc chunking handles multi-column indexes poorly. Top 10 percona toolkit tools(五). 9 pt-table-checksum http:/ www.percona.com/doc/percona-toolkit/2.2/pt-table-che...7 pt-quer...
highdb.com
Arster's blog – Page 2 – my articles and thoughts
http://highdb.com/page/2
My articles and thoughts. Mysql upgrade 升级错误出现 table doesn’t exist 错误整理. 从 MySQL 官方的 5.1.48 版本升级到 Percona 5.1.73 版本, 在使用 mysql upgrade 的时候出现一些错误, 该原因可能为innodb表文件丢失或损坏, 或使用了不正确的方式删除表. 错误信息如下所示: [root@cz ]# cd /opt/Percona-Server-5.1.73-rel14.12-624.Linux.x86 64/ [root@cz Percona-Server-5.1.73-rel14.12-624.Linux.x86 64]# ./bin/mysql upgrade -S /export/mysql/node3307/data/s3307 -p –verbose … Repairing table test.蔢 Error…. Qtunnel 加密数据库主从复制通道 链接见: https:/ github.com/getqujing/qtunnel https:/ github.c...重启 ip...
highdb.com
performance – Arster's blog
http://highdb.com/category/performance
My articles and thoughts. MySQL Router 测试使用 1. 特性 MySQL Router 并没有包括一些特别新的特性, 总体上看中规中矩, 不过 first-available 和插件两个特性挺有意思, 后续会进行讲解, 特性包括: 对连接请求进行路由; 和 Fabric 配套使用, 方便管理; 插件特性, 需要的功能以插件形式提供; 2. 配置 MySQL Router 在启动的时候会读取默认的配置文件, 用户可以通过 -DROUTER CONFIGDIR= 或编辑 cmake/settings.cmake…. 重启 iptables 影响 nf conntrack 参数说明. 1 介绍 详见: https:/ github.com/tobert/pcstat pcstat 是 page cache stats 的缩写, 使用该工具可以帮助我们判断一个文件是否被 Linux cache 缓存, 或获取进程在 cache 中的缓存信息. 这在调优数据库或诊断其他 IO 密集型应用的场景下会有所帮助. 该工具的输出有多种格式, 选项包括: Usa...Env环境: Di...
highdb.com
performance – Arster's blog
http://highdb.com/tag/performance
My articles and thoughts. 1 介绍 详见: https:/ github.com/tobert/pcstat pcstat 是 page cache stats 的缩写, 使用该工具可以帮助我们判断一个文件是否被 Linux cache 缓存, 或获取进程在 cache 中的缓存信息. 这在调优数据库或诊断其他 IO 密集型应用的场景下会有所帮助. 该工具的输出有多种格式, 选项包括: Usage of ./pcstat: -bname=false: convert paths to basename…. Perl one line command – 常用正则. Perl one line command – 输出和删除行. Perl one line command – 转义和替换. Perl one line command – 字符串与数组. Common utilities for sysadmin/dba. Mysql upgrade 升级错误出现 table doesn’t exist 错误整理. On Perl one line command – ...
highdb.com
percona – Arster's blog
http://highdb.com/category/percona
My articles and thoughts. Mysql upgrade 升级错误出现 table doesn’t exist 错误整理. 从 MySQL 官方的 5.1.48 版本升级到 Percona 5.1.73 版本, 在使用 mysql upgrade 的时候出现一些错误, 该原因可能为innodb表文件丢失或损坏, 或使用了不正确的方式删除表. 错误信息如下所示: [root@cz ]# cd /opt/Percona-Server-5.1.73-rel14.12-624.Linux.x86 64/ [root@cz Percona-Server-5.1.73-rel14.12-624.Linux.x86 64]# ./bin/mysql upgrade -S /export/mysql/node3307/data/s3307 -p –verbose … Repairing table test.蔢 Error…. Pt-osc chunking handles multi-column indexes poorly. Top 10 percona toolkit tools(五).
highdb.com
MySQL – Arster's blog
http://highdb.com/tag/mysql
My articles and thoughts. 背景介绍 本文基于一个 discuz 论坛表的需求描述 — 将论坛中所有表为 mediumint(8) 的字段升级为 int(10), 以存储更大的用户 id 信息; 通过批量升级字段的方式也适用于其它相关的需求. 顺便吐槽下 discuz 这么多年以来对基础表的优化接近于无, 在用户较多或访问较频繁的场景下, 基础表的结构依然缺乏比较完善的设计. 步骤 考虑到论坛运行一段时间后, 一些表会比较大, 如果业务需要持续运行的话, 不太适合直接 alter table 的方式更新表, 下文会介绍使用 percona 的工具完成修改, 所以在整个流程中分为以下步骤操作:…. Qtunnel 加密数据库主从复制通道 链接见: https:/ github.com/getqujing/qtunnel https:/ github.com/chenzhe07/qtunnel 背景 在异地机房的环境下, MySQL 数据同步复制基于 tcp 的明文传输, slave 接收到的 sql 语句可以很容易的被监听到, 对于敏感数据, 这种简单的异地复制是很...最近碰到一...
highdb.com
system – Arster's blog
http://highdb.com/category/system
My articles and thoughts. Common utilities for sysadmin/dba. Sys-toolkit Some useful scripts to sysadmins/dbas. read more from: https:/ github.com/chenzhe07/sys-toolkit toolkit lists: sys-genpass sys-nton sys-pubip sys-ascii sys-ipton sys-lock-run sys-repeat sys-checkport sys-echo-stderr sys-php-chroot sys-tcp-port-proxy sys-shell-type sys-memory-maps sys-mem-redis-summary sys-mysql-summary sys-mysql-adj sys-mysql-kill-blocked-thread sys-mysql-kill-long-query…. 重启 iptables 影响 nf conntrack 参数说明. 重启 iptabl...
highdb.com
sql – Arster's blog
http://highdb.com/tag/sql
My articles and thoughts. 了解 select count(*), count(1) 和 count(field). 我们以 MySQL 中的聚合函数 count 来说明 count(*), count(1) 和 count(field) 三者之间的关系以及背后的原理. 概念 http:/ dev.mysql.com/doc/refman/5.6/en/group-by-functions.html#function count COUNT(expr) 函数返回 select 语句中表达式 expr 非 null 值的数量, 返回值类型为 bigint. Returns a count of the number of non-NULL…. SQL 审核说明 1.概述 SQL: Audit模块审核是以MySQL audit插件为基础, 通过分析SQL记录的来源(audit.log或socket)和使用情况(存储引擎, 索引使用,字符集等)以期避免开发对生产环境主机的影响。 审核部分主要包括 操作日志记录、 统计分析、 SQL改写、 SQL索引分析、 SQL安全、 邮件发送。
highdb.com
了解 select count(*), count(1) 和 count(field) – Arster's blog
http://highdb.com/了解-select-count-count1-和-countfield
My articles and thoughts. 了解 select count(*), count(1) 和 count(field). 了解 select count(*), count(1) 和 count(field). 我们以 MySQL 中的聚合函数 count 来说明 count(*), count(1) 和 count(field) 三者之间的关系以及背后的原理. Http:/ dev.mysql.com/doc/refman/5.6/en/group-by-functions.html#function count. COUNT(expr) 函数返回 select 语句中表达式 expr 非 null 值的数量, 返回值类型为 bigint. Returns a count of the number of non-NULL values of expr in the rows retrieved by a SELECT statement. The result is a BIGINT value. MyISAM表: MyISAM表的索引组织包含的行数信息, MySQL 只需要返回...
highdb.com
MySQL slave 延迟复制 – Arster's blog
http://highdb.com/mysql-slave-延迟复制
My articles and thoughts. 延迟复制是一个很简单的概念,区别于传统的异步复制(接近实时), 比如用户误操作, 删除了重要的表, 延迟复制特性保证了用户有机会从延迟的 slave 中恢复误删除的表. 该特性的问题在于需要保证用户有足够的时间从 slave 阻止误操作复制的发生. 要理解该特性如何实现, 我们先简单回顾下 MySQL replication 如何实现, 见下图:. 当 master 有一个更新操作(create, drop, delete, insert, update 等), 该更新操作应用到本地的磁盘并写到 binary log 里,之后更新操作异步(接近于实时)的从master 的 binary log 复制到 slave 的 relay log, 最后 slave 的 sql thread 线程读取 relay log, 将更新操作应用到 slave 表中. 1 MySQL 5.6 的延迟复制. 不过需要注意的是, 即便在延迟复制的过程中, master 出现问题, 更新操作也不会丢失,因为更新操作已经复制到了 slave 的 relay log 中.