As a widely used open source relational database management system, MySQL is known for its fast, reliable, easy-to-use, and open source characteristics, and uses MySQL to store and manage data, which has been widely used in various fields and various large and small applications.
The picture comes from the Internet
In applications that use MySQL to store and manage data, connection requests to and from the database are inevitable and frequent. However, due to various reasons, such as network outages, MySQL server restarts, long idle connections, etc., the connection will be interrupted. Today, I will talk about how Raysync solves the problem of data file transfer connection timeout by appropriately configuring the relevant fields of MySQL.
Introduction to the MySQL connection timeout field
wait_timeout and interactive_timeout are the timeout setting fields for the two connection sessions on the MySQL server:
This field wait_timeout refers to the amount of time that a MySQL session (connection) remains open without any activity. If there is no data file transfer activity during this time period, the connection will be dropped. This setting applies to all types of client connections, including command lines, applications, etc.
interactive_timeout also refers to the amount of time a MySQL session (connection) remains open without any activity. However, unlike wait_timeout, interactive_timeout only applies to interactive sessions, i.e. connections from the terminal or command line.
The picture comes from the Internet
How to configure the timeout period for a MySQL connection
Since interactive_timeout only applies to interactive sessions, i.e. connections from the terminal or command line, the main modification is wait_timeout this configuration (in seconds, the default is 28800 i.e. 8 hours).
1 Review the current configuration
show global variables like '%timeout%'
2 Temporary Modifications
SET GLOBAL wait_timeout = 180;
SET GLOBAL interactive_timeout = 180;
3 Permanent Modifications
Modify the MySQL configuration file (my.cnf or my.ini): Open the MySQL configuration file, find the corresponding parameters, modify their values, and save the file!! In the configuration file, you can find a line similar to the following to set the timeout:
wait_timeout = 180
interactive_timeout = 180
summary
According to the scenario in which the application connects to the database, configuring an appropriate timeout period can effectively avoid idle waste of connection resources and potential interruptions. Raysync products (privatized deployment scheme, can also be connected to the public cloud, enterprises and social organization users can apply for free trial) for different data file transfer customer needs, you can modify the mysql_pool_recycle field in the server configuration file (consistent with wait_timeout) to ensure that the connection is always valid.
Raysync provides a one-stop file transfer acceleration solution, aiming to achieve high-performance, safe and stable data transfer acceleration services for customers in many industries such as IT, film and television, biological genetics, and manufacturing. Traditional file transfer methods (such as FTP/HTTP/CIFS) have problems in many aspects such as transmission speed, transmission security, and system control, while Raysync file transfer solutions can meet customers' all-round needs in file transfer acceleration, transmission security, management and controllability through independent research and development and technological innovation.