Quellcode durchsuchen

Started work on binlog

Josh Brickner vor 7 Jahren
Ursprung
Commit
7b9059800a
5 geänderte Dateien mit 16 neuen und 9 gelöschten Zeilen
  1. 0 1
      binlog/commands.go
  2. 2 2
      binlog/connection.go
  3. 5 0
      conf/my.cnf
  4. 2 2
      config.json
  5. 7 4
      docker-compose.yaml

+ 0 - 1
binlog/commands.go

@@ -1,7 +1,6 @@
 package binlog
 
 const COMMAND_BIN_LOG_DUMP = 0x12
-
 const BINLOG_DUMP_NON_BLOCK = 0x01
 
 type BinLogDumpCommand struct {

+ 2 - 2
binlog/connection.go

@@ -166,10 +166,10 @@ func (d Driver) Open(dsn string) (driver.Conn, error) {
 	r, err := c.listen()
 	switch r.(type) {
 	case *OKPacket: // Login successful.
-		fmt.Println("OK: Init bin log")
+		c.sequenceId = 0
 		bldc := &BinLogDumpCommand{
 			Status:   COMMAND_BIN_LOG_DUMP,
-			Position: 0,
+			Position: 120,
 			Flags:    BINLOG_DUMP_NON_BLOCK,
 			ServerId: c.Config.ServerId,
 			Filename: c.Config.BinLogFile,

+ 5 - 0
conf/my.cnf

@@ -0,0 +1,5 @@
+[mysqld]
+server-id = 1
+log_bin = /tmp/mysql-bin.log
+binlog_do_db = information_schema
+binlog_checksum = NONE

+ 2 - 2
config.json

@@ -9,6 +9,6 @@
   "ssl-cer": "",
   "ssl-ca": "/Users/josh/Sites/Certificates.pem",
   "verify-cert": false,
-  "server-id": 2,
-  "binlog-file": "file-one"
+  "server-id": 1,
+  "binlog-file": "mysql-bin.000004"
 }

+ 7 - 4
docker-compose.yaml

@@ -7,9 +7,9 @@ services:
       MYSQL_DATABASE: root
     ports:
       - "3318:3306"
-    command: "--ssl"
-    # command: "--default-authentication-plugin=mysql_native_password"
     restart: always
+    volumes:
+        -  "./conf/my.cnf:/etc/mysql/my.cnf"
   mysql57:
     image: mysql:5.7
     environment:
@@ -17,8 +17,9 @@ services:
       MYSQL_DATABASE: root
     ports:
       - "3317:3306"
-    # command: "--default-authentication-plugin=mysql_native_password"
     restart: always
+    volumes:
+        -  "./conf/my.cnf:/etc/mysql/my.cnf"
   mysql56:
     image: mysql:5.6
     environment:
@@ -26,5 +27,7 @@ services:
       MYSQL_DATABASE: root
     ports:
       - "3316:3306"
-    # command: "--default-authentication-plugin=mysql_native_password"
     restart: always
+    volumes:
+        -  "./conf/my.cnf:/etc/mysql/my.cnf"
+