Upload
hoangkiet
View
249
Download
1
Embed Size (px)
Citation preview
1©Cloudera,Inc.Allrightsreserved.
IntroducingApacheKuduandRecordService(incubating)GuidoOswald|SalesEngineer,SwitzerlandApril2016,SwissBigDataUserGroupMeetup18
@GuidoOswald
2©Cloudera,Inc.Allrightsreserved.
CurrentstoragelandscapeinHadoopHDFSexcelsat:• Efficientlyscanninglargeamounts
ofdata• Accumulatingdatawithhigh
throughputHBaseexcelsat:• Efficientlyfindingandwriting
individualrows• Makingdatamutable
Gapsexistwhenthesepropertiesareneededsimultaneously
3©Cloudera,Inc.Allrightsreserved.
Managingthegap(today)
CodeComplexity•ManageflowandsyncofdatabetweenHDFSandHbase
MonitoringandSecurity•Managingconsistentbackups,securitypolicies,monitoringandmoreishard
Performance• SignificantlagbetweenarrivalofHbase data“staging”andtimewhendataisavailableforanalytics.
4©Cloudera,Inc.Allrightsreserved.
Changinghardwarelandscape
• Spinningdisk->solidstatestorage• NANDflash:Upto450kread250kwriteIOPS,about2GB/secreadand1.5GB/secwritethroughput, atapriceoflessthan$3/GBanddropping• 3DXPoint memory(1000xfasterthanNAND,cheaperthanRAM)
• RAMischeaperandmoreabundant:• 64->128->256GBoverlastfewyears
• Takeaway1: The nextbottleneckisCPU,andcurrentstorageheavyapplicationsweren’tdesignedwithCPUefficiencyinmind• Takeaway2: Columnstoresarefeasibleforrandomaccess
5©Cloudera,Inc.Allrightsreserved.
ApacheKudu(Incubating)StorageforFastAnalyticsonFastData
• NewupdatingcolumnstoreforHadoop• Simplifiesthearchitectureforbuildinganalyticapplicationsonchangingdata
• Designedforfastanalyticperformance• NativelyintegratedwithHadoop
• DonatedasincubatingprojectatApacheSoftwareFoundation(November17,2015)
• Betanowavailable
STRUCTUREDSqoop
UNSTRUCTUREDKafka,Flume
PROCESS,ANALYZE,SERVE
UNIFIEDSERVICES
RESOURCEMANAGEMENTYARN
SECURITYSentry,RecordService
FILESYSTEMHDFS
RELATIONALKudu
NoSQLHBase
STORE
INTEGRATE
BATCHSpark,Hive,PigMapReduce
STREAMSpark
SQLImpala
SEARCHSolr
SDKKite
6©Cloudera,Inc.Allrightsreserved.
• Highthroughputforbigscans(columnarstorageandreplication)Goal:Within2xofParquet
• Low-latency forshortaccesses(primarykeyindexesandquorumdesign)Goal: 1msread/writeonSSD
• Database-likesemantics(initiallysingle-rowACID)
• Relational datamodel• SQLquery• “NoSQL”stylescan/insert/update(Javaclient)
Kududesigngoals
7©Cloudera,Inc.Allrightsreserved.
Kudubasicdesign• Apache-licensedopensourcesoftware
• Structureddatamodel
• Basicconstruct:tables• Tablesbrokendownintotablets(roughlyequivalenttopartitions)
• Architecturesupportsgeographicallydisparate,active/activesystems• Nottheinitialdesigngoal
8©Cloudera,Inc.Allrightsreserved.
WhatKuduisnot• Not aSQLinterface• Justthestoragelayer• “BYOSQL”– Bring-your-ownSQL
• Notafilesystem• Datamust havetabularstructure
• Not anapplicationthatrunsonHDFS• Analternative,native Hadoop storageengine
• Not areplacementforHDFSorHBase• Selecttherightstoragefortherightusecase• Clouderawillcontinuetosupportandinvestinallthree
9©Cloudera,Inc.Allrightsreserved.
Kududatamodel
• TableshaveaRDBMS-likeschema• Finitenumberofcolumns(unlikeHBase/Cassandra)• Types:BOOL, INT8/16/32/64, FLOAT, DOUBLE, STRING, BINARY, TIMESTAMP• Somesubsetofcolumnsmakeupaprimarykey
• Fastrandomreads/writesbyprimarykey• Nosecondaryindexes(yet)
• Columnar layoutondisk- Parquet• Lazymaterialization• Encodingandcompressionoptions
9
10©Cloudera,Inc.Allrightsreserved.
Tablepartitioning
• Hashbucketing• Distributerecordsbyhashofpartitioncolumn(s)• NbucketsleadstoNtablets
• Rangepartitioning• Distributerecordsbyrangesofthepartitioncolumn(s)• NsplitkeysleadstoNtablets
• Canbeamixfordifferentcolumnsoftheprimarykey
11©Cloudera,Inc.Allrightsreserved.
Consistencymodel
• ConsistencyandreplicationenforcedbyRaftconsensus(similartoPaxos)• Replicationbyoperationnotdata
• Single-rowtransactionsnow•Multi-rowtransactionslater
• Geo-distributedreplicaswillbepossibleunderstricttimesynchronization
• TechniquesdrawnfromGoogleSpannerandothers
12©Cloudera,Inc.Allrightsreserved.
Kuduinterfaces
• NoSQL-styleAPIs• Insert(),Update(),Delete(),Scan()• JavaandC++now• Pythonsoon
• Integrations withMapReduce,Spark,andImpala
• NodirectaccesstounderlyingKudutabletfiles
• Beta does not haveauthentication,authorization,encryption
13©Cloudera,Inc.Allrightsreserved.
Impalaintegration
• OpensupKudutoJDBC/ODBCclients
• IntuitivewaytogetdataintoKudu• INSERT INTO kudu_table SELECT * FROM src_table;
• Additionalcommands• UPDATE• DELETE• Efficient INSERT VALUES
• RunsontheKuduC++client
14©Cloudera,Inc.Allrightsreserved.
Performancecharacteristics
VeryCPUefficient•WritteninmodernC++,usesspecializedCPUinstructions,JITcompilationwithLLVM
Latencydependentonstoragehardwarecapabilities• Expectsub-millisecondresponseonSSDsandupcomingtechnologies
Nogarbagecollectionallowsverylargememoryfootprintwithnopauses
Bloomfiltersreducetheneedformanydiskaccesses
15©Cloudera,Inc.Allrightsreserved.
OperatingKudu
• EasiestthroughClouderaManagerintegration• Separateparcelfornow
• Kuduisalwayscompacting• Nominorvs.majorcompaction• Nocompactionlatencyspikes
•WebUIisfullofmetricsandlogs
16©Cloudera,Inc.Allrightsreserved.
Clusterlayout
• Oneormultiplemasters• Onlyoneincurrentbeta• LowCPUandmemoryimpact
• Onetabletserverperworkernode• CansharediskswithHDFS• OneSSDperworkernodejustforKuduWALcanspeedupwrites
• NodependenciesonotherHadoopecosystemcomponents• ButinterfacingcomponentslikeImpalaorSparkdo
17©Cloudera,Inc.Allrightsreserved.
Real-timeanalyticsinHadooptodayMerginginnewdata=storagecomplexity
Downsides:
● Multiple storagelayers
● Latestdataishidden
● Filesaremessy
● ComplextodoupdateswithoutbreakingrunningqueriesNewPartition
MostRecentPartition
HistoricData
HBase
ParquetFile
Haveweaccumulatedenoughdata?
ReorganizeHBasefileintoParquet
• Waitforrunning operationstocomplete• DefinenewImpalapartitionreferencingthenewlywrittenParquetfile
IncomingData(MessagingSystem)
ReportingRequest
HDFS+Impala
18©Cloudera,Inc.Allrightsreserved.
Real-timeanalyticsinHadoopwithKudu
Improvements:
● Onesystemtooperate
● Noschedulesorbackgroundprocesses
● Handlelatearrivalsordatacorrectionswithease
● Newdataavailableimmediatelyforanalyticsoroperations
HistoricalandReal-timeData
IncomingData(MessagingSystem)
ReportingRequest
Kudu+Impala
19©Cloudera,Inc.Allrightsreserved.
Kudufordatawarehousing
• Nearrealtimedatavisibility• BItoolscandisplayeventsthathappenedsecondsearlier
• Excellentforstarschemas• Fastscansofdeepfacttables• Efficientwidefacttables• Simplifiedupdatesofslowlychangingdimensions
20©Cloudera,Inc.Allrightsreserved.
NearrealtimedatawarehousingonKudu
Files
RDBMS
Streams
KAFKA
KUDU
IMPALA
HUE
BI tools
User
FLUME
SPARKSTREAMING
Simple
Complex
21©Cloudera,Inc.Allrightsreserved.
Resources
Jointhecommunityhttp://[email protected]
Downloadthebetacloudera.com/downloads
Readthewhitepapergetkudu.io/kudu.pdf
22©Cloudera,Inc.Allrightsreserved.
CreatingaKudutable
KuduStoragehandler
TablenameinImpaladoesNOTmatchtablenameinKudu.Kuduisitsownstoragelayer.
KuduMasterhostnameandport
Aprimarykeyismandatory
23©Cloudera,Inc.Allrightsreserved.
Spark(Scala)code DataFrame Row
KuduMasterhostnameandport
Kudu tablename
Createaclient,sessionandtableobject
Extractvaluesfromtherow, strongtypes
Createaninsertobjectandrow
Setthevaluesbytype,columnnameandcolumnvalule
Performtheactualinsert
Cleanup
24©Cloudera,Inc.Allrightsreserved.
Kuducodeexamplesanddocs
https://github.com/cloudera/kudu-examples
http://www.cloudera.com/documentation/betas/kudu/0-7-0/topics/kudu_development.html
http://getkudu.io/docs/developing.html
25©Cloudera,Inc.Allrightsreserved.
RecordService
26©Cloudera,Inc.Allrightsreserved.
PermissionEnforcementtoday withSentryHive
Server2
Sentry
Enforcem
ent
Impala
HDFS:MR,Pig,Spark,...
Search(Solr)
SentryPermissions
rules
Rule:“Allowfraudanalystsreadaccesstothetransactiontable”
Adminsspecify permissions
Sentry
Enforcem
ent
Sentry
Enforcem
ent
Sentry
Enforcem
ent
Apps:Datameer,Platfora,Zoomdata,
etc
SentryService
Coarsegrained(table)
27©Cloudera,Inc.Allrightsreserved.
TheNeedforFine-GrainedAccessControlAcrossallaccesspaths
Columns:Sensitivecolumnvisibilityvaries;Example:creditcardnumbers• Managers:1234567812345678• CallCentre:XXXXXXXXXXXX5678• Analysts:XXXXXXXXXXXXXXXX• Others:Doesnotseecreditcardcolumn
Rows:Differentgroupsofusersneedaccesstodifferentrecords• Europeanprivacylaws• Governmentsecurityclearance• Financialinformationrestrictions
28©Cloudera,Inc.Allrightsreserved.
Theworkaround
Date/time Accnt# NationalIdentifier
Asset Trade Broker
09:33:1116-Feb-2015
0234837823 238-23-9876
ABC Sell group1
11:33:0116-Feb-2015
3947848494 329-44-9847
TBT Buy group2
14:12:3416-Feb-2015
4848367383 123-56-2345
DEF Sell group3
09:22:0316-Feb-2015
3485739384 585-11-2345
INTC Buy group1
11:55:3316-Feb-2015
3847598390 234-11-8765
F Buy group1
10:22:5516-Feb-2015
8765432176 344-22-9876
UA Buy group3
13:45:2416-Feb-2015
3456789012 412-22-8765
XYZ Sell group2
09:03:4416-Feb-2015
4857389329 123-44-5678
TMV Buy group1
15:55:5516-Feb-2015
4756983234 234-76-9274
MA Buy group3
Date/time Accnt # NationalIdentifier
Asset Trade Broker
14:12:3416-Feb-2015
4848367383 123-56-2345
DEF Sell group3
10:22:5516-Feb-2015
8765432176 344-22-9876
UA Buy group3
15:55:5516-Feb-2015
4756983234 234-76-9274
MA Buy group3
Date/time Accnt # NationalIdentifier
Asset Trade Broker
11:33:0116-Feb-2015
3947848494 329-44-9847
TBT Buy group2
13:45:2416-Feb-2015
3456789012 412-22-8765
XYZ Sell group2
Date/time Accnt # NationalIdentifier
Asset Trade Broker
09:33:1116-Feb-2015
0234837823 238-23-9876
ABC Sell group1
09:22:0316-Feb-2015
3485739384 585-11-2345
INTC Buy group1
11:55:3316-Feb-2015
3847598390 234-11-8765
F Buy group1
09:03:4416-Feb-2015
4857389329 123-44-5678
TMV Buy group1
Splittheoriginal file;UseHDFSpermissions tolimitaccess
WhatifonlysomebrokersineachgroupareallowedtoseefullIDs?
29©Cloudera,Inc.Allrightsreserved.
TheSolution• Applycontrolstothemasterdatafile• Row,column,andsub-column (masking)controls• Ability toenforcetheseacrossaccesspaths
WhatAllGroup1BrokersSee: Date/time Accnt# NationalIdentifier
Asset Trade Broker
09:33:1116-Feb-2015
0234837823 XXX-XX-9876 ABC Sell group1
09:22:0316-Feb-2015
3485739384 XXX-XX-2345 INTC Buy group1
11:55:3316-Feb-2015
3847598390 XXX-XX-8765 F Buy group1
09:03:4416-Feb-2015
4857389329 XXX-XX-5678 TMV Buy group1
30©Cloudera,Inc.Allrightsreserved.
RecordService(Beta)toEnforceColumnandRow-levelRules
Hadoopcomponents:MR,Pig,
Spark,Solr,HiveServer2,Impala...
Applications:Datameer,Platfora,etc
SentryPermissions
rules
Rule:AllowmanagerstoseeNationalIDs.
Permissionsspecifiedbyadministrators(top-levelanddelegated)
HDFS
RecordService
Hbase
SentryService
AWSS3
31©Cloudera,Inc.Allrightsreserved.
BenefitsofRecordServiceSecurity• Fine-graineddatapermissionsandenforcementacrossHadoop• IntegrationwithSentryforpolicystorage andimplementation
Interoperability• Clientsnolongerneedtobeawareofon-diskformat
• Singledataaccesspathmeanssingleplacetoimplementandtestfileformatrelatedchanges• Transparentlyswapcomponentsaboveorbelow(ex.HDFS->S3)
Performance/Efficiency• PerformanceboostedviaImpala’soptimizedscanner,dynamiccodegeneration,parquetimplementation• Useprojectionsoveroriginalsourcedatasetsinsteadofmakingsomanycopies/subsets
32©Cloudera,Inc.Allrightsreserved.
RecordServiceArchitecture
RecordServicePlanner
HDFSNN
SentryService
HiveMetastore
Client
RecordServiceWorker
HDFSDN HBaseRS S3
ClientTask
ClientTask
ClientTask
1
2 3
Request:- Objectstoaccess- UserinfoResponse:- Listofsplits- Delegationtoken
Job launchesasnormal Client tasksreadrecords fromRecordServiceWorker
Notyetsupported
33©Cloudera,Inc.Allrightsreserved.
EnforcingSentryPermissionsforMR/Spark
CreateaviewinHMSwiththenecessarycolumn/rowrestrictions
Createaroleandassigntoagroup
Grantaccessprivilegetothatrole
CREATE ROLE demorole;GRANT ROLE demorole to GROUP demogroup;
CREATE VIEW nation_names AS SELECT n_nationkey, n_name FROM tpch.nation;
GRANT SELECT ON TABLE tpch.nation_names TO ROLE demorole;
34©Cloudera,Inc.Allrightsreserved.
SparkUsageExample:RDD
ImportRecordServicepackage
ReaddataintoavariableusingRecordServiceAPI
Performanaction
scala> val data = sc.recordServiceRecords("select * from tpch.nation_names");
data: org.apache.spark.rdd.RDD[Array[org.apache.hadoop.io.Writable]] = RecordServiceRDD[0] at RDD at RecordServiceRDDBase.scala:57
scala> import com.cloudera.recordservice.spark._;
import com.cloudera.recordservice.spark._
scala> data.count();
res0: Long = 25
35©Cloudera,Inc.Allrightsreserved.
CurrentFeatureAvailabilityCompute:• Support forMR (InputFormat) and Spark (RDDs, SparkSQL DataFrames)
Storage:• Support for reading HDFS or S3 of file format: Parquet, Text, Sequence File, RC, Avro
Data Types:• INT(8-64bits),CHAR/VARCHAR,BOOL,FLOAT,DOUBLE,DECIMAL,STRING,TIMESTAMP• NosupportforLOBsorNestedTypes
Scalability:• Testedupto80large/powerfulnodes• Validatedagainst1trillion row(100TB)TeraSortdataset/workload• Metadataupto1Mblocks(planningonly)• NotethatTPC-DSrunonSparkSQLat500GBscalepointran15%fasterwithRecordService
Security:• Authentication:Kerberos/LDAP/AD• Authorization:Sentrytablelevelprivileges, columnandrow-levelprivileges usingHMSviews.• Delegation token+taskencryptionforsecure taskexecution
36©Cloudera,Inc.Allrightsreserved.
CurrentLimitations
SecurityLimitations• Onlysupportssimplesingle-tableviews(nojoinsoraggregations).• SSLsupport hasnotbeentested.• Oozieintegrationhasnotbeentested.• UDFsarenotsupported
Storage/File Format Limitations• Nosupportforwritepath.• UnabletoreadfromKuduorHBase.
Operation andAdministration Limitations• Nodiagnosticbundlesupport.• NometricsavailableinCM.
Application Integration Limitations• Spark DataFrame not well tested.
See in http://cloudera.github.io/RecordServiceClient/ReleaseNotes.html
37©Cloudera,Inc.Allrightsreserved.
InstallationandPlatformSupport
Installation• Support CSDinstallationonCDH5.4+• Parcels,viaCM• Packages• QuickStartVM• ClientJARs
Platform/HardwareSupport• Serversupport:RHEL5-7,Ubuntu LTS,SLES,Debian• IntelNehalem(orlater)orAMDBulldozer(orlater)processor• 64GBmemory• Foroptimalperformance,runwith12ormoredisksoruseSSD.
OperationandAdministration• DirectlyfromRecordService:
• MetricsexposedviaaRecordServicewebapp• ProfilesforrequestsviaRecordServicewebapp
• FromCM:• Basicservicemanagement(start/stop/restart)andbasichealthchecksviaCM(processavailability).• AbilitytodeployRecordServicePlanner,Worker,orPlanner+Worker roles.
38©Cloudera,Inc.Allrightsreserved.
Resources
• RecordServiceBetaDocs• Featurelist• RecordService SourceCode• RecordServiceClientlibraries
39©Cloudera,Inc.Allrightsreserved.