percona-toolkit系列-pt-align
pt-align这个工具用于对文件格式进行格式化输出例子:对比align文件格式化输出前后,文件格式的不同[root@goolen goolen]# pt-align --helppt-align aligns output from other tools to columns. If no FILES are specified,STDIN is read. For more details, please use the --help option, or try 'p...
percona-toolkit系列
下载地址http://www.percona.com/redir/downloads/percona-toolkit/LATEST/RPM/percona-toolkit-2.2.12-1.noarch.rpm安装:[root@goolen goolen]# ls percona-toolkit-2.2.12-1.noarch.rpm percona-toolkit-2.2.12-1.noarch.rpm[root@goolen goolen]# rpm -ivh percona-toolkit-2.2.12-1.noarch.rpm命令集:[...
default-character-set参数导致MHA启动失败
启动MHA的时候,进程报错退出:[root@test11g ~]# masterha_check_status --conf=/etc/masterha/mha.cnf mha is stopped(2:NOT_RUNNING).[root@test11g ~]# nohup masterha_manager --conf=/etc/masterha/mha.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /tol/mha/log/manager.log 2>&1 ...
MHA自动failover测试系列-master主机关机,MHA的切换
环境:Master:192.168.100.50Slave1:192.168.100.48Slave2:192.168.100.141(MHA管理节点)[root@test11g ~]# masterha_check_status --conf=/etc/masterha/mha.cnf mha (pid:19234) is running(0:PING_OK), master:192.168.100.50+++master上执行关机命令[root@goolen ~]# init 0[root@test11g log]# ...
MHA启动过程
环境:Master:192.168.100.50Slave1:192.168.100.48Slave2:192.168.100.141(MHA管理节点)[root@test11g log]# tail -f mha.log Thu Nov 20 17:51:50 2014 - [info] MHA::MasterMonitor version 0.56.Thu Nov 20 17:51:50 2014 - [info] GTID failover mode = 0Thu Nov 20 17:51:50 2014 - [info] Dead S...
MHA状况检查
环境:Master:192.168.100.50Slave1:192.168.100.48Slave2:192.168.100.141(MHA管理节点)+++检查SSH的配置[root@test11g masterha]# masterha_check_ssh --conf=/etc/masterha/mha.cnf Thu Nov 20 17:56:24 2014 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping....
MHA在线切换
环境:Master:192.168.100.48Slave1:192.168.100.50Slave2:192.168.100.141(MHA管理节点)+++停掉MHA监控[root@test11g masterha]# masterha_stop --conf=/etc/masterha/mha.cnf+++切换:[root@test11g masterha]# masterha_master_switch --conf=/etc/masterha/mha.cnf --master_state=alive --new_master_h...
MHA自动failover测试系列-主库mysql进程异常down掉后的切换过程
环境:Master:192.168.100.50Slave1:192.168.100.48Slave2:192.168.100.141(MHA管理节点)模拟主库mysql进程异常down掉,MHA的整个切换过程主库上kill掉mysql进程[root@goolen ~]# ps aux | grep mysql |grep -v grep | awk '{print $2}' | xargs kill -9观察MHA切换日志,了解整个切换过程:[root@test11g...
Unknown/unsupported storage engine: InnoDB
启动mysql 从库的时候报错:# /etc/init.d/mysqld startStarting MySQL (Percona Server)............................................................The server quit without updating PID file (/tol/mysql/d[FAILED]db.pid).查看错误日志:# tail -30f mysql.err InnoDB: Unable to lock ./ibdata1, erro...
ERROR 1093 (HY000): You can't specify target table 'a' for update in FROM clause
开发的问我一个mysql 执行update语句报错的问题模拟测试语句如下:mysql> update g10 a set a.l = (select max(b.l) + 1 from g10 b where b.c = 1 and b.p = 3 ) -> where a.c = 1 and a.p = 3;报错如下ERROR 1093 (HY000): You can't specify target table 'a' for update in FROM clausemysql对这...
varchar类型的字段存储纯数字的排序
如果表字段的类型为varchar型,但是里面存储的是纯数字,怎么实现按照数字的大小来排序?下面的方法对于mysql和oracle都实用order by 字段+0order by 字段*1等等都可以实现例子:Mysql:mysql> select * from goolen;+------+| id |+------+| 1 || 2 || 3 ||...
Mysql里特殊的排序方法
刚刚遇到个特殊需求,如下查询,先根据ddate和money排序查询出10条数据,但是如果查询出来的记录的id中包含特殊id,如vip会员的id,需要排序到最前面;mysql> select id,money,ddate,type,size from pincome order by ddate desc,money desc limit 10; +...
注意Oracle与Mysql中的null值
在mysql中,null与''是不相同的,''会插入一个空字符串mysql> select version();+------------+| version() |+------------+| 5.5.18-log |+------------+1 row in set (0.00 sec)mysql> create table goolen (name varchar(10) primary key); Query OK, 0 rows affected (0.03 sec)mysql> insert i...
master and slave have equal MySQL server ids
今天看到一网友在群里发的mysql从库无法进行同步,查看状态,报如下错误:Slave_IO_Running: NoSlave_SQL_Running: YesLast_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same...
File './mysql-bin.index' not found (Errcode: 13)
今天做一个mysql的备机,拷贝数据的过程出现了一点点权限问题,记录一下数据copy完成之后启动备库[root@localhost data]# /etc/init.d/mysql startStarting MySQL (Percona Server).The server quit without upd[FAILED]D file (/tol/mysql/data/localhost.localdomain.pid).查看错误日志[root@localhost data]# cat...
mysqldump: Got error: 1146: Table
今早想对我的mysql测试哭做个备份的时候出现错误如下:[root@meizi ~]# mysqldump -uroot -p goolen > goolen.sql Enter password: mysqldump: Got error: 1146: Table 'goolen.ggschkpt' doesn't exist when using LOCK TABLES[root@meizi ~]# mysql -uroot -pEnter password: ...
Table already exists error when the table does not exist
今天在一套mysql的库里发现一个问题,要创建一个表的时候,提示这个表已经存在,要drop的时候,提示此表不存在mysql> CREATE TABLE cms_attach_source (id int); ERROR 1050 (42S01): Table '`koo_cms`.`cms_attach_source`' already existsmysql>&...
mysql导入sql文件的时候报错Segmentation fault
今天用crontab定时同步一个用户的数据,发现脚本执行失败了错误日志如下:begin imp exam at: 2014-05-06 00:00:38/mysql/task/imp_exam_everyday.sh: line 4: 11989 Segmentation fault /mysql/app/mysql/bin/mysql -S /tmp/mysql_3301.sock -uroot -proot exam < /home/exam/exam.sqlend...
Error: 13, Can't get stat of 'import.data' (Errcode: 13)
mysqlimport导入数据的时候报错:[root@library xiaoming]# mysqlimport -uroot -pXXXXX -S /tmp/mysql_3301.sock --fields-terminated-by=" ," --columns=id,type,username,datetime,logtype klb /root/xiaoming/import.datamysqlimport: Error: 13, Can't get stat of '/root/xiaoming/import.data' (...