SlideShare a Scribd company logo
Making MySQL highly available
using Oracle Grid Infrastructure
Ilmar Kerm
Who Am I
LAMP developer/DBA since 2000
- MySQL 3.22 !
Delphi/Oracle developer since 2003
- The first medical patient record system in production in Estonia
Oracle DBA since 2005
- Initially by accident, but started to like it
Working in Affecto since 2006
- The only DBA, sysadmin, etc in Affecto Estonia
- Since 2007 working full time as a DBA consultant in a large European online
gambling provider
- Certifications: OCP-DBA; OCE-Grid,SQL; OCA-MySQL,AppSrv,PLSQL
What is Oracle Grid Infrastructure
Enables communication between collection of servers so they could act as a
collective unit
- Combination of servers is known as a cluster
- Also known as Oracle Clusterware
Provides necessary infrastructure for Oracle RAC
Manages resources:
- Virtual IP
- Disk groups, volumes, clustered file systems
- Databases
- Listeners
- etc
Architecture
Making applications highly available
What are resources
Any database, application, process or VIP managed by Oracle Clusterware
- Cluster resource
- Local resource
Can have start and stop dependencies to other resources
Start dependencies
- Hard, weak, pullup, attraction, dispersion
Stop dependencies
- Hard
Resource attributes
Selection of attributes one can set for a resource
- ACTION_SCRIPT
- ACTIVE_PLACEMENT
- AUTO_START
- CHECK_INTERVAL
- ENABLED
- NAME
- PLACEMENT
- RESTART_ATTEMPTS
- SCRIPT_TIMEOUT
- SERVER_POOLS / HOSTING_MEMBERS
- TYPE
- START_DEPENDENCIES / STOP_DEPENDENCIES
Action Script
User supplied script to control the application
- Takes one command line argument – action
Supported actions
- start
- stop
- check
- clean
- abort (not mandatory)
Action script (check exit codes)
Application status controlled by script exit codes
- 0 = OK
- 1 = Not OK
CHECK action has more exit codes
- 0 = ONLINE
- 1 = UNPLANNED OFFLINE
- 2 = PLANNED OFFLINE
- 3 = UNKNOWN
- 4 = PARTIAL
- 5 = FAILED
Who executes the scripts?
Action scripts are executed by scriptagent process
All executions are logged:
- $GRID_HOME/logs/<host>/agent/crsd/scriptagent_<user>/scriptagent_<user>.log
2014-02-17 09:43:47.658: [support_mdb1_qa][1087916352]{1:41897:56226}
[check] Executing action script: /u02/app/mysql/support_mdb1_qa.scr[check]
2014-02-17 09:43:47.762: [support_mdb1_qa][1087916352]{1:41897:56226}
[check] Mon Feb 17 09:43:47 CET 2014 Action script
'/u02/app/mysql/support_mdb1_qa.scr' for resource[support_mdb1_qa] called
for action check - MYSQL_SID=support_mdb1_qa
2014-02-17 09:43:47.762: [support_mdb1_qa][1087916352]{1:41897:56226}
[check] Exit value: 0
Add resource
Optional: Add resource type to specify some common attributes
crsctl add type mysql_instance -basetype cluser_resource -attr
“ATTRIBUTE=CHECK_INTERVAL,TYPE=integer,DEFAULT_VALUE=10”
Create VIP resource
appvipcfg create -network=1 -ip=10.0.1.10 -vipname=mysql1_vip -user=root
Add application resource
crsctl add resource mysql1 -type mysql_instance –attr
“ACTION_SCRIPT=/u02/app/mysql/mysql1.scr,
PLACEMENT='restricted', SERVER_POOLS='pte_pool',
START_DEPENDENCIES='hard(mysql1_vip,ora.swe1mc1acfs.acfstest1.acfs) pullup(mysql1_vip)',
STOP_DEPENDENCIES='hard(mysql1_vip)'”
Monitor resource
crsctl status resource cms_mdb1_dev
NAME=cms_mdb1_dev
TYPE=mysql_instance
TARGET=ONLINE
STATE=ONLINE on jfadbmc1n03
Monitor resources
crsctl status resource -t -w "TYPE = mysql_instance"
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
bank_mdb1
1 ONLINE ONLINE jfadbmc1n03
cms_mdb1
1 ONLINE ONLINE jfadbmc1n04
cms_mdb1_dev
1 ONLINE ONLINE jfadbmc1n01
cms_mdb1_pte
1 ONLINE ONLINE jfadbmc1n02
cms_mdb1_qa
1 ONLINE ONLINE jfadbmc1n03
Automatic Storage Management (ASM)
Oracle ASM is a cluster aware volume manager and file system for Oracle
Database
Uses disk groups to store files
Disk group is a collection of raw disk devices
- Disk group contents are striped over all disks within disk group
- Adding/removing disk space is done just by adding/removing disks online
- Redundancy configurable: external (none), normal (2x), high (3x)
Oracle DB uses disk groups directly
- 3rd party apps can use ASM through ADVM volumes and ACFS file system
ADVM & ACFS Architecture
ASM
Disk group
Volume
ACFS
Volume
3rd party FS
Disk group
Oracle DB
Need kernel drivers!
Need to load kernel drivers to make ADVM volumes and ACFS file systems
visible
Kernel drivers are dependent on kernel version
- Distributed with GI, PSU also updates drivers
If not started automatically, then
- $GRID_HOME/bin/acfsload start
lsmod | grep oracle
oracleacfs 1933804 45
oracleadvm 243697 51
oracleoks 420760 2 oracleacfs,oracleadvm
oracleasm 53663 1
ADVM – ASM Dynamic Volume Manager
Provides volume management services
Can be resized online
Visible as block devices on Linux
- ls -l /dev/asm/
brwxrwx--- 1 root dba 251, 232961 Oct 9 10:26 acfs1-455
brwxrwx--- 1 root dba 251, 112171 Feb 17 11:59 acfstest1-219
brwxrwx--- 1 root dba 251, 112139 Oct 9 10:26 swe1account-219
brwxrwx--- 1 root dba 251, 112151 Oct 9 10:25 swe1bank-219
brwxrwx--- 1 root dba 251, 112152 Oct 9 10:25 swe1cms-219
ACFS – ASM Cluster File System
POSIX compliant cluster file system
Can be resized online
BASIC use
- Free – see licensing slide
ADVANCED use – needs license
- Snapshots
- Tagging
- Replication
- Security & Encryption
- Auditing
Creating ADVM volume and ACFS
• asmcmd
ASMCMD [+] > ls
ACFS/
OCRDATA/
SWE1MC1ACFS/
• ASMCMD [+] > volcreate -G SWE1MC1ACFS -s 10G acfstest1
• ls -l /dev/asm/acfstest1*
brwxrwx--- 1 root dba 251, 112171 Feb 17 11:18 /dev/asm/acfstest1-219
• mkfs.acfs /dev/asm/acfstest1-219
mkfs.acfs: version = 11.2.0.4.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/acfstest1-219
mkfs.acfs: volume size = 10737418240
mkfs.acfs: Format complete.
Registering ACFS as a GI resource
srvctl add filesystem -d /dev/asm/acfstest1-219 -v
acfstest1 -g SWE1MC1ACFS -m /instance/acfstest1
- Created resource: ora.swe1mc1acfs.acfstest1.acfs
- Can use this resource to create dependencies to other resources
srvctl start filesystem -d /dev/asm/acfstest1-219
- Mounts file system on all nodes
ACFSUTIL registration also possible but then cannot create resource
dependencies
Monitoring ACFS
• crsctl status resource ora.swe1mc1acfs.acfstest1.acfs –t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.swe1mc1acfs.acfstest1.acfs
ONLINE ONLINE jfadbmc1n01 mounted on /instanc
e/acfstest1
ONLINE ONLINE jfadbmc1n02 mounted on /instanc
e/acfstest1
ONLINE ONLINE jfadbmc1n03 mounted on /instanc
e/acfstest1
ONLINE ONLINE jfadbmc1n04 mounted on /instanc
e/acfstest1
Licensing
Oracle Clusterware for High Availability is included in Oracle Linux Basic and
Premier Support
Quote from “Oracle® Database Licensing Information 11g Release 2 (11.2)”
- Use of Oracle ADVM and Oracle ACFS's base functionality (i.e., excluding
the below-listed advanced functionality) is free for all data types, including
non-Oracle files.
- Use of Oracle ACFS's advanced functionality requires the Cloud File System
license. The advanced functionality consists of snapshots, replication,
tagging, realm-based security, encryption, and auditing.
- Oracle will provide support for ACFS/ADVM only if the server is running an
Oracle product, which may include Oracle Linux or Oracle Solaris, that is
also under Oracle support.
ACFS vs OCFS2
OCFS2 advantages
- OCFS2 is part of Linux kernel and open source
- OCFS2 is very easy to set up
- Does not require Oracle Grid Infrastructure
OCFS2 disadvantages
- When running with Oracle GI it still requires separate cluster setup
- In my experience unreliable – multiple times corrupted data during online
resizing, crashes, global locks
Using Oracle GI for MySQL
Our MySQL environment
20+ different applications
- Maintained by different application teams
- Different requirements to the database – for example settings, versions
Each application only uses its own databases
Databases
- 80 in production, ~400 in test
Our old setup
3 master-master MySQL
replication configurations
- Using MySQL built-in
replication
One instance per server
Using Oracle GI for MySQL
Divided databases into business-logical instance “groupings”
- 13 in production, 38 in test
- Instances can run different RDBMS versions
- Each instance has dedicated VIP, clients use this VIP to connect
One ACFS file system per MySQL instance
- Mounted read-write on all cluster nodes
3 physical servers in production, 3 in test
Oracle Grid Infrastructure Standalone
Agents - XAG
Oracle provided and supported management scripts for
- GoldenGate
- Siebel
- Apache HTTP Server
- Apache Tomcat
- Peoplesoft
- MySQL
Using it for MySQL requires MySQL Enterprise Edition subscription
Supported for MySQL 5.6+
Usage through agctl
XAG script for MySQL
Written in Perl
- agmysqlas.pm
Start
- mysqld_safe --basedir=$mysql_home --datadir=$datadir &
Stop
- mysqladmin shutdown
Check
- mysqladmin status
Custom scripts - My script suite
I wrote scripts in bash to help manage MySQL under Oracle clusterware
- https://github.com/ilmarkerm/mysql-with-oracle-clusterware-scripts
Tested with MySQL 5.1, 5.5, 5.6 both community and enterprise
- Under RHEL/OEL 5 and 6
Important scripts in this suite:
- mysql_handler.sh
- Action script, must be symlinked to instancename.scr
- instances.sh
- Configuration, lists all configured instances
- init_mysql_db.sh and init_grid.sh
- Create new MySQL instance and add resources to GI
- mysql_logrotate.sh
- Rotates general/error/slow logs for all instances using logrotate
Making MySQL highly available using Oracle Grid Infrastructure
Recommended directory structure
/instance/<instance name>/
- MySQL instance home directory containing:
- data/ - mysql data directory
- config/my.cnf – mysql instance configuration file
- logs/ - directory where mysql stores its log files
/u02/app/mysql/
- Containing the script suite
/u02/app/mysql/product/<version>/
- MySQL RDBMS binaries – use the TAR version
/root/.my.cnf
- Default MySQL root password
init_mysql_db.sh
This script initializes MySQL data directory and all cluster scripts.
Script must be run as user root.
Usage:
-i name
Instance name. Name should be 20 characters or less and only
characters a-z, A-Z, 0-9 and _ are allowed (w character class)
MySQL and instance settings:
-s directory
MySQL software location (where tar-edition is unpacked)
-b ipaddr
IP address to bind the instance
-a basedirectory
Instance base directory, this replaces options -d -c -l by setting
the following values
-d basedirectory/data, -c basedirectory/config/my.cnf, -l
basedirectory/logs
init_mysql_db.sh (continued)
• ./init_mysql_db.sh -i acfstest1 -b 10.69.136.250 -s
/u02/app/mysql/product/5.6.16 -a /instance/acfstest1
Installing MySQL system tables...2014-02-17 14:05:21 0 [Warning] TIMESTAMP
with implicit DEFAULT value is deprecated. Please use --
explicit_defaults_for_timestamp server option (see documentation for more
details).
2014-02-17 14:05:21 20845 [Note] InnoDB: Using atomics to ref count buffer
pool pages
2014-02-17 14:05:21 20845 [Note] InnoDB: The InnoDB memory heap is disabled
…
Starting MySQL...
Creating 'clusterware'@'localhost' user...
Changing root password...
Stopping MySQL...
Updating cluster configuration /u02/app/mysql/instances.sh...
Symlinking actionscript acfstest1.scr...
init_grid.sh
• ./init_grid.sh -i acfstest1 -t mysql_instance -p Generic
Instance name=acfstest1
GRID_USER=grid
GRID_HOME=/u01/app/grid/product/11.2.0.4/grid
Virtual IP=10.69.136.250
Production Copyright 2007, 2008, Oracle.All rights reserved
…
Configuration done!
Use the following command to start MySQL instance:
/u01/app/grid/product/11.2.0.4/grid/bin/crsctl start resource
acfstest1
instances.sh
# This script is just configuration file, it contains some general
parameters and the
# configuration for all MySQL instances
# MySQL OS process owner
MYSQLUSER=mysql
# MYSQL_DB_USER MYSQL_DB_PASSWORD - Credentials to log in to mysql (check)
# MYSQL_DB_USER MYSQL_DB_PASSWORD - Credentials to log in to mysql
MYSQL_DB_USER="clusterware"
MYSQL_DB_PASSWORD="cluster123"
LOCKDIR=/u02/app/mysql/locks
acfstest1=(
DATADIR="/instance/acfstest1/data"
CONFFILE="/instance/acfstest1/config/my.cnf"
BINDADDR="10.69.136.250"
SOFTWARE="/u02/app/mysql/product/5.6.16"
LOGDIR="/instance/acfstest1/logs"
)
mysql_handler.sh
Clusterware action script implementation
Must be symlinked to <instance name>.scr for each instance
- Only execute the symlinked scr file
Implemented actions:
- start – start mysqld (without mysqld_safe)
- stop – send TERM to mysqld
- check – executes “mysqladmin ping” through socket
- clean – if mysqld still alive send KILL
When executed without parameters opens MySQL CLI through socket
mysql_handler.sh (continued)
• ./acfstest1.scr check
Exit value: 0
• ./acfstest1.scr
Usage: ./mysql_handler.sh {start|stop|restart|check|clean}. All other
arguments execute MySQL Console.
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 42
…
Type 'help;' or 'h' for help. Type 'c' to clear the current input
statement.
mysql>
Additional HA developments
In order to address planned maintenance (some DDL in MySQL still blocking)
- Build traditional MySQL slave instance and start using MySQL Fabric
- While primary database is under maintenance, slave serves the client
connections
MySQL Fabric node (with backing store) can also be set up as clusterware
resources
- Handles configuration and communication with drivers
MySQL driver is fabric aware
Contact info and links
https://github.com/ilmarkerm/mysql-with-oracle-clusterware-scripts
Email: ilmar.kerm@gmail.com
Twitter: https://twitter.com/ilmarkerm
LinkedIn: https://ee.linkedin.com/pub/ilmar-kerm/41/570/428/
Blog: https://ilmarkerm.eu
Ad

Recommended

Oracle LOB Internals and Performance Tuning
Oracle LOB Internals and Performance Tuning
Tanel Poder
 
Exadata and the Oracle Optimizer: The Untold Story
Exadata and the Oracle Optimizer: The Untold Story
Enkitec
 
Securefile LOBs
Securefile LOBs
Martin Berger
 
Azure Log Analytics 概要
Azure Log Analytics 概要
喜智 大井
 
Rac rac one_node説明資料
Rac rac one_node説明資料
Hiroki Morita
 
What's new in Oracle 19c & 18c Recovery Manager (RMAN)
What's new in Oracle 19c & 18c Recovery Manager (RMAN)
Satishbabu Gunukula
 
Deep review of LMS process
Deep review of LMS process
Riyaj Shamsudeen
 
Exadata master series_asm_2020
Exadata master series_asm_2020
Anil Nair
 
Same plan different performance
Same plan different performance
Mauro Pagano
 
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
Enkitec
 
SQL Plan Directives explained
SQL Plan Directives explained
Mauro Pagano
 
Oracle Database Vault
Oracle Database Vault
Marco Alamanni
 
Oracle dataguard overview
Oracle dataguard overview
aguswahyudi09
 
Citus Architecture: Extending Postgres to Build a Distributed Database
Citus Architecture: Extending Postgres to Build a Distributed Database
Ozgun Erdogan
 
MySQL 8.0.18 latest updates: Hash join and EXPLAIN ANALYZE
MySQL 8.0.18 latest updates: Hash join and EXPLAIN ANALYZE
Norvald Ryeng
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
ReKruiTIn.com
 
Qlik Replicateのタスク実行時の操作
Qlik Replicateのタスク実行時の操作
QlikPresalesJapan
 
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
Insight Technology, Inc.
 
DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in Nutshell
Cuneyt Goksu
 
はじめてのOracle Cloud Infrastructure (Oracle Cloudウェビナーシリーズ: 2021年7月28日)
はじめてのOracle Cloud Infrastructure (Oracle Cloudウェビナーシリーズ: 2021年7月28日)
オラクルエンジニア通信
 
Babelfish Compatibility
Babelfish Compatibility
Noriyoshi Shinoda
 
Oracle sql high performance tuning
Oracle sql high performance tuning
Guy Harrison
 
Oracle sharding : Installation & Configuration
Oracle sharding : Installation & Configuration
suresh gandhi
 
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Jaime Crespo
 
Oracle database performance tuning
Oracle database performance tuning
Yogiji Creations
 
Oracle Complete Interview Questions
Oracle Complete Interview Questions
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
 
The PostgreSQL Query Planner
The PostgreSQL Query Planner
Command Prompt., Inc
 
01 oracle architecture
01 oracle architecture
Smitha Padmanabhan
 
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
Olivier DASINI
 
MySQL Alta Disponibilidade com Replicação
MySQL Alta Disponibilidade com Replicação
MySQL Brasil
 

More Related Content

What's hot (20)

Same plan different performance
Same plan different performance
Mauro Pagano
 
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
Enkitec
 
SQL Plan Directives explained
SQL Plan Directives explained
Mauro Pagano
 
Oracle Database Vault
Oracle Database Vault
Marco Alamanni
 
Oracle dataguard overview
Oracle dataguard overview
aguswahyudi09
 
Citus Architecture: Extending Postgres to Build a Distributed Database
Citus Architecture: Extending Postgres to Build a Distributed Database
Ozgun Erdogan
 
MySQL 8.0.18 latest updates: Hash join and EXPLAIN ANALYZE
MySQL 8.0.18 latest updates: Hash join and EXPLAIN ANALYZE
Norvald Ryeng
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
ReKruiTIn.com
 
Qlik Replicateのタスク実行時の操作
Qlik Replicateのタスク実行時の操作
QlikPresalesJapan
 
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
Insight Technology, Inc.
 
DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in Nutshell
Cuneyt Goksu
 
はじめてのOracle Cloud Infrastructure (Oracle Cloudウェビナーシリーズ: 2021年7月28日)
はじめてのOracle Cloud Infrastructure (Oracle Cloudウェビナーシリーズ: 2021年7月28日)
オラクルエンジニア通信
 
Babelfish Compatibility
Babelfish Compatibility
Noriyoshi Shinoda
 
Oracle sql high performance tuning
Oracle sql high performance tuning
Guy Harrison
 
Oracle sharding : Installation & Configuration
Oracle sharding : Installation & Configuration
suresh gandhi
 
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Jaime Crespo
 
Oracle database performance tuning
Oracle database performance tuning
Yogiji Creations
 
Oracle Complete Interview Questions
Oracle Complete Interview Questions
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
 
The PostgreSQL Query Planner
The PostgreSQL Query Planner
Command Prompt., Inc
 
01 oracle architecture
01 oracle architecture
Smitha Padmanabhan
 
Same plan different performance
Same plan different performance
Mauro Pagano
 
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
Enkitec
 
SQL Plan Directives explained
SQL Plan Directives explained
Mauro Pagano
 
Oracle dataguard overview
Oracle dataguard overview
aguswahyudi09
 
Citus Architecture: Extending Postgres to Build a Distributed Database
Citus Architecture: Extending Postgres to Build a Distributed Database
Ozgun Erdogan
 
MySQL 8.0.18 latest updates: Hash join and EXPLAIN ANALYZE
MySQL 8.0.18 latest updates: Hash join and EXPLAIN ANALYZE
Norvald Ryeng
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
ReKruiTIn.com
 
Qlik Replicateのタスク実行時の操作
Qlik Replicateのタスク実行時の操作
QlikPresalesJapan
 
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
[B31] LOGMinerってレプリケーションソフトで使われているけどどうなってる? by Toshiya Morita
Insight Technology, Inc.
 
DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in Nutshell
Cuneyt Goksu
 
はじめてのOracle Cloud Infrastructure (Oracle Cloudウェビナーシリーズ: 2021年7月28日)
はじめてのOracle Cloud Infrastructure (Oracle Cloudウェビナーシリーズ: 2021年7月28日)
オラクルエンジニア通信
 
Oracle sql high performance tuning
Oracle sql high performance tuning
Guy Harrison
 
Oracle sharding : Installation & Configuration
Oracle sharding : Installation & Configuration
suresh gandhi
 
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Jaime Crespo
 
Oracle database performance tuning
Oracle database performance tuning
Yogiji Creations
 

Similar to Making MySQL highly available using Oracle Grid Infrastructure (20)

MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
Olivier DASINI
 
MySQL Alta Disponibilidade com Replicação
MySQL Alta Disponibilidade com Replicação
MySQL Brasil
 
Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?
Ludovico Caldara
 
MySQL 5.7 InnoDB Cluster (Jan 2018)
MySQL 5.7 InnoDB Cluster (Jan 2018)
Olivier DASINI
 
Installing oracle grid infrastructure and database 12c r1
Installing oracle grid infrastructure and database 12c r1
Voeurng Sovann
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Sandesh Rao
 
E-Business Suite Rapid Provisioning Using Latest Features Of Oracle Database 12c
E-Business Suite Rapid Provisioning Using Latest Features Of Oracle Database 12c
Andrejs Karpovs
 
Oracle RAC 12c Best Practices Sanger OOW13 [CON8805]
Oracle RAC 12c Best Practices Sanger OOW13 [CON8805]
Markus Michalewicz
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
Olivier DASINI
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
Olivier DASINI
 
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Markus Michalewicz
 
Best practices oracle_clusterware_session355_wp
Best practices oracle_clusterware_session355_wp
wardell henley
 
Oracle Database 12c Multitenant for Consolidation
Oracle Database 12c Multitenant for Consolidation
Yudi Herdiana
 
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
Keith Hollman
 
Oracle ACFS High Availability NFS Services (HANFS) Part-I
Oracle ACFS High Availability NFS Services (HANFS) Part-I
Anju Garg
 
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
Frazer Clement
 
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
Frederic Descamps
 
Oracle goldengate and RAC12c
Oracle goldengate and RAC12c
Siraj Ahmed
 
Oracle RAC 12c Overview
Oracle RAC 12c Overview
Markus Michalewicz
 
Oracle Drivers configuration for High Availability
Oracle Drivers configuration for High Availability
Ludovico Caldara
 
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
Olivier DASINI
 
MySQL Alta Disponibilidade com Replicação
MySQL Alta Disponibilidade com Replicação
MySQL Brasil
 
Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?
Ludovico Caldara
 
MySQL 5.7 InnoDB Cluster (Jan 2018)
MySQL 5.7 InnoDB Cluster (Jan 2018)
Olivier DASINI
 
Installing oracle grid infrastructure and database 12c r1
Installing oracle grid infrastructure and database 12c r1
Voeurng Sovann
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Sandesh Rao
 
E-Business Suite Rapid Provisioning Using Latest Features Of Oracle Database 12c
E-Business Suite Rapid Provisioning Using Latest Features Of Oracle Database 12c
Andrejs Karpovs
 
Oracle RAC 12c Best Practices Sanger OOW13 [CON8805]
Oracle RAC 12c Best Practices Sanger OOW13 [CON8805]
Markus Michalewicz
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
Olivier DASINI
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
Olivier DASINI
 
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Markus Michalewicz
 
Best practices oracle_clusterware_session355_wp
Best practices oracle_clusterware_session355_wp
wardell henley
 
Oracle Database 12c Multitenant for Consolidation
Oracle Database 12c Multitenant for Consolidation
Yudi Herdiana
 
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
Keith Hollman
 
Oracle ACFS High Availability NFS Services (HANFS) Part-I
Oracle ACFS High Availability NFS Services (HANFS) Part-I
Anju Garg
 
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
Frazer Clement
 
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
Frederic Descamps
 
Oracle goldengate and RAC12c
Oracle goldengate and RAC12c
Siraj Ahmed
 
Oracle Drivers configuration for High Availability
Oracle Drivers configuration for High Availability
Ludovico Caldara
 
Ad

Recently uploaded (20)

CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
Building Geospatial Data Warehouse for GIS by GIS with FME
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
Heat Treatment Process Automation in India
Heat Treatment Process Automation in India
Reckers Mechatronics
 
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
Azure AI Foundry: The AI app and agent factory
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
 
Automated Testing and Safety Analysis of Deep Neural Networks
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
AI for PV: Development and Governance for a Regulated Industry
AI for PV: Development and Governance for a Regulated Industry
Biologit
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
 
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Philip Schwarz
 
NEW-IDM Crack with Internet Download Manager 6.42 Build 27 VERSION
NEW-IDM Crack with Internet Download Manager 6.42 Build 27 VERSION
grete1122g
 
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
Zoho Creator Solution for EI by Elsner Technologies.docx
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
Top Time Tracking Solutions for Accountants
Top Time Tracking Solutions for Accountants
oliviareed320
 
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
 
Test Case Design Techniques – Practical Examples & Best Practices in Software...
Test Case Design Techniques – Practical Examples & Best Practices in Software...
Muhammad Fahad Bashir
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
Building Geospatial Data Warehouse for GIS by GIS with FME
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
Heat Treatment Process Automation in India
Heat Treatment Process Automation in India
Reckers Mechatronics
 
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
Azure AI Foundry: The AI app and agent factory
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
 
Automated Testing and Safety Analysis of Deep Neural Networks
Automated Testing and Safety Analysis of Deep Neural Networks
Lionel Briand
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
AI for PV: Development and Governance for a Regulated Industry
AI for PV: Development and Governance for a Regulated Industry
Biologit
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
 
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding 𝑢𝑛𝑓𝑜𝑙𝑑 as the Computational Dual of ...
Philip Schwarz
 
NEW-IDM Crack with Internet Download Manager 6.42 Build 27 VERSION
NEW-IDM Crack with Internet Download Manager 6.42 Build 27 VERSION
grete1122g
 
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
Zoho Creator Solution for EI by Elsner Technologies.docx
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
Top Time Tracking Solutions for Accountants
Top Time Tracking Solutions for Accountants
oliviareed320
 
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
 
Test Case Design Techniques – Practical Examples & Best Practices in Software...
Test Case Design Techniques – Practical Examples & Best Practices in Software...
Muhammad Fahad Bashir
 
Ad

Making MySQL highly available using Oracle Grid Infrastructure

  • 1. Making MySQL highly available using Oracle Grid Infrastructure Ilmar Kerm
  • 2. Who Am I LAMP developer/DBA since 2000 - MySQL 3.22 ! Delphi/Oracle developer since 2003 - The first medical patient record system in production in Estonia Oracle DBA since 2005 - Initially by accident, but started to like it Working in Affecto since 2006 - The only DBA, sysadmin, etc in Affecto Estonia - Since 2007 working full time as a DBA consultant in a large European online gambling provider - Certifications: OCP-DBA; OCE-Grid,SQL; OCA-MySQL,AppSrv,PLSQL
  • 3. What is Oracle Grid Infrastructure Enables communication between collection of servers so they could act as a collective unit - Combination of servers is known as a cluster - Also known as Oracle Clusterware Provides necessary infrastructure for Oracle RAC Manages resources: - Virtual IP - Disk groups, volumes, clustered file systems - Databases - Listeners - etc
  • 6. What are resources Any database, application, process or VIP managed by Oracle Clusterware - Cluster resource - Local resource Can have start and stop dependencies to other resources Start dependencies - Hard, weak, pullup, attraction, dispersion Stop dependencies - Hard
  • 7. Resource attributes Selection of attributes one can set for a resource - ACTION_SCRIPT - ACTIVE_PLACEMENT - AUTO_START - CHECK_INTERVAL - ENABLED - NAME - PLACEMENT - RESTART_ATTEMPTS - SCRIPT_TIMEOUT - SERVER_POOLS / HOSTING_MEMBERS - TYPE - START_DEPENDENCIES / STOP_DEPENDENCIES
  • 8. Action Script User supplied script to control the application - Takes one command line argument – action Supported actions - start - stop - check - clean - abort (not mandatory)
  • 9. Action script (check exit codes) Application status controlled by script exit codes - 0 = OK - 1 = Not OK CHECK action has more exit codes - 0 = ONLINE - 1 = UNPLANNED OFFLINE - 2 = PLANNED OFFLINE - 3 = UNKNOWN - 4 = PARTIAL - 5 = FAILED
  • 10. Who executes the scripts? Action scripts are executed by scriptagent process All executions are logged: - $GRID_HOME/logs/<host>/agent/crsd/scriptagent_<user>/scriptagent_<user>.log 2014-02-17 09:43:47.658: [support_mdb1_qa][1087916352]{1:41897:56226} [check] Executing action script: /u02/app/mysql/support_mdb1_qa.scr[check] 2014-02-17 09:43:47.762: [support_mdb1_qa][1087916352]{1:41897:56226} [check] Mon Feb 17 09:43:47 CET 2014 Action script '/u02/app/mysql/support_mdb1_qa.scr' for resource[support_mdb1_qa] called for action check - MYSQL_SID=support_mdb1_qa 2014-02-17 09:43:47.762: [support_mdb1_qa][1087916352]{1:41897:56226} [check] Exit value: 0
  • 11. Add resource Optional: Add resource type to specify some common attributes crsctl add type mysql_instance -basetype cluser_resource -attr “ATTRIBUTE=CHECK_INTERVAL,TYPE=integer,DEFAULT_VALUE=10” Create VIP resource appvipcfg create -network=1 -ip=10.0.1.10 -vipname=mysql1_vip -user=root Add application resource crsctl add resource mysql1 -type mysql_instance –attr “ACTION_SCRIPT=/u02/app/mysql/mysql1.scr, PLACEMENT='restricted', SERVER_POOLS='pte_pool', START_DEPENDENCIES='hard(mysql1_vip,ora.swe1mc1acfs.acfstest1.acfs) pullup(mysql1_vip)', STOP_DEPENDENCIES='hard(mysql1_vip)'”
  • 12. Monitor resource crsctl status resource cms_mdb1_dev NAME=cms_mdb1_dev TYPE=mysql_instance TARGET=ONLINE STATE=ONLINE on jfadbmc1n03
  • 13. Monitor resources crsctl status resource -t -w "TYPE = mysql_instance" -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- bank_mdb1 1 ONLINE ONLINE jfadbmc1n03 cms_mdb1 1 ONLINE ONLINE jfadbmc1n04 cms_mdb1_dev 1 ONLINE ONLINE jfadbmc1n01 cms_mdb1_pte 1 ONLINE ONLINE jfadbmc1n02 cms_mdb1_qa 1 ONLINE ONLINE jfadbmc1n03
  • 14. Automatic Storage Management (ASM) Oracle ASM is a cluster aware volume manager and file system for Oracle Database Uses disk groups to store files Disk group is a collection of raw disk devices - Disk group contents are striped over all disks within disk group - Adding/removing disk space is done just by adding/removing disks online - Redundancy configurable: external (none), normal (2x), high (3x) Oracle DB uses disk groups directly - 3rd party apps can use ASM through ADVM volumes and ACFS file system
  • 15. ADVM & ACFS Architecture ASM Disk group Volume ACFS Volume 3rd party FS Disk group Oracle DB
  • 16. Need kernel drivers! Need to load kernel drivers to make ADVM volumes and ACFS file systems visible Kernel drivers are dependent on kernel version - Distributed with GI, PSU also updates drivers If not started automatically, then - $GRID_HOME/bin/acfsload start lsmod | grep oracle oracleacfs 1933804 45 oracleadvm 243697 51 oracleoks 420760 2 oracleacfs,oracleadvm oracleasm 53663 1
  • 17. ADVM – ASM Dynamic Volume Manager Provides volume management services Can be resized online Visible as block devices on Linux - ls -l /dev/asm/ brwxrwx--- 1 root dba 251, 232961 Oct 9 10:26 acfs1-455 brwxrwx--- 1 root dba 251, 112171 Feb 17 11:59 acfstest1-219 brwxrwx--- 1 root dba 251, 112139 Oct 9 10:26 swe1account-219 brwxrwx--- 1 root dba 251, 112151 Oct 9 10:25 swe1bank-219 brwxrwx--- 1 root dba 251, 112152 Oct 9 10:25 swe1cms-219
  • 18. ACFS – ASM Cluster File System POSIX compliant cluster file system Can be resized online BASIC use - Free – see licensing slide ADVANCED use – needs license - Snapshots - Tagging - Replication - Security & Encryption - Auditing
  • 19. Creating ADVM volume and ACFS • asmcmd ASMCMD [+] > ls ACFS/ OCRDATA/ SWE1MC1ACFS/ • ASMCMD [+] > volcreate -G SWE1MC1ACFS -s 10G acfstest1 • ls -l /dev/asm/acfstest1* brwxrwx--- 1 root dba 251, 112171 Feb 17 11:18 /dev/asm/acfstest1-219 • mkfs.acfs /dev/asm/acfstest1-219 mkfs.acfs: version = 11.2.0.4.0 mkfs.acfs: on-disk version = 39.0 mkfs.acfs: volume = /dev/asm/acfstest1-219 mkfs.acfs: volume size = 10737418240 mkfs.acfs: Format complete.
  • 20. Registering ACFS as a GI resource srvctl add filesystem -d /dev/asm/acfstest1-219 -v acfstest1 -g SWE1MC1ACFS -m /instance/acfstest1 - Created resource: ora.swe1mc1acfs.acfstest1.acfs - Can use this resource to create dependencies to other resources srvctl start filesystem -d /dev/asm/acfstest1-219 - Mounts file system on all nodes ACFSUTIL registration also possible but then cannot create resource dependencies
  • 21. Monitoring ACFS • crsctl status resource ora.swe1mc1acfs.acfstest1.acfs –t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.swe1mc1acfs.acfstest1.acfs ONLINE ONLINE jfadbmc1n01 mounted on /instanc e/acfstest1 ONLINE ONLINE jfadbmc1n02 mounted on /instanc e/acfstest1 ONLINE ONLINE jfadbmc1n03 mounted on /instanc e/acfstest1 ONLINE ONLINE jfadbmc1n04 mounted on /instanc e/acfstest1
  • 22. Licensing Oracle Clusterware for High Availability is included in Oracle Linux Basic and Premier Support Quote from “Oracle® Database Licensing Information 11g Release 2 (11.2)” - Use of Oracle ADVM and Oracle ACFS's base functionality (i.e., excluding the below-listed advanced functionality) is free for all data types, including non-Oracle files. - Use of Oracle ACFS's advanced functionality requires the Cloud File System license. The advanced functionality consists of snapshots, replication, tagging, realm-based security, encryption, and auditing. - Oracle will provide support for ACFS/ADVM only if the server is running an Oracle product, which may include Oracle Linux or Oracle Solaris, that is also under Oracle support.
  • 23. ACFS vs OCFS2 OCFS2 advantages - OCFS2 is part of Linux kernel and open source - OCFS2 is very easy to set up - Does not require Oracle Grid Infrastructure OCFS2 disadvantages - When running with Oracle GI it still requires separate cluster setup - In my experience unreliable – multiple times corrupted data during online resizing, crashes, global locks
  • 24. Using Oracle GI for MySQL
  • 25. Our MySQL environment 20+ different applications - Maintained by different application teams - Different requirements to the database – for example settings, versions Each application only uses its own databases Databases - 80 in production, ~400 in test
  • 26. Our old setup 3 master-master MySQL replication configurations - Using MySQL built-in replication One instance per server
  • 27. Using Oracle GI for MySQL Divided databases into business-logical instance “groupings” - 13 in production, 38 in test - Instances can run different RDBMS versions - Each instance has dedicated VIP, clients use this VIP to connect One ACFS file system per MySQL instance - Mounted read-write on all cluster nodes 3 physical servers in production, 3 in test
  • 28. Oracle Grid Infrastructure Standalone Agents - XAG Oracle provided and supported management scripts for - GoldenGate - Siebel - Apache HTTP Server - Apache Tomcat - Peoplesoft - MySQL Using it for MySQL requires MySQL Enterprise Edition subscription Supported for MySQL 5.6+ Usage through agctl
  • 29. XAG script for MySQL Written in Perl - agmysqlas.pm Start - mysqld_safe --basedir=$mysql_home --datadir=$datadir & Stop - mysqladmin shutdown Check - mysqladmin status
  • 30. Custom scripts - My script suite I wrote scripts in bash to help manage MySQL under Oracle clusterware - https://github.com/ilmarkerm/mysql-with-oracle-clusterware-scripts Tested with MySQL 5.1, 5.5, 5.6 both community and enterprise - Under RHEL/OEL 5 and 6 Important scripts in this suite: - mysql_handler.sh - Action script, must be symlinked to instancename.scr - instances.sh - Configuration, lists all configured instances - init_mysql_db.sh and init_grid.sh - Create new MySQL instance and add resources to GI - mysql_logrotate.sh - Rotates general/error/slow logs for all instances using logrotate
  • 32. Recommended directory structure /instance/<instance name>/ - MySQL instance home directory containing: - data/ - mysql data directory - config/my.cnf – mysql instance configuration file - logs/ - directory where mysql stores its log files /u02/app/mysql/ - Containing the script suite /u02/app/mysql/product/<version>/ - MySQL RDBMS binaries – use the TAR version /root/.my.cnf - Default MySQL root password
  • 33. init_mysql_db.sh This script initializes MySQL data directory and all cluster scripts. Script must be run as user root. Usage: -i name Instance name. Name should be 20 characters or less and only characters a-z, A-Z, 0-9 and _ are allowed (w character class) MySQL and instance settings: -s directory MySQL software location (where tar-edition is unpacked) -b ipaddr IP address to bind the instance -a basedirectory Instance base directory, this replaces options -d -c -l by setting the following values -d basedirectory/data, -c basedirectory/config/my.cnf, -l basedirectory/logs
  • 34. init_mysql_db.sh (continued) • ./init_mysql_db.sh -i acfstest1 -b 10.69.136.250 -s /u02/app/mysql/product/5.6.16 -a /instance/acfstest1 Installing MySQL system tables...2014-02-17 14:05:21 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for more details). 2014-02-17 14:05:21 20845 [Note] InnoDB: Using atomics to ref count buffer pool pages 2014-02-17 14:05:21 20845 [Note] InnoDB: The InnoDB memory heap is disabled … Starting MySQL... Creating 'clusterware'@'localhost' user... Changing root password... Stopping MySQL... Updating cluster configuration /u02/app/mysql/instances.sh... Symlinking actionscript acfstest1.scr...
  • 35. init_grid.sh • ./init_grid.sh -i acfstest1 -t mysql_instance -p Generic Instance name=acfstest1 GRID_USER=grid GRID_HOME=/u01/app/grid/product/11.2.0.4/grid Virtual IP=10.69.136.250 Production Copyright 2007, 2008, Oracle.All rights reserved … Configuration done! Use the following command to start MySQL instance: /u01/app/grid/product/11.2.0.4/grid/bin/crsctl start resource acfstest1
  • 36. instances.sh # This script is just configuration file, it contains some general parameters and the # configuration for all MySQL instances # MySQL OS process owner MYSQLUSER=mysql # MYSQL_DB_USER MYSQL_DB_PASSWORD - Credentials to log in to mysql (check) # MYSQL_DB_USER MYSQL_DB_PASSWORD - Credentials to log in to mysql MYSQL_DB_USER="clusterware" MYSQL_DB_PASSWORD="cluster123" LOCKDIR=/u02/app/mysql/locks acfstest1=( DATADIR="/instance/acfstest1/data" CONFFILE="/instance/acfstest1/config/my.cnf" BINDADDR="10.69.136.250" SOFTWARE="/u02/app/mysql/product/5.6.16" LOGDIR="/instance/acfstest1/logs" )
  • 37. mysql_handler.sh Clusterware action script implementation Must be symlinked to <instance name>.scr for each instance - Only execute the symlinked scr file Implemented actions: - start – start mysqld (without mysqld_safe) - stop – send TERM to mysqld - check – executes “mysqladmin ping” through socket - clean – if mysqld still alive send KILL When executed without parameters opens MySQL CLI through socket
  • 38. mysql_handler.sh (continued) • ./acfstest1.scr check Exit value: 0 • ./acfstest1.scr Usage: ./mysql_handler.sh {start|stop|restart|check|clean}. All other arguments execute MySQL Console. Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 42 … Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql>
  • 39. Additional HA developments In order to address planned maintenance (some DDL in MySQL still blocking) - Build traditional MySQL slave instance and start using MySQL Fabric - While primary database is under maintenance, slave serves the client connections MySQL Fabric node (with backing store) can also be set up as clusterware resources - Handles configuration and communication with drivers MySQL driver is fabric aware
  • 40. Contact info and links https://github.com/ilmarkerm/mysql-with-oracle-clusterware-scripts Email: [email protected] Twitter: https://twitter.com/ilmarkerm LinkedIn: https://ee.linkedin.com/pub/ilmar-kerm/41/570/428/ Blog: https://ilmarkerm.eu

Editor's Notes

  • #6: How typical Oracle GI setup looks like, with Oracle RAC Public network – network where clients get access the resources over VIP (virtual IP) Interconnect – Private network dedicated for clusterware internal communication Shared storage – Storage (SAN/NAS) that is accessible by all cluster nodes
  • #7: Protection against hardware/OS failures Each application has its own dedicated virtual IP (VIP) resource and action script for controlling that application Application must bind itself only to its own VIP, not to all network interfaces Oracle provides bundled agents for GoldenGate, Siebel, Apache HTTP server and Tomcat.
  • #8: Cluster resource – fails over to other servers Local resource – runs in each server in cluster, pinned to server, no failover START dependencies: Hard – another resource must be running before (on the same node by default) Weak – if A has weak dependency to B, then when starting A clusterware also attempts to start B, but it has no consequence to the starting of resource A Attraction – clusterware prefers to place the resources to the same node Pullup – resource B (if it is not running already) must be automatically started when resource A starts Dispersion – clusterware prefers not to run resources on the same node STOP dependencies: Hard – In resource A has hard dependency to B, then A must be stopped when B is stopped
  • #9: LOAD is only used, when PLACEMENT=balanced PLACEMENT=balanced, favored or restricted
  • #10: START, STOP, CHECK, CLEAN are mandatory actions START – bring resource online STOP – gracefully bring down resource CHECK – health of the resource CLEAN – clean up resource after non-graceful operation ABORT – called if any other actions hang
  • #11: Clusterware acts differently for different CHECK exit codes – for example when application is PLANNED OFFLINE it will not be automatically restarted
  • #12: Bold red – script output
  • #17: There can be only one filesystem per ADVM volume, do not partition the ADVM volume
  • #18: ACFS is supported on Linux (OEL, RHEL, SLES), Windows, Solaris and AIX.
  • #21: ASMCA GUI also possible ASMCMD commands ls – displays diskgroups volcreate – creates new ADVM volume, visible as block device under /dev/asm/ mkfs.acfs – formats ADVM volume as ACFS, must be run as root
  • #22: Cannot add file system to /etc/fstab, because it requires GI to be started first, after then can mount ACFS.
  • #25: Separate cluster – has its own rules for cluster membership, can reboot nodes
  • #28: Advantages – Easy to switch servers Problems – sometimes replication “broke” so it broke for everyone within that “cluster”; Sometimes app/developer modified the data on wrong node; hard to upgrade RDBMS version
  • #29: Why? high availability without going to data replication! data replication can miss data - scary to oracle dba-s 
  • #34: /u02 is clustered shared filesystem mounted on all nodes Instance configuration file config/my.cnf cannot contain the following parameters (they are handled by the script suite): datadir bind_address socket pid-file log-error slow-query-log-file general-log-file
  • #36: Executes mysql_install_db to create mysql instance, adds created instance information to instances.sh and then executed init_grid.sh to create GI resources