Category: Database

MySQL (102)
Oracle (26)
Redis (8)
SQLServer (2)

go-mysql-elasticsearch: Syncing MySQL Data to Elasticsearch

Project GitHub address: https://github.com/siddontang/go-mysql-elasticsearch The basic principle of go-mysql-elasticsearch is: when the program starts for the first time, it first uses the mysqldump tool to perform a full sync of the source MySQL database, then writes data to ES through the elasticsearch client; then it implements a mysql client that connects to the source MySQL as a slave. The source MySQL as master will synchronize all data update operations to the slave via binlog events. By parsing the binlog events, you can obtain the updated content of the data, and then write it to ES.

MySQL Table Synchronization Trigger

Trigger Synchronization Between Two Tables in the Same Database:

#Insert
delimiter ||
DROP TRIGGER IF EXISTS t_afterinsert_on_tab1 ||
CREATE TRIGGER t_afterinsert_on_tab1
AFTER INSERT ON test1
FOR EACH ROW
BEGIN
insert into test2 …

MySQL Import Error: Invalid Default Value Fix

Due to a database upgrade, an error occurs when importing an SQL file from a lower version database into a higher version database:

The reason is the database SQL mode: mysql> show variables like 'sql_mode'; #Check current mode
| sql_mode | ONLY_FULL_GROUP_BY,STRICT_T …

MySQL Binlog Recovery Guide

Query the logs to locate the recovery starting point and export the SQL: Here we use the 10_163_0_72-bin.000009 binlog as an example:

mysqlbinlog –no-defaults –start-datetime="2019-01-11 18:38:56" –database=superstar /home/10_163_0_72-bi …

How to Compile and Install MySQL 5.7.13 on CentOS 7 Step by Step

MySQL 5.7 Key Features: Better Performance
With better optimization for multi-core CPUs, solid-state drives, and locking, 1 million QPS is no longer MySQL’s goal—whether the next version can reach 2 million QPS is what users care more about. Better InnoDB Storage Engine and More Robust Replication
Replication brings data integri …