%3CLINGO-SUB%20id%3D%22lingo-sub-1600013%22%20slang%3D%22en-US%22%3ECommands%20we%20can%20use%20to%20manage%20SQL%20Server%20availability%20group%20on%20Linux%20Pacemaker%20cluster%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1600013%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20to%20%3CSTRONG%3EJayantha%20Das%3C%2FSTRONG%3E%2C%20%26nbsp%3Bwho%20shared%20some%20of%20the%20common%20command%20we%20use%20in%20SQL%20Server%20on%20Linux%20Pacemaker%20Maker%20cluster.%20This%20blog%20contains%20the%20pacemaker%20settings%20that%20we%20can%20modify.%20Unless%20explicitly%20required%20it%20is%20recommended%20that%20we%20don%E2%80%99t%20modify%20the%20values%20as%20it%20can%20cause%20problem%20in%20the%20functionality%20of%20availability%20groups.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EWe%20can%20run%20%E2%80%9Csudo%20pcs%20config%E2%80%9D%20to%20list%20critical%20cluster%20configuration%20settings%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EMaster%3A%20ag_cluster-master%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20Meta%20Attrs%3A%20failure-timeout%3D30s%20notify%3Dtrue%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20Resource%3A%20ag_cluster%20(class%3Docf%20provider%3Dmssql%20type%3Dag)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%20Attributes%3A%20ag_name%3Dag1%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%20%3CSTRONG%3EOperations%3A%20start%20interval%3D0s%20timeout%3D60%20(ag_cluster-start-interval-0s)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20stop%20interval%3D0s%20timeout%3D10%20(ag_cluster-stop-interval-0s)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20promote%20interval%3D0s%20timeout%3D60%20(ag_cluster-promote-interval-0s)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20demote%20interval%3D0s%20timeout%3D10%20(ag_cluster-demote-interval-0s)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20monitor%20interval%3D10%20timeout%3D60%20(ag_cluster-monitor-interval-10)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20monitor%20interval%3D11%20role%3DMaster%20timeout%3D60%20(ag_cluster-monitor-interval-11)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20monitor%20interval%3D12%20role%3DSlave%20timeout%3D60%20(ag_cluster-monitor-interval-12)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EResource%3A%20virtualip%20(class%3Docf%20provider%3Dheartbeat%20type%3DIPaddr2)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20Attributes%3A%20ip%3Dxx.xx.xx.xx%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20Operations%3A%20start%20interval%3D0s%20timeout%3D20s%20(virtualip-start-interval-0s)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20stop%20interval%3D0s%20timeout%3D20s%20(virtualip-stop-interval-0s)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20monitor%20interval%3D10s%20timeout%3D20s%20(virtualip-monitor-interval-10s)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EInterval%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EInterval%20for%20the%20above%20operations%20mean%20how%20frequently%20(in%20seconds)%20to%20perform%20the%20operation.%20A%20value%20of%200%20means%20never.%20A%20positive%20value%20defines%20a%26nbsp%3B%3CEM%3Erecurring%20action%3C%2FEM%3E%2C%20which%20is%20typically%20used%20with%20monitor.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ETimeout%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ETimeout%20for%20the%20above%20operation%20means%20how%20long%20to%20wait%20before%20declaring%20the%20action%20has%20failed%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ERole%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ERole%20for%20the%20above%20operations%20(like%20the%20one%20in%20the%20monitor)%20mean%20run%20the%20operation%20only%20on%20node(s)%20that%20the%20cluster%20thinks%20should%20be%20in%20the%20specified%20role.%20%3CSTRONG%3EThis%20only%20makes%20sense%20for%20recurring%20monitor%20operations%3C%2FSTRONG%3E.%20Allowed%20(case-sensitive)%20values%3A%20Stopped%2C%20Started%2C%20and%20in%20the%20case%20of%20multi-state%20resources%2C%20Slave%20and%20Master.%3C%2FP%3E%0A%3CP%3EThe%20usual%20monitor%20actions%20are%20insufficient%20to%20monitor%20a%20multi-state%20resource%2C%20because%20pacemaker%20needs%20to%20verify%20not%20only%20that%20the%20resource%20is%20active%2C%20but%20also%20that%20its%20actual%20role%20matches%20its%20intended%20one.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20example%2C%3C%2FP%3E%0A%3CP%3EDefine%20two%20monitoring%20actions%3A%20the%20usual%20one%20will%20cover%20the%20slave%20role%2C%20and%20an%20additional%20one%20with%26nbsp%3B%3CSTRONG%3Erole%3D%22master%22%3C%2FSTRONG%3E%26nbsp%3Bwill%20cover%20the%20master%20role.%20In%20the%20case%20of%20Availability%20Groups%20the%20master%20is%20the%20primary%20and%20Slave%20indicates%20the%20secondary%20node.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3COP%3E%3C%2FOP%3E%3C%2FSPAN%3E%3CSPAN%3E%20id%3D%3C%2FSPAN%3E%3CSPAN%3E%22public-ip-slave-check%22%3C%2FSPAN%3E%3CSPAN%3E%20name%3D%3C%2FSPAN%3E%3CSPAN%3E%22monitor%22%3C%2FSPAN%3E%3CSPAN%3E%20interval%3D%3C%2FSPAN%3E%3CSPAN%3E%2260%22%3C%2FSPAN%3E%3CSPAN%3E%2F%26gt%3B%3C%2FSPAN%3E%3CSPAN%3E%3COP%3E%3C%2FOP%3E%3C%2FSPAN%3E%3CSPAN%3E%20id%3D%3C%2FSPAN%3E%3CSPAN%3E%22public-ip-master-check%22%3C%2FSPAN%3E%3CSPAN%3E%20name%3D%3C%2FSPAN%3E%3CSPAN%3E%22monitor%22%3C%2FSPAN%3E%3CSPAN%3E%20interval%3D%3C%2FSPAN%3E%3CSPAN%3E%2261%22%3C%2FSPAN%3E%3CSPAN%3E%20role%3D%3C%2FSPAN%3E%3CSPAN%3E%22Master%22%3C%2FSPAN%3E%3CSPAN%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20is%20crucial%20that%20every%20monitor%20operation%20has%20a%20different%20interval!%20Pacemaker%20currently%20differentiates%20between%20operations%20only%20by%20resource%20and%20interval%3B%20so%20if%20(for%20example)%20a%20master%2Fslave%20resource%20had%20the%20same%20monitor%20interval%20for%20both%20roles%2C%20Pacemaker%20would%20ignore%20the%20role%20when%20checking%20the%20status%E2%80%89%E2%80%94%E2%80%89which%20would%20cause%20unexpected%20return%20codes%2C%20and%20therefore%20unnecessary%20complications.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EConnection%20timeout%20can%20be%20found%20in%20the%20corosync%20logs%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3Emonitor%3A%202019%2F09%2F26%2013%3A48%3A55%20ag-helper%20invoked%20with%20hostname%20%5Blocalhost%5D%3B%20port%20%5B1433%5D%3B%20ag-name%20%5Bag1%5D%3B%20credentials-file%20%5B%2Fvar%2Fopt%2Fmssql%2Fsecrets%2Fpasswd%5D%3B%20application-name%20%5Bmonitor-ag_cluster-monitor%5D%3B%20%3CSTRONG%3Econnection-timeout%20%5B30%3C%2FSTRONG%3E%5D%3B%3C%2FP%3E%0A%3CP%3EThe%20SQL%20query%20timeout%20is%20same%20as%20the%20connection%20timeout.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFollowing%20table%20list%20the%20some%20of%20the%20critical%20parameters%20and%20brief%20description%20and%20how%20to%20use%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3E%3CSTRONG%3ENAME%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3E%3CSTRONG%3EDescription%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3E%3CSTRONG%3EHow%20to%20use%20it%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Ecluster-recheck-interval%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EPolling%20interval%20for%20time-based%20changes%20to%20options%2C%20resource%20parameters%20and%20constraints.%3C%2FP%3E%0A%3CP%3EA%20Pacemaker%20cluster%20is%20an%20event-driven%20system.%20As%20such%2C%20it%20won%E2%80%99t%20recalculate%20the%20best%20place%20for%20resources%20to%20run%20unless%20something%20(like%20a%20resource%20failure%20or%20configuration%20change)%20happens.%26nbsp%3BIf%20time-based%20rules%20are%20needed%2C%20the%26nbsp%3B%3CSTRONG%3Ecluster-recheck-interval%3C%2FSTRONG%3E%26nbsp%3Bcluster%20option%20(which%20defaults%20to%2015%20minutes)%20is%20essential.This%20tells%20the%20cluster%20to%20periodically%20recalculate%20the%20ideal%20state%20of%20the%20cluster.%20For%20example%2C%20starting%20a%20resource%20between%20a%20certain%20period%20of%20time.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%26nbsp%3B%20pcs%20property%20set%20cluster-recheck-interval%3D2min%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Ecorosync%20totem%20token%20timeout%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EThis%20is%20%26nbsp%3Bto%20make%20sure%20corosync%20is%20resilent%20against%20intermittent%20network%20glitches%3B%20the%20default%20is%201000%20ms%2C%20or%201%20second%20for%20a%202%20node%20cluster%2C%20increasing%20by%20650ms%20for%20each%20additional%20member%3B%20To%20use%20a%20value%20other%20than%20the%20default%2C%20add%20or%20edit%20the%20token%20line%20in%20%2Fetc%2Fcorosync%2Fcorosync.conf%20e.g.%20totem%20%7B%20token%3A%205000%7D%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Ecat%20%2Fetc%2Fcorosync%2Fcorosync.conf%3C%2FP%3E%0A%3CP%3Etotem%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20version%3A%202%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20cluster_name%3A%20pcmk%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20secauth%3A%20off%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20transport%3A%20udpu%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSTRONG%3Etoken%3A%2010000%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Estart-failure-is-fatal%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EIndicates%20whether%20a%20failure%20to%20start%20a%20resource%20on%20a%20particular%20node%20prevents%20further%20start%20attempts%20on%20that%20node.%20When%20set%20to%26nbsp%3Bfalse%2C%20the%20cluster%20will%20decide%20whether%20to%20try%20starting%20on%20the%20same%20node%20again%20based%20on%20the%20resource's%20current%20failure%20count%20and%20migration%20threshold.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%20pcs%20property%20set%26nbsp%3B%20start-failure-is-fatal%3Dtrue%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Efailure-timeout%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3Ecluster-recheck-interval%26nbsp%3Bindicates%20the%20polling%20interval%20at%20which%20the%20cluster%20checks%20for%20changes%20in%20the%20resource%20parameters%2C%20constraints%20or%20other%20cluster%20options.%20If%20a%20replica%20goes%20down%2C%20the%20cluster%20tries%20to%20restart%20the%20replica%20at%20an%20interval%20that%20is%20bound%20by%20the%26nbsp%3Bfailure-timeout%26nbsp%3Bvalue%20and%20the%26nbsp%3Bcluster-recheck-interval%26nbsp%3Bvalue.%20For%20example%2C%20if%26nbsp%3Bfailure-timeout%26nbsp%3Bis%20set%20to%2060%20seconds%20and%26nbsp%3Bcluster-recheck-interval%26nbsp%3Bis%20set%20to%20120%20seconds%2C%20the%20restart%20is%20tried%20at%20an%20interval%20that%20is%20greater%20than%2060%20seconds%20but%20less%20than%20120%20seconds.%20We%20recommend%20that%20you%20set%20failure-timeout%20to%2060s%20and%20cluster-recheck-interval%20to%20a%20value%20that%20is%20greater%20than%2060%20seconds.%20Setting%20cluster-recheck-interval%20to%20a%20small%20value%20is%20not%20recommended.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%20pcs%20resource%20update%20resource_name%20meta%20failure-timeout%3D60s%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Emonitor_policy%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EMonitoring%20policy%20options%20are%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1)%20SERVER_UNRESPONSIVE_OR_DOWN%3A%20Fail%20if%20the%20SQL%20Server%20instance%20is%20unresponsive%20(unable%20to%20establish%20a%20connection)%20or%20down%20(the%20process%20is%20not%20running)%3CBR%20%2F%3E2)%20SERVER_CRITICAL_ERROR%3A%20Fail%20if%20sp_server_diagnostics%20detects%20a%20critical%20system%20error%3CBR%20%2F%3E3)%20SERVER_MODERATE_ERROR%3A%20Fail%20if%20sp_server_diagnostics%20detects%20a%20critical%20system%20or%20resource%20error%3CBR%20%2F%3E5)%20SERVER_ANY_QUALIFIED_ERROR%3A%20Fail%20if%20sp_server_diagnostics%20detects%20any%20qualified%20error%26nbsp%3B%3CBR%20%2F%3Epcs%20resource%20update%20C2PODDAG%20monitor_policy%3D1%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%20pcs%20resource%26nbsp%3B%20update%20resource_name%26nbsp%3B%20monitor_policy%3D2%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20shows%20up%20as%20health-threshold%20%5B2%5D%3B%20in%20corosync%20logs%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3EConnection_timeout%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EThis%20is%20the%20timeout%20of%20the%20connection%20request%20to%20the%20sql%20server%20by%20the%20pacemaker.%20The%20timeout%20can%20be%20set%20using%20the%20pcs%20command.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%20pcs%20resource%20update%20resource_name%20connection_timeout%3D90%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Edemote%20action%20timeout%20(s)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EDemote%20action%20demotes%20relevant%20resources%20that%20are%20running%20in%20master%20mode%20to%20slave%20mode.%20The%20timeout%20can%20be%20set%20using%20the%20pcs%20command.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%20pcs%20resource%20update%20resource_name%20op%20demote%26nbsp%3B%20timeout%3D20%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Epromote%20action%20timeout%20(s)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EPromote%20action%20promotes%20relevant%20resource%20to%20the%20master%20mode.%20The%20timeout%20can%20be%20set%20using%20the%20pcs%20command.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%20pcs%20resource%20update%20resource_name%26nbsp%3B%20op%20promote%20timeout%3D60%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Estart%20action%20timeout%20(s)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EStart%20action%20starts%20the%20resource.%20The%20timeout%20can%20be%20set%20using%20the%20pcs%20command.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%20pcs%20resource%20update%20resource_name%26nbsp%3B%20op%20start%20timeout%3D60%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Estop%20action%20timeout%20(s)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EStop%20action%20stops%20the%20resource.%20The%20timeout%20can%20be%20set%20using%20the%20pcs%20command.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%20pcs%20resource%20update%20resource_name%26nbsp%3B%20op%20stop%20timeout%3D60%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22198%22%3E%3CP%3Emonitor%20action%20timeout%20(s)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22678%22%3E%3CP%3EMonitor%20action%20checks%20the%20resource%E2%80%99s%20state.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22384%22%3E%3CP%3Esudo%20pcs%20resource%20update%20resource_name%20op%20monitor%20interval%3D11%26nbsp%3B%20role%3DMaster%20timeout%3D11%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMonitor%20timeout%20should%20be%20greater%20than%20the%26nbsp%3B%20connection%20timeout.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1600013%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20blog%20contains%20different%20commands%20we%20can%20use%20to%20manage%20SQL%20Server%20availability%20group%20on%20Linux%20Pacemaker%20cluster%3C%2FP%3E%3C%2FLINGO-TEASER%3E

 

Thanks to Jayantha Das,  who shared some of the common command we use in SQL Server on Linux Pacemaker Maker cluster. This blog contains the pacemaker settings that we can modify. Unless explicitly required it is recommended that we don’t modify the values as it can cause problem in the functionality of availability groups.

 

We can run “sudo pcs config” to list critical cluster configuration settings

 

Master: ag_cluster-master

  Meta Attrs: failure-timeout=30s notify=true

  Resource: ag_cluster (class=ocf provider=mssql type=ag)

   Attributes: ag_name=ag1

   Operations: start interval=0s timeout=60 (ag_cluster-start-interval-0s)

               stop interval=0s timeout=10 (ag_cluster-stop-interval-0s)

               promote interval=0s timeout=60 (ag_cluster-promote-interval-0s)

               demote interval=0s timeout=10 (ag_cluster-demote-interval-0s)

               monitor interval=10 timeout=60 (ag_cluster-monitor-interval-10)

               monitor interval=11 role=Master timeout=60 (ag_cluster-monitor-interval-11)

               monitor interval=12 role=Slave timeout=60 (ag_cluster-monitor-interval-12)

Resource: virtualip (class=ocf provider=heartbeat type=IPaddr2)

  Attributes: ip=xx.xx.xx.xx

  Operations: start interval=0s timeout=20s (virtualip-start-interval-0s)

              stop interval=0s timeout=20s (virtualip-stop-interval-0s)

              monitor interval=10s timeout=20s (virtualip-monitor-interval-10s)

 

 

Interval

Interval for the above operations mean how frequently (in seconds) to perform the operation. A value of 0 means never. A positive value defines a recurring action, which is typically used with monitor.

 

Timeout

Timeout for the above operation means how long to wait before declaring the action has failed

 

Role

Role for the above operations (like the one in the monitor) mean run the operation only on node(s) that the cluster thinks should be in the specified role. This only makes sense for recurring monitor operations. Allowed (case-sensitive) values: Stopped, Started, and in the case of multi-state resources, Slave and Master.

The usual monitor actions are insufficient to monitor a multi-state resource, because pacemaker needs to verify not only that the resource is active, but also that its actual role matches its intended one.

 

For example,

Define two monitoring actions: the usual one will cover the slave role, and an additional one with role="master" will cover the master role. In the case of Availability Groups the master is the primary and Slave indicates the secondary node.

 

<op id="public-ip-slave-check" name="monitor" interval="60"/><op id="public-ip-master-check" name="monitor" interval="61" role="Master"/>

 

It is crucial that every monitor operation has a different interval! Pacemaker currently differentiates between operations only by resource and interval; so if (for example) a master/slave resource had the same monitor interval for both roles, Pacemaker would ignore the role when checking the status — which would cause unexpected return codes, and therefore unnecessary complications.

 

 

Connection timeout can be found in the corosync logs

 

monitor: 2019/09/26 13:48:55 ag-helper invoked with hostname [localhost]; port [1433]; ag-name [ag1]; credentials-file [/var/opt/mssql/secrets/passwd]; application-name [monitor-ag_cluster-monitor]; connection-timeout [30];

The SQL query timeout is same as the connection timeout.

 

Following table list the some of the critical parameters and brief description and how to use it.

 

 

NAME

Description

How to use it

cluster-recheck-interval

Polling interval for time-based changes to options, resource parameters and constraints.

A Pacemaker cluster is an event-driven system. As such, it won’t recalculate the best place for resources to run unless something (like a resource failure or configuration change) happens. If time-based rules are needed, the cluster-recheck-interval cluster option (which defaults to 15 minutes) is essential.This tells the cluster to periodically recalculate the ideal state of the cluster. For example, starting a resource between a certain period of time.

sudo  pcs property set cluster-recheck-interval=2min

corosync totem token timeout

This is  to make sure corosync is resilent against intermittent network glitches; the default is 1000 ms, or 1 second for a 2 node cluster, increasing by 650ms for each additional member; To use a value other than the default, add or edit the token line in /etc/corosync/corosync.conf e.g. totem { token: 5000}

cat /etc/corosync/corosync.conf

totem {

    version: 2

    cluster_name: pcmk

    secauth: off

    transport: udpu

    token: 10000   

}

 

start-failure-is-fatal

Indicates whether a failure to start a resource on a particular node prevents further start attempts on that node. When set to false, the cluster will decide whether to try starting on the same node again based on the resource's current failure count and migration threshold.

sudo pcs property set  start-failure-is-fatal=true

failure-timeout

cluster-recheck-interval indicates the polling interval at which the cluster checks for changes in the resource parameters, constraints or other cluster options. If a replica goes down, the cluster tries to restart the replica at an interval that is bound by the failure-timeout value and the cluster-recheck-interval value. For example, if failure-timeout is set to 60 seconds and cluster-recheck-interval is set to 120 seconds, the restart is tried at an interval that is greater than 60 seconds but less than 120 seconds. We recommend that you set failure-timeout to 60s and cluster-recheck-interval to a value that is greater than 60 seconds. Setting cluster-recheck-interval to a small value is not recommended.

sudo pcs resource update resource_name meta failure-timeout=60s

monitor_policy

Monitoring policy options are:

 

1) SERVER_UNRESPONSIVE_OR_DOWN: Fail if the SQL Server instance is unresponsive (unable to establish a connection) or down (the process is not running)
2) SERVER_CRITICAL_ERROR: Fail if sp_server_diagnostics detects a critical system error
3) SERVER_MODERATE_ERROR: Fail if sp_server_diagnostics detects a critical system or resource error
5) SERVER_ANY_QUALIFIED_ERROR: Fail if sp_server_diagnostics detects any qualified error 
pcs resource update C2PODDAG monitor_policy=1

 

sudo pcs resource  update resource_name  monitor_policy=2

 

This shows up as health-threshold [2]; in corosync logs

Connection_timeout

This is the timeout of the connection request to the sql server by the pacemaker. The timeout can be set using the pcs command.

sudo pcs resource update resource_name connection_timeout=90

 

demote action timeout (s)

Demote action demotes relevant resources that are running in master mode to slave mode. The timeout can be set using the pcs command.

sudo pcs resource update resource_name op demote  timeout=20

 

promote action timeout (s)

Promote action promotes relevant resource to the master mode. The timeout can be set using the pcs command.

sudo pcs resource update resource_name  op promote timeout=60

start action timeout (s)

Start action starts the resource. The timeout can be set using the pcs command.

sudo pcs resource update resource_name  op start timeout=60

stop action timeout (s)

Stop action stops the resource. The timeout can be set using the pcs command.

sudo pcs resource update resource_name  op stop timeout=60

monitor action timeout (s)

Monitor action checks the resource’s state.

sudo pcs resource update resource_name op monitor interval=11  role=Master timeout=11

 

Monitor timeout should be greater than the  connection timeout.