1

Using MYSQL, I want to record my data from the general_log table on server A to a table on server B instantly at every data and delete the data from server A at the end of the day. I tried to use Trigger for this, but the general_log does not allow me to write triggers because it sees the system file. Alternatively, when I use the Fedareted table, when I delete the data on server A, those on server B are also deleted. Thanks in advance for your help.

Shadow
  • 33,525
  • 10
  • 51
  • 64
Mert Ayten
  • 13
  • 3
  • 1
    This question has nothing to do with programming, therefore it is off topic here on SO. The DBA sister site of SO provides help in database admin questions like this one. – Shadow Mar 22 '21 at 14:36

2 Answers2

0

I recommend to develop an ETL job to move the data every day and delete it from the old server

0

I would recommend the following strategy:

First, partition the data on in general_log by date. You can learn about table partitioning in the documentation.

Second, set up replication so server B is identify to server A in real time. Once again, you may need to refer to the documentation.

Third, set up a job to remove the previous partition from A shortly after midnight.

To be honest, if you don't understand table partitioning and replication, you should get a DBA involved. In fact, if you are trying to coordinate multiple database servers, you should have a DBA involved, who would understand these concepts and how best to implement them in your environment.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786