Mysql

為什麼要強制重啟實例?

  • April 18, 2019

這是 My SQL Project 實例日誌。我將實例設置為不自動關閉。但是為什麼實例會不規律的自動關閉呢?

2019-03-28 08:58:13.100 JST
2019-03-27 23:58:13 402333 [Note] : Normal shutdown
2019-03-28 08:58:13.100 JST
2019-03-27 23:58:13 402333 [Note] Giving 86 client threads a chance to die gracefully
2019-03-28 08:58:13.100 JST
2019-03-27 23:58:13 402333 [Note] Event Scheduler: Killing the scheduler thread, thread id 1
2019-03-28 08:58:13.100 JST
2019-03-27 23:58:13 402333 [Note] Event Scheduler: Waiting for the scheduler thread to reply
2019-03-28 08:58:13.100 JST
2019-03-27 23:58:13 402333 [Note] Event Scheduler: Stopped
2019-03-28 08:58:13.100 JST
2019-03-27 23:58:13 402333 [Note] Event Scheduler: Purging the queue. 8 events
2019-03-28 08:58:13.100 JST
2019-03-27 23:58:13 402333 [Note] Shutting down slave threads
2019-03-28 08:58:15.101 JST
2019-03-27 23:58:15 402333 [Note] Forcefully disconnecting 77 remaining clients
2019-03-28 08:59:15.029 JST
2019-03-27 23:59:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-03-28 08:59:15.029 JST
2019-03-27 23:59:15 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2019-03-28 08:59:15.029 JST
2019-03-27 23:59:15 0 [Note] (mysqld 5.6.39) starting as process 681358 ...
2019-03-28 08:59:15.135 JST
2019-03-27 23:59:15 681358 [Note] Semi-sync replication initialized for transactions.
2019-03-28 08:59:15.135 JST
2019-03-27 23:59:15 681358 [Note] Semi-sync replication enabled on the master.
2019-03-28 08:59:15.164 JST
2019-03-27 23:59:15 681358 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-03-28 08:59:15.164 JST
2019-03-27 23:59:15 681358 [Note] InnoDB: The InnoDB memory heap is disabled
2019-03-28 08:59:15.164 JST
2019-03-27 23:59:15 681358 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-03-28 08:59:15.164 JST
2019-03-27 23:59:15 681358 [Note] InnoDB: Memory barrier is not used
2019-03-28 08:59:15.164 JST
2019-03-27 23:59:15 681358 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-03-28 08:59:15.165 JST
2019-03-27 23:59:15 681358 [Note] InnoDB: Using CPU crc32 instructions
2019-03-28 08:59:15.169 JST
2019-03-27 23:59:15 681358 [Note] InnoDB: Initializing buffer pool, size = 384.0M
2019-03-28 08:59:15.194 JST
2019-03-27 23:59:15 681358 [Note] InnoDB: Completed initialization of buffer pool
2019-03-28 08:59:15.876 JST
2019-03-27 23:59:15 681358 [Note] InnoDB: Highest supported file format is Barracuda.
2019-03-28 08:59:16.055 JST
2019-03-27 23:59:16 681358 [Note] InnoDB: The log sequence numbers 15484232789 and 15484232789 in ibdata files do not match the log sequence number 15556766492 in the ib_logfiles!
2019-03-28 08:59:16.055 JST
2019-03-27 23:59:16 681358 [Note] InnoDB: Database was not shutdown normally!
2019-03-28 08:59:16.055 JST
2019-03-27 23:59:16 681358 [Note] InnoDB: Starting crash recovery.
2019-03-28 08:59:16.055 JST
2019-03-27 23:59:16 681358 [Note] InnoDB: Reading tablespace information from the .ibd files...
2019-03-28 08:59:18.420 JST
2019-03-27 23:59:18 681358 [Note] InnoDB: Restoring possible half-written data pages
2019-03-28 08:59:18.420 JST
2019-03-27 23:59:18 681358 [Note] InnoDB: from the doublewrite buffer...
2019-03-28 08:59:25.719 JST
2019-03-27 23:59:25 681358 [Note] InnoDB: 128 rollback segment(s) are active.
2019-03-28 08:59:25.722 JST
2019-03-27 23:59:25 681358 [Note] InnoDB: Waiting for purge to start
2019-03-28 08:59:25.773 JST
2019-03-27 23:59:25 681358 [Note] InnoDB: 5.6.39 started; log sequence number 15556766492
2019-03-28 08:59:25.804 JST
2019-03-28 08:59:27.036 JST
2019-03-27 23:59:27 681358 [Note] Event Scheduler: Loaded 8 events
2019-03-28 08:59:27.037 JST
2019-03-27 23:59:27 681358 [Note] : ready for connections.
2019-03-28 08:59:27.037 JST

版本:“5.6.39”套接字:“”埠:0(38、40)(Google)2019-03-28 08:59:27.038 JST 2019-03-27 23:59:27 681358

$$ Note $$事件調度程序:調度程序執行緒以 id 1 開始 google-cloud-sql中是否有將實例設置為自動關閉的部分?

您的實例是第 1 代還是第 2 代?第一代實例的啟動策略配置可能會導致您的實例在 15 分鐘不活動後自動關閉。

關於您的底線問題:是的,實例設置為自動關閉(兩代)以進行維護。對於第二代實例,您可以指定維護時段

更新

您的第一代實例可能會自行關閉以進行維護。我建議您將實例升級到第二代。

InnoDB 的 buffer_pool 位於 RAM 中。將其大小設置為 4GB,但只有 0.5GB 的 RAM 會導致大量交換。交換對性能來說很糟糕。改為innodb_buffer_pool_size100M。

再說一次,記憶體這麼小,你的 `max_connections 不應該很高。假設是 20,而不是 1000。

“每天有 100 個使用者同時連接”——我可以用兩種方式來解釋。請檢查Threads_runningMax_used_connections(見SHOW GLOBAL STATUS

引用自:https://dba.stackexchange.com/questions/233364