In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use docker to open mysql's binlog log to solve data volume problems", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use docker to open mysql's binlog log to solve data volume problems" this article.
Preface
In the development, we need to monitor the data table by listening to the binlog log file of mysql. Because mysql is deployed in the docker container, we also need to solve the problem of data volume.
1. Open a mysql image docker run-p 3307 MYSQL_ROOT_PASSWORD=123456 3306-- name myMysql-v / usr/docker/mysql/data:/var/lib/mysql-e MYSQL_ROOT_PASSWORD=123456-d mysql:5.7.25 by data volume.
Note: you need to create a file under the host directory in advance to save the dataset of mysql. The directory I created here is / usr/docker/mysql/data.
And / var/lib/mysql is a fixed directory after mysql image is enabled. Generally, we don't need to interfere with it manually. You can keep it by default.
2. Connect and test the mysql
Use the client connection tool to connect to the mysql and try to observe how mysql_binlog is turned on
You can see that the log function is not enabled at this time. At the same time, we can also go to the mount directory of the host to take a look.
3. Enable bin_log
Execute the following commands in turn
Docker exec myMysql bash-c "echo 'log-bin=/var/lib/mysql/mysql-bin' > > / etc/mysql/mysql.conf.d/mysqld.cnf" docker exec myMysql bash-c "echo' server-id=123454' > > / etc/mysql/mysql.conf.d/mysqld.cnf" 4, restart mysql mirror docker restart myMysql5, create a database and create a table with a piece of data in it
At this time, let's observe the changes of bin_log, which shows that the log of bin_log has been generated at this time.
You can also enter the host directory for observation. At this time, log files have been generated under the host machine.
The above is all the contents of the article "how to use docker to open mysql's binlog log to solve data volume problems". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.