indexer clustering basic, internals - splunkconf · [email protected] sr. software engineer splunk...

34
Copyright © 2016 Splunk Inc. Dhruva Kumar Bhagi [email protected] Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging

Upload: others

Post on 19-Apr-2020

19 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Copyright©2016SplunkInc.

[email protected].

Indexerclusteringbasics,internals&generaldebugging

Page 2: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Disclaimer

2

Duringthecourseofthispresentation,wemaymakeforwardlookingstatementsregardingfutureeventsortheexpectedperformanceofthecompany.Wecautionyouthatsuchstatementsreflectourcurrentexpectationsandestimatesbasedonfactorscurrentlyknowntousandthatactualeventsorresultscoulddiffermaterially.Forimportantfactorsthatmaycauseactualresultstodifferfromthose

containedinourforward-lookingstatements,pleasereviewourfilingswiththeSEC.Theforward-lookingstatementsmadeinthethispresentationarebeingmadeasofthetimeanddateofitslivepresentation.Ifreviewedafteritslivepresentation,thispresentationmaynotcontaincurrentoraccurateinformation.Wedonotassumeanyobligationtoupdateanyforwardlookingstatementswemaymake.Inaddition,anyinformationaboutourroadmapoutlinesourgeneralproductdirectionandissubjecttochangeatanytimewithoutnotice.Itisforinformationalpurposesonlyandshallnot,beincorporatedintoanycontractorothercommitment.Splunkundertakesnoobligationeithertodevelopthefeaturesor

functionalitydescribedortoincludeanysuchfeatureorfunctionalityinafuturerelease.

Page 3: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Indexerclustertopology

3

MasterSearchhead

FORWARDERS

Indexer Indexer IndexerForReplication

Forgenerationinfo

ForSearch

Forwardingdatatoindexers

Master-slavecommunication

Forreplication

Searchhead-idx

Page 4: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Whyindexerclustering

• Dataavailability:Yoursystemcantoleratedownedindexerswithoutloosingdataoraccesstothedata

• Disasterrecovery:Withmultisiteclustering,yoursystemcantoleratethefailureofanentiredatacenter

• Searchaffinity:Withmultisiteclustering,Searchheadscanaccessthedatathroughtheirlocalsitestherebyimprovingsearchperformancebyloweringnetworklatency

• Otheradvantages:uniformconfigurationacrossindexers,easeofmanagement&monitoringoftheindexers

4

Page 5: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Partsofthecluster• ClusterMaster• Managestheclusteractivities• Maintainsanin-memorystateofallthepeers&theircorrespondingbuckets,configs• Orchestratesremedialactivitiesduringpeerfailures• Tellssearchheadswheretosearch

• ClusterPeer(Indexer)• Receiveandindexincomingdata(typicallyfromforwarders)• Replicatedatatootherpeersfordataavailability• Respondtotheincomingsearchesbyprovidingsearchresults• Updateclustermasteronanystatechange(peer,buckets,configsetc.)

• Searchhead• Runs&coordinatessearches&aggregatesthesearchresultscomingfromindexers• Periodicallyinteractswithclustermasterforgenerationupdates

5

Page 6: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Communicationamongstmembers

6

Clustermaster&peerscommunicateoverRESTendpoints.FewExamples:• Peers->Master:

• /services/cluster/master/peers• Addpeertocluster• Heartbeattomaster

• /services/cluster/master/buckets• Notifymasteronbucketcreation&removal• Notifymasteronbucketstatechanges

• Master->Peers:• /services/cluster/slave/buckets

• Changeprimaries• Becomesearchable/unsearchable

• Searchhead->Master:• cluster/master/generation- Togetthelatestgenerationinformation

Page 7: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

event=addPeer

• Peerjoinstheclusterbyexecutinganeventcalled‘addPeer’whichisaRESTcalltoCM(services/cluster/master/peers)

• Thishappensonpeerstartup.• OnAddPeerrequest,peerreportsitsentirestatetoclustermaster.• reportsallitsbucketsandcorrespondingstates• active_bundle_id,latest_bundle_id,mgmt_port,GUID,

replication_port• add_type=Initial-Add|ReAdd

• Masterstoresentirepeer’sstateinitsmemory

7

Page 8: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

event=addPeer

• Slavelogs:08-02-201615:54:06.098-0700INFOCMSlave- event=addPeerstatus=successrequest:AddPeerRequest:{}

• UponsuccessfuladdPeer,masteralsologstoitssplunkd.log• 08-02-201615:54:06.094-0700INFOCMMaster- event=addPeer

guid=F1B6E8F0-002A-4947-83CA-0A5BC56E0A53peer_name=slave1AddPeerRequest:{}bucket_count=4

• OnaddPeersuccess,mastercommitsanewgeneration.• CMMaster- committinggen=1numpeers=1requesterReason=addPeerSuccess

guid=F1B6E8F0-002A-4947-83CA-0A5BC56E0A53lastCompleteGenId=0• Whenenoughreplication_factor#ofpeersjointhecluster,clustertransitionsintoindexingreadystate.

8

Page 9: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Heartbeats

Heartbeatingisawayclustermaster&peertelleachotherthattheyareupandrunningHeartbeathappensoverRESTendpoint(cluster/master/peers)Oncepeerregisterstomaster,itsendsoutheartbeatrequesttomasteronceineveryheartbeat_periodseconds(defaultsto1)MasterrespondsbacktotheheartbeatrequestindicatingitsupMasterandpeerexchangesomebasicinformation(likebundleId’s,peerstatesetc.)overtheheartbeats.

9

Page 10: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

HeartbeatsMorethe#ofpeers,moretheheartbeatrequestsmasterreceivesandrespondtoForrelativelylargeclusters(with>50peersor200k+buckets),itsrecommendedtoadjustheartbeat_period valueto5-30.Mastermarksapeeras“Down”ifithasn’treceivedheartbeatforheartbeat_timeout period(defaultsto60seconds)Forrelativelylargeclusters,itsrecommendedtoadjustthisvalueto20x-60xofheartbeat_periodFYI:Itsrecommendedtoalsoadjustrestart_timeout asthepeerload(likebucket/summary/jobcount)goesup

10

Page 11: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Copyright©2016SplunkInc.

````Configmanagementinthecluster

Page 12: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Bundle isbasicallyasetofupdatedconfigurationfiles(mostlyindexes.conf,props.conf,transforms.confetc)spreadoverdifferentappsdistributedtoclusterpeersfromclustermasterItsjustthecontentunder$SPLUNK_HOME/etc/master_appsInordertopushanewbundle,updateyourmaster_appscontent&run ‘splunkapplycluster-bundle[--skip-validation]’

Clusterbundles

Page 13: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Bundlepushisamultistepprocess• Creation• Happensatclustermaster• Involvescreatingthebundletarball&calculatingthechecksum• Masterdoesminimalconfigvalidationwhilecreatingthebundle• Masterupdatesitslatest_bundle_id tothenewbundlechecksum

• Validation• Happensattheclusterpeers• Peersdetectnewlatest_bundle_id frommaster&performsvalidation• Validationinvolvesdownloadingthebundle&actuallyvalidatingtheconfigs• Peerreportstheoutcomeofthevalidationtoclustermaster• Masterrevertsitslatest_bundle_id tooldbundleifanypeerreportserror

Clusterbundles

Page 14: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

• Reload(or)Restart• Dependingonthecontentsofthebundle,clusterpeersdetermineiftheycanacceptthenewbundlewithoutarestart(byjustreloading)• Peerreportsthatbundleneedsrestart,CMthenissuesrolling-restartofclusterpeersforthenewbundletotakeintoeffect.

FYI:Itsnotrecommendedtochangeclusterpeerconfigurations(likeindexes,props,transformsetc.)locallyatthepeers.Alltheconfigsshouldcomefromclustermaster.Thisguaranteesuniformityoftheconfigurationamongclustermembers.

Clusterbundles

Page 15: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Copyright©2016SplunkInc.

```` BUCKETS

Page 16: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Buckets arecreatedontheindexer(clusterpeer).Flowofbucketcreation:• Indexerreceivesraw-dataandtransformsthemintoevents• Groupstheeventsintoabucket&generatesindexforeachkeyword• Groupsbucketsintoalogical/physicalpartitioncalledindex• Typicaldataflowhierarchy:

16

Rawdata Events Slice Bucket

Index

brokeninto aregroupedinto arewrittento

aregroupedas

B1

B2

Bn

Buckets

Disk

Buckets

Page 17: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

BucketisusuallyaunitofdatatheclusterisawareofFordataavailability,eachindexerreplicatesitsbucketsReplicationisoftwotypes:– Streamingreplication(forhotbuckets)– Non-streamingreplication(forwarm|coldbuckets)Bucketscanbesearchable orunsearchableAmongmultiplesearchablecopies,masterpicksonecopyas”primary”Peersonlyservedatafromprimary bucketstothesearchClusterpeernotifiesclustermasteruponeverystatechangeofitsbucket(s)sothatmasterstaysuptodate

17

Bucket

Rawdata

Searchfiles

Buckets

Page 18: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

• Morebucketsmeansmorework• Sincebucketistheunitofthedatathatclusterhandles,Mostofthework/communication

intheclusterisrelatedtobuckets• Someexamplesofbucketrelatedwork:• Bucketcreation• Bucketstatechanges• Hot->warm,Warm->cold,Cold->frozen• Searchable->unsearchable,Unsearchable->searchable• Changingprimarymask(needsgenerationcommit)

• Buckettruncation• Bucketdeletion• Handlingreplications• Handlingsuccess|failures|errorsofvariousbuckettransitions&transactions

18

Buckets

Page 19: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Reduceddiskspaceforagedbuckets

Searchable bucketsoccupymorediskspaceduethesubstantialstoragerequirementsoftsidx/index filesInfrequentlysearchedold/agedsearchablebucketssizecanbegreatlyreducedwithtsidxreductionatthecostofsignificantsearchperformanceReducedtsidxfilesareone-thirdtotwo-thirdsmallerthantheoriginalonesEachindexerreducesitssearchablecopiesonitsownBydefaulttsidxreductionisdisabled(enableTsidxReduction=false)NOTE:tstats&typeaheadcommandswon’tworkonreducedbuckets

19

Page 20: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Copyright©2016SplunkInc.

````Masterservice&fixups

Page 21: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

• Clustermasterexecutesitsservice() callonceineveryfewseconds.• Masterschedulesallitspendingworkinthisservicecall.• Workinvolves:• Respondingtonodefailures(or)statetransitions• Runningfixup jobs(tomoveprimaries&meetfactors)

• Morethe#ofpeers&#ofbuckets,moretheworktodointheservicecall• Spikeintheservice()durationduringnodefailureifpeerhaslotofbuckets• Theintervalbetweentwosuccessiveservicecallscanbeconfiguredusingconfig“service_interval”

• Thenewdefaultvalueofservice_interval =0,whichmeansautomode

21

CMservice

Page 22: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

• Inautomode,nextservice callisscheduledbasedondurationofthecurrentservicecall(intervaliscappedbymax_auto_service_interval)

• Alternatively,youcanmanuallytuneservice_interval astheclustergrowsinsize(alongwithheartbeat&restarttimeouts)

22

CMservice

Page 23: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Fixups• CMiteratesthroughlistofbucketsinitsfixup listattemptingtofixthem• Itinvolvesre-assigningprimaries,creatingreplicationcopies,makingbucketssearchable,rolling

buckets,freezingbucketsetc.• Assumingsf>1,primaryfixupsareexpectedtofinishfasterwithoutdelay• cluster/master/fixup endpointdisplaysbucketsinthefixup listby’level’(level=replication_factor,

search_factoretc.)• Itsexpectedforthemastertotakesometimetofixrf/sfiftherearelotofbucketsinfixup&thiscan

becarefullycontrolledbytuningmax_peer_rep_load(5) &max_peer_build_load(2)• Fixupsupportsa’filter’optionwhichallowsfilteringbucketsbasedonsomecondition

• Forexample/services/cluster/master/fixup?level=replication_factor&filter=minutes_in_fixup>100 listsbucketsstuckinfixupformorethan100minutes– Somethingwrongwiththisbucket?

FYI:CMdoesnotperformrep&searchfixupsinmaintenancemode,thiscanbehelpfultoavoidunnecessaryreplicationsduringplanneddowntimeofpeer(s)

23

Page 24: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

UIactionsonbucketsstuckinfixup

24

Note:Becarefulwith’Deletecopy’especiallyifthereisonlyonecopy

Page 25: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Copyright©2016SplunkInc.

````Clusterconfig/info

Page 26: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

• services/cluster/config onmaster&peerslistsclusteringconfiguration

26

Page 27: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

27

services/cluster/{master|slave}/infoDisplaysnodeconfiguration

Page 28: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Copyright©2016SplunkInc.

````Debugging&logs

Page 29: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Index=_internal

• _internal indexisthesourceforalltheactivityofsplunkd• Fewlogfilestolookat(or)correlate• source=*splunkd.log* :togetanoverviewofwhatsplunkdisdoing• source=*splunkd_access.log*:toseeallincomingRESTcalls&responsecodes• Source=*metrics.log*:toseemetricsabouthowsplunkisperforming(differentthroughputs,queuesizes,responsetimes,jobscountetc.)

29

Page 30: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Clusteringrelatedlogs• LookforWARN/ERROR’s infollowingclusteringcomponentstogetanoverviewof

whatwentwrongwhenthingsgounexpected• Fewcomponentsatclustermaster:• CMMaster– handlesgeneralclustermasterfunctionality• CMPeer– handlesaparticularslave/peerspecificwork• CMBundleMgr– handlesclusterbundlerelatedfunctionality• CMRepJob– handlesanyreplicationrelatedjobs/functionality• CMBucket– representsabucket

• FewComponentsatclusterpeer:• CMSlave– handlesallthegeneralslave/peerfunctionality• CMBundleMgr– handlesslavebundlerelatedfunctionality• BucketReplicator(sendside),S2SFileReceiver(receiveside)– Replicatingbuckets

30

Page 31: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Logsrelatedtobuckets

• Searchbybid(index~0~1108~10BBFD2B-BDF8-411B-B574-FEAF37D6F486)helpsunderstand/tracemoreaboutwhatwentwrongwithaparticularbucket

• Mostoftheinternallogsusuallygetsrotatedfastintheproductionclustersso‘splunkdiag’mightnothaveany/alltheinformationrelatedtoaparticularbadbucket

• Exportingsearchresultsonabucketid(likeindex=_internal{source=*splunkd.log*}BUCKET_ID)helpsusunderstandmoreaboutwhatwentwrongwithaparticularbucket

31

Page 32: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

Copyright©2016SplunkInc.

````Recentenhancements

Page 33: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

• Scalingmaster&peerstobeabletohandlelargerbucketvolumes• Batchingjobs,reducingrestarts,optimize/eliminateexpensiveoperations,reducingdiskscans

• Betterfailurerecoverywhenthingsgowrong• Autorecoverfromstateinconsistenciesb/wmaster&peers,Provideoptionstotakeactionsonanyanomalousbucketstates

• DataRebalancingforbalanceddata&searchloaddistribution• Summaryreplicationtoreduceio&cpuspikesduetosummary

regenerationonnodefailures• Tsidxreduction forreducestoragecosts

33

Recentenhancements

Page 34: Indexer clustering basic, internals - SplunkConf · dbhagi@splunk.com Sr. software engineer Splunk Inc. Indexer clustering basics, internals & general debugging. Disclaimer 2 During

THANKYOU