Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The mysql's wait_timeout configuration will affect the binlog dump? #131

Open
marunrun opened this issue Jan 17, 2025 · 0 comments
Open

Comments

@marunrun
Copy link

SHOW VARIABLES LIKE "version%"

"version","8.0.13",
"version_comment","Source distribution",
"version_compile_machine","aarch64",
"version_compile_os","Linux",
"version_compile_zlib","1.2.11",

"wait_timeout","86400"


After my service starts, I receive a "Disconnected by remote side" message every day (86400 seconds).

logs :

2025-01-14T15:56:55.634928+08:00 400564673 [Note] [MY-010914] [Server] Aborted connection 400564673 to db: 'unconnected' user: 'root' host: '' (failed on flush_net()).
2025-01-14T15:56:55.634628+08:00 400564673 [Note] [MY-011171] [Server] Stop asynchronous binlog_dump to slave (server_id: 100009).
2025-01-15T15:56:59.217796+08:00 669666506 [Note] [MY-010914] [Server] Aborted connection 669666506 to db: 'unconnected' user: 'root' host: '' (failed on flush_net()).
2025-01-15T15:56:59.216858+08:00 669666506 [Note] [MY-011171] [Server] Stop asynchronous binlog_dump to slave (server_id: 100009).

I tried various methods, and eventually, I resolved the issue by setting the following parameters in the code:

 private function getBinlogStream(): void
    {
        $this->checkSum = $this->repository->isCheckSum();
        if ($this->checkSum) {
            $this->execute('SET @master_binlog_checksum = @@global.binlog_checksum');
        }

        if (0 !== Config::getHeartbeatPeriod()) {
            // master_heartbeat_period is in nanoseconds
            $this->execute('SET @master_heartbeat_period = ' . Config::getHeartbeatPeriod() * 1000000000);
        }
+     $this->execute('set wait_timeout=9999999');
+     $this->execute('set net_write_timeout=7200');
+     $this->execute('set net_read_timeout=7200');
....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant