5

We have deployed REDIS to hold some frequent query result to reduce number of connections made on Database server. We need to find out Max_used_connection after deploying REDIS. So we plan to reset mysql status variable Max_used_connection.

While googling i found to reset Max_used_connections we need to use FLUSH STATUS.

Is it safe to execute Flush status in production ? MySQL docs says:

FLUSH STATUS - resets the counters for key caches (default and named) to zero and sets Max_used_connections to the current number of open connections.

I don't know impact of resetting counters for key caches.

Is it possible to reset Max_used_connections alone ?

Thanks in Advance.

sudalai
  • 631
  • 6
  • 6

2 Answers2

5

Is it safe to execute Flush status in production ?

  • Well it should not affect anything as such but resets the status counters and you should be "Safe".

Is it possible to reset Max_used_connections alone ?

  • No

but "We need to find out Max_used_connection after deploying ...."

  • How about introducing graphs into monitoring? Say Cacti / Grafana will give you good glances over what's-going-on-inside-your-mysql!
mysql_user
  • 1,972
  • 13
  • 9
3

No, it is not safe to run FLUSH STATUS in MySQL. If you run this command on a replica and you have GTIDs enabled, this creates an errant GTID on that replica because FLUSH STATUS ends-up in the binary log. The safe way to run this command is FLUSH LOCAL STATUS or FLUSH NO_WRITE_TO_BINLOG STATUS.

Running FLUSH STATUS on a primary is safe-ish, but it will also propagate to all replicas.

jfg956
  • 338
  • 2
  • 9