- 积分
- 69
- UID
- 18704
- 阅读权限
- 20
- 注册时间
- 2015-5-21
- 精华
- 在线时间
- 小时
- 最后登录
- 1970-1-1
- 职业
- 1
|
本帖最后由 sjip008 于 2015-10-9 09:42 编辑
操作系统:contos 7
mysql:5.6.26 mysql community server (GPL)
对数据库进行操作 但binlog中没有操作日志 。下面有具体操作。
日志记录
mysql> show variables like '%log_bin';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin | ON |
| sql_log_bin | ON |
+---------------+-------+
2 rows in set (0.00 sec)
mysql> show master status;
+----------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+----------------+----------+--------------+------------------+-------------------+
| log-bin.000011 | 120 | tpceshi | | |
+----------------+----------+--------------+------------------+-------------------+
mysql> use cpceshi
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
mysql>
mysql> show tables;
+-------------------+
| Tables_in_cpceshi |
+-------------------+
| hello |
+-------------------+
1 row in set (0.00 sec)
mysql> insert into hello values(3,'aaa');
Query OK, 1 row affected (0.00 sec)
mysql> select * from hello;
+------+----------+
| id | name |
+------+----------+
| 1 | hsq |
| 2 | xiaoming |
| 3 | aaa |
+------+----------+
3 rows in set (0.00 sec)
但是进入log-bin.000011没有相关操作日志 这是为啥有点无语。。。怎么排查错误?
附加log-bin.000011日志
[root@localhost ~]# mysqlbinlog /var/lib/mysql/log-bin.000011
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#151009 9:21:28 server id 1 end_log_pos 120 CRC32 0x2a379c9f Start: binlog v 4, server v 5.6.26-log created 151009 9:21:28 at startup
# Warning: this binlog is either in use or was not closed properly.
ROLLBACK/*!*/;
BINLOG '
mBYXVg8BAAAAdAAAAHgAAAABAAQANS42LjI2LWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACYFhdWEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAZ+c
Nyo=
'/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
附加 my.cnf参数配置
[root@localhost ~]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/ ... ation-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#主从新添加的内容
port=3306
log-bin=log-bin
server-id=1
expire-logs-days = 7
##binlog-do-db=hsq
#binlog-ignore-db=mysql
binlog-do-db=tpceshi
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
|
|