MySQL Cluster - Deployment Best Practices Presentation
MySQL Cluster - Deployment Best Practices Presentation
• Cluster Setup
• Minimal & Recommended Setup
• Networking & Hardware Selection
• Disk Data Tables
• Configuration
• Administration
• Online/Offline Operations
• Backup and restore
• Monitoring
Minimal Setup
Clients
4 Computers having:
• 2 Data nodes
• 2 MySQL Servers SQL+Mgm SQL+Mgm
• 2 Management Nodes +AppServer +AppServer
+WebServer... +WebServer
Never:
• Co-locate data node
and management node!
(split brain/network partitioning)
Load Balancer(s)
Redundant switches
SQL+Mgm SQL+Mgm
+AppServer +AppServer
+WebServer... +WebServer...
Bonding
LCP UNDOLOG
REDOLOG (REDO LOG)
UNDOLOG
TABLESPACE 1
TABLESPACE
TABLESPACE 2
2 x SAS 10KRPM (preferably)
(REDO LOG / UNDO LOG)
LCP
SQL layer
App layer
SQL layer
Storage layer
syncrepl
Admin layer
binlog_do_db=mysq
l
Online Upgrades
• Change Online
• OS, SW version (7.0.x → 7.1.x)
• configuration
• E.g, incease DM, IM, Buffers, redo log, [mysqld] slots etc
• hardware (upgrade more RAM etc)
• These procedures requires a Rolling Restart
• Change config.ini, copy it over to all ndb_mgmd
• Stop BOTH ndb_mgmd, start BOTH ndb_mgmd
• Restart one data node at a time
• Restart one mysqld at a time
• Adding data nodes (from 7.0)
• See my presentation from Last Year (UC 2009)
• Adding MySQL Servers
• Make sure you have free [mysqld] slots
• Start the new mysqld
Backup
• Backup of NDB tables
• Online – can have ongoing transactions
• Consistent – only committed data and changes are backed up
• ndb_mgm -e “START BACKUP”
• Copy backup files from data nodes to safe location
• Non-NDB tables must be backed up separately
• Mysql system tables are stored only in MYISAM.
• You want to backup (for each mysql server)
• mysql database
• Triggers, SP ...
• Use 'mysqldump'
• mysqldump mysql > mysql.sql
• mysqldump --no-data --no-create-info -R > routines.sql
• Copy my.cnf & config.ini files
Restore
• ndb_restore is in many cases the MOST write intensive operation on
Cluster
• The problem is that ndb_restore produce REDO LOG
• This is unnecessary but a fact for now
• Restores many records in parallel, no throttling..
• So 128 or more small records may be fine, but 128 BLOBs .
Temporary error: 410: REDO log buffers overloaded, consult online manual
(increase RedoBuffer, and|or
decrease TimeBetweenLocalCheckpoints, and|or increase NoOfFragmentLogFiles)
• ndb_restore
→ csv
→ LOAD DATA INFILE
Scaling
• Mandatory to monitor
• CPU/Network/Memory usage
• Disk capacity (I/O) usage
• Network latency between nodes
• Node status ...
• Used Index/Data Memory
• www.severalnines.com/cmon- monitors data nodes and mysql
servers
• New in 7.1 :
• NDB$INFO Table in INFORMATION_SCHEMA
• Check node status
• Check buffer status etc
• Statistics
Questions?