Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	High	Availability	
InnoDB	Cluster	and	NDB	Cluster	
Mark	Swarbrick	
	
	 Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Safe	Harbor	Statement	
The	following	is	intended	to	outline	our	general	product	direcOon.	It	is	intended	for	
informaOon	purposes	only,	and	may	not	be	incorporated	into	any	contract.	It	is	not	a	
commitment	to	deliver	any	material,	code,	or	funcOonality,	and	should	not	be	relied	upon	
in	making	purchasing	decisions.	The	development,	release,	and	Oming	of	any	features	or	
funcOonality	described	for	Oracle’s	products	remains	at	the	sole	discreOon	of	Oracle.	
2
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Almost	all	organizaOons	require	their	most	
criOcal	systems	to	be	highly	available		
3	
100%
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
	InnoDB	Cluster	
4	
or	
	NDB	Cluster
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
•  MySQL	InnoDB	Cluster	
– Easy	HA	built	into	MySQL	5.7+	
– Write	consistency	
– Read	Scalability	
– App	failover	using	MySQL	Router	
– Management	via	mysqlsh	
– InnoDB	storage	engine	
	
•  MySQL	NDB	Cluster	
– In	memory	database	
– AutomaOc	sharding	
– NaOve	access	via	several	API	
– Read/write	consistency	
– Read/write	scalability	
– NDB	storage	engine	
How	Do	The	Two	Compare	I
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
How	Do	The	Two	Compare	II	
MySQL	InnoDB	Cluster	 MySQL	NDB	Cluster	
Storage	Engine	 InnoDB		 NDBCLUSTER	
Distributed	Architecture	 Shared	nothing	 Shared	nothing	
Consistency	Model	 Weak	Consistency	 Strong	Consistency	
Sharding	 No	 Yes	
ArbitraOon	 No	 Yes	
Load	Balancing	 No	 Yes	
NoSQL	APIs	 MySQL	Document	Store	 NaOve	NDB	API		
OperaOonal	Complexity	 Medium	 High	
AdministraOon	 Standard	(MySQL)	 Custom	(MySQL	+	NDB)
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
	InnoDB	Cluster	
7
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
InnoDB	Cluster	
8	
App	Servers	with	
MySQL	Router	
MySQL	Group	ReplicaOon	
MySQL	Shell	
Setup,	Manage,	
Orchestrate	
			“High	Availability	becomes	a	core	
						first	class	feature	of	MySQL!”
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	 9	
MySQL	InnoDB	Cluster:	Vision		
	
“A	single	product	—	MySQL	—	with	high	availability	and	scaling	
features	baked	in;	providing	an	integrated	end-to-end	soluEon	
that	is	easy	to	use.”
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
•  One	Product:	MySQL	
– All	components	created	together	
– Tested	together	
– Packaged	together		
•  Easy	to	Use		
– One	client:	MySQL	Shell	
– Easy	packaging	
– Integrated	orchestraOon		
– Homogenous	servers	
•  Flexible	and	Modern	
– SQL	and	NoSQL	together		
– Protocol	Buffers	
– Developer	friendly	
•  Support	Read/Write	Scale	Out	
– Sharded	clusters	
– Federated	system	of	N	replica	sets		
– Each	replica	set	manages	a	shard	
10	
MySQL	InnoDB	Cluster:	Goals
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Connector	
ApplicaOon	
MySQL	Router	
MySQL	Connector	
ApplicaOon	
MySQL	Router	
MySQL	Shell	
MySQL	Connector	
ApplicaOon	
MySQL	Router	
MySQL	Connector	
ApplicaOon	
MySQL	Router	
MySQL	InnoDB	Cluster:	High	Level	Architecture	
MySQL	
InnoDB	
cluster	
MySQL	Enterprise	Monitor	
…
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
	
		
MySQL	
Group	ReplicaOon	
Na7vely	distributed	and	highly	available	replica	sets
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Group	ReplicaOon:	What	Is	It?	
•  Group	ReplicaOon	library	
– ImplementaOon	of	Replicated	Database	State	Machine	
theory	
•  MySQL	GCS	is	based	on	Paxos	(variant	of	Mencius)	
– Provides	virtually	synchronous	replicaOon	for	MySQL	5.7+	
– Supported	on	all	MySQL	plaGorms	
•  Linux,	Windows,	Solaris,	OSX,	FreeBSD	
	
“MulE-master	update	anywhere	replicaEon	plugin	for	MySQL	with	
built-in	conflict	detec1on	and	resolu1on,	automa1c	distributed	
recovery,	and	group	membership.”	
	
	 13	
App	Servers	with	
MySQL	Router	
MySQL	Group	ReplicaOon	
MySQL	Shell	
Setup,	Manage,	
Orchestrate
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Group	ReplicaOon:	What	Does	It	Provide?	
•  A	highly	available	distributed	MySQL	database	service	
– Removes	the	need	for	manually	handling	server	fail-over	
– Provides	distributed	fault	tolerance	
– Enables	AcOve/AcOve	update	anywhere	setups	
– Automates	reconfiguraOon	(adding/removing	nodes,	crashes,	failures)		
– AutomaOcally	detects	and	handles	conflicts	
	
14
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Group	ReplicaOon:	Architecture	
Node	Types	
R:	Traffic	routers/proxies:	mysqlrouter,	haproxy,	sqlproxy,	...	
M:	mysqld	nodes	parOcipaOng	in	Group	ReplicaOon		
	 15
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	 16	
MySQL	Server:	Full	Stack
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
	
		
MySQL	Router	
Transparent	applica7on	connec7on	rou7ng
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Router:	2.1	
•  NaOve	support	for	InnoDB	clusters	
– Understands	Group	ReplicaOon	topology	
– UOlizes	metadata	schema	stored	on	each	member	
•  Bootstraps	itself	and	sets	up	client	rouOng	for	the	InnoDB	cluster		
•  Allows	for	intelligent	client	rouOng	into	the	InnoDB	cluster	
•  Supports	mulO-master	and	single	primary	modes	
•  Core	improvements		
– Logging	
– Monitoring	
– Performance	
– Security		
18	
App	Servers	with	
MySQL	Router	
MySQL	Group	ReplicaOon	
MySQL	Shell	
Setup,	Manage,	
Orchestrate	
labs.mysql.com
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
	
		
MySQL	Shell	
Single	tool	for	development,	setup,	
management,	orchestra7on,	and	monitoring
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Shell	
20	
A	single	unified	client	for	all	administra7ve	and	opera7ons	tasks		
App	Servers	with	
MySQL	Router	
MySQL	Group	ReplicaOon	
MySQL	Shell	
Setup,	Manage,	
Orchestrate	
•  MulO-Language:	JavaScript,	Python,	and	SQL	
– Naturally	scriptable		
•  Supports	both	Document	and	RelaOonal	models	
•  Exposes	full	Development	and	Admin	API	
	
	”MySQL	Shell	provides	the	developer	and	DBA	with	a	single	intuiEve,	
flexible,	and	powerfull	interface	for	all	MySQL	related	tasks!”
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Shell:	Admin	API	
•  mysql-js>	dba.help()	
•  The	global	variable	'dba'	is	used	to	access	the	
MySQL	AdminAPI	
•  Perform	DBA	operaOons	
– Manage	MySQL	InnoDB	clusters	
•  Create	clusters	
•  Deploy	MySQL	instances	
•  Get	cluster	info		
•  Start/Stop	MySQL	Instances	
•  Validate	MySQL	instances		…	
Database	Administra7on	Interface	
labs.mysql.com	
App	Servers	with	
MySQL	Router	
MySQL	Group	ReplicaOon	
MySQL	Shell	
Setup,	Manage,	
Orchestrate
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Shell	–	Deploy	MySQL	Instances	
	
		shell>	mysqlsh	
	
		mysql-js>	dba.deployLocalInstance(3306)	
	
		mysql-js>	dba.deployInstance(‘hanode2:3306’)	
	
		mysql-js>	dba.deployInstance(‘hanode3:3306’)	
		
	
	 22
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Shell	–	Create	an	InnoDB	Cluster	
	
		mysql-js>	connect	root@hanode1:3306	
	
		mysql-js>	cluster	=	dba.createCluster(‘NewAppCluster')	
	
		mysql-js>	cluster.addInstance('root@hanode2:3306')	
	
		mysql-js>	cluster.addInstance('root@hanode3:3306')	
	
	
	 23
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Shell	–	Add	a	MySQL	Router	
	
		shell>	mysqlrouter	--bootstrap	hanode1:3306	
	
		shell>	mysqlrouter	&	
	
		shell>	mysqlsh	--uri	root@localhost:6446	
	
	
		
	
	 24
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Enterprise	Monitor	
•  NaOve	holisOc	support	for	InnoDB	clusters	
– Topology	views	
– Detailed	metrics	and	graphs	
– Best	PracOce	advice		
•  Monitoring	of	MySQL	Routers		
•  Monitoring	of	Group	ReplicaOon		
25
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
	NDB	Cluster	
26
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Driving	Database	Requirements	
9th	April	2015	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 27	
Rock	Solid	
Availability	
In-Memory	
Real-Time	
Performance	
Extreme	
Read	&	Write	
Scalability	
ElasOcity
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
HLR	/	HSS	
Billing,	AuC,	VLR	
AuC,	Call	
RouOng,	Billing	
LocaOon	
Updates	
Pre	&	Post	Paid	
• 	Massive	volumes	of	write	traffic	
• 	<	3ms	database	response	
• 	DownOme	&	lost	transacOons	=	lost	$	
• 	Extremly	cost	sensiOve	market	
MySQL Cluster in Action: http://bit.ly/oRI5tF
No	Trade-Offs:	Cellular	Network
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Cluster	Overview	
• Memory	opOmized	tables	with	durability	
• Predictable	Low-Latency,	Bounded	Access	Time	REAL-TIME	
• Auto-Sharding,	AcOve-AcOve	
• ACID	Compliant,	OLTP	+	Real-Time	AnalyOcs	HIGH	SCALE,	READS	+	WRITES	
FULLY	ELASTIC	
•  AcOve-AcOve,	Shared	nothing,	no	Single	Point	of	Failure	
•  Self	Healing	+	On-Line	OperaOons	
99.999%	AVAILABILITY	
•  Key/Value	+	Complex,	RelaOonal	Queries	
•  SQL	+	Memcached	+	JavaScript	+	Java	+	HTTP/REST	&	C++	
SQL	+	NoSQL	
•  Open	Source	+	Commercial	EdiOons,	Easy	to	use	and	deploy	
•  Commodity	hardware	+	Management,	Monitoring	Tools	
LOW	TCO	
9th	April	2015	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 29	
•  Add	and	remove	storage	and	performance	capacity	in	seconds	
•  Fully	cloud	enabled
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
User	Session	
Session	
management	
Session	
management	
LocaOon	Updates,	
Character	movements,	...	
• 	Massive	volumes	of	write	traffic	
• 	<	3ms	database	response	
• 	DownOme	&	lost	transacOons	=	lost	$	
• 	Extremly	sensiOve	crowd		
No	Trade-Offs:	Massive	Parallel	Online	Games
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Cluster	Architecture	
	
MySQL	Cluster	Data	Nodes	
Clients	
ApplicaOon	Layer	
Data	Layer	
9th	April	2015	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 31
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Data	ParOOoning	/	Auto-sharding	
22/11/16	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 32	
User-id	(PK)	 Service	(PK)	 Data	
1773467253	 chat	 xxx	
6257346892	 chat	 xxx	
1773467253	 photos	 xxx	
7234782739	 photos	 xxx	
8235602099	 reminders	 xxx	
8437829249	 loca7on	 xxx	
MySQL	Cluster	Data	Nodes
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Data	ParOOoning	/	Auto-sharding	
22/11/16	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 33	
User-id	(PK)	 Service	(PK)	 Data	
1773467253	 chat	 xxx	
6257346892	 chat	 xxx	
1773467253	 photos	 xxx	
7234782739	 photos	 xxx	
8235602099	 reminders	 xxx	
8437829249	 loca7on	 xxx	
MySQL	Cluster	Data	Nodes	
Shard	Key
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Data	ParOOoning	/	Auto-sharding	
22/11/16	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 34	
User-id	(PK)	 Service	(PK)	 Data	
1773467253	 chat	 xxx	
6257346892	 chat	 xxx	
1773467253	 photos	 xxx	
7234782739	 photos	 xxx	
8235602099	 reminders	 xxx	
8437829249	 loca7on	 xxx	
MySQL	Cluster	Data	Nodes	
Shard	Key
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Node	Group	
Data	Node	1	
•  Data	transparently	sharded	between	Node	Groups	
•  Each	fragment	acOve	in	one	Data	Node	with	synchronous	replicaOon	to	
2nd	Data	Node	in	same	Node	Group	
22/11/16	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 35	
Data	Node	2	
Node	Group	
Data	Node	3	 Data	Node	4	
Data	ParOOoning	/	Auto-sharding
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Data	ParOOoning	/	Auto-sharding	
•  DBA	chooses	which	part	of	
Primary	Key	to	use	as	shard	
key	
•  Fragment	for	each	row	
decided	by	hashing	the	
sharding	key	
22/11/16	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 36	
User-id	(PK)	 Service	(PK)	 Data	
1773467253	 chat	 xxx	
6257346892	 chat	 xxx	
1773467253	 photos	 xxx	
7234782739	 photos	 xxx	
8235602099	 reminders	 xxx	
8437829249	 loca7on	 xxx	
Shard	Key	
Node	Group	
Data	Node	1	 Data	Node	2	
Node	Group	
Data	Node	3	 Data	Node	4
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
•  Data	automaOcally	rearranged	to	use	new	capacity	
•  Designed	to	be	a	slow	background	process	not	impacOng	real-Ome	
performance.	
22/11/16	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 37	
Node	Group	
Data	Node	1	 Data	Node	2	
Node	Group	
Data	Node	3	 Data	Node	4	
Node	Group	
Data	Node	5	 Data	Node	6	
On-line	Scaling	and	ElasOcity	
Re-parOoning
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
MySQL	Cluster	7.2:	1.2	Billion	UPDATEs	per	Minute	
•  NoSQL	C++	API,	
flexaSynch	benchmark	
•  30	x	Intel	E5-2600	Intel	
Servers,	2	socket,	64GB	
•  ACID	TransacOons,	with	
Synchronous	ReplicaOon	
	
hxp://www.mysql.com/why-mysql/
white-papers/mysql-cluster-
benchmarks-1-billion-writes-per-minute/		0
5
10
15
20
25
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
MillionsofUPDATEsperSecond
MySQL Cluster Data Nodes
9th	April	2015	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 38
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	 39	
MySQL	NDB	Cluster	7.5	
• Read	OpOmized	
Tables	
• Fully	Replicated	
Capacity	and	
Scale	Out	
• MySQL	5.7	
• JSON	Data	Type	
• Generated	Columns	
• Records-Per-Key	
OpOmizaOon	
Improved	
SQL	
• Improved	ReporOng	
• Improved	Logging	
• Improved	Visibility		
• Improved	Restore	
Management	
RC
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
•  Reading	from	backup	allows	to	
read	from	any	copy	
•  Previously	all	reads	were	directed	
towards	the	primary	fragment	only		
ConfidenOal	–	Oracle	Internal/Restricted/Highly	Restricted	 40	
MySQL	NDB	7.5:	Reading	from	backup	
Node	Group	
Data	Node	1	 Data	Node	2
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Next	Steps	
Learn	More	
•  www.mysql.com/cluster	
•  hxps://dev.mysql.com/doc/mysql-innodb-cluster/en/	
•  AuthenOc	MySQL	Curriculum:	hxp://oracle.com/educaOon/mysql	
Try	it	Out	
•  dev.mysql.com/downloads/cluster/	
7.4	GA	and	7.5	DMR	1	
•  hxps://labs.mysql.com/		
Let	us	know	what	you	think	
•  hxp://mysqlhighavailability.com/	
•  forums.mysql.com/list.php?25	
9th	April	2015	 Copyright	2015,	oracle	and/or	its	affiliates.	All	rights	reserved	 41
Copyright	©	2016,	Oracle	and/or	its	affiliates.	All	rights	reserved.		|	
Thank	you!

More Related Content

MySQL HA