Kubernetes具備超強的故障恢復機制,Kubernetes會重啟意外停止的pod。我們曾遇到過因記憶體洩露,導致容器在一天內宕機多次的情況,然而令人驚訝的是,甚至我們自己都沒有察覺到。
資料儲存
以我們的情況,在Kubernetes內執行資料儲存沒有想象中那麼完美,設定起來也比其他Kubernetes部署複雜得多。
於是我們決定不在生產環境資料儲存上使用Kubernetes,而是選擇在不同的機器上手動啟動這些叢集,我們在Kubernetes內部執行的應用正常連線到資料儲存叢集
SELECT EVENT_NAME, SUM_TIMER_WAIT/1000000000 WAIT_MS, COUNT_STAR FROM performance_schema.events_waits_summary_global_by_event_name ORDER BY SUM_TIMER_WAIT DESC, COUNT_STAR DESC LIMIT 30;
-- "what the current, or last completed, wait for each session was, and for exactly how long they waited" SELECT NAME, IF(PPS.THREAD_ID = 0, 'Internal Thread', CONCAT(IPS.USER, '@', IPS.HOST)) USER, DB, COMMAND, STATE, TIME, EVENT_NAME LAST_WAIT, IF(TIMER_WAIT IS NULL , 'Still Waiting', TIMER_WAIT/1000000000) LAST_WAIT_MS FROM performance_schema.events_waits_current JOIN performance_schema.threads PPS USING (THREAD_ID) LEFT JOIN INFORMATION_SCHEMA.PROCESSLIST IPS ON IPS.ID = PPS.THREAD_ID;