SlideShare a Scribd company logo
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
MySQL Shell:
the daily tool
for devs
and admins
Vittorio Cioe
MySQL Sr. Sales Consultant
vittorio.cioe@oracle.com
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied
upon in making purchasing decisions. The development, release, and timing of any
features or functionality described for Oracle’s products remains at the sole discretion of
Oracle.
2
whoami
•Used MySQL since 2006
•Working at Oracle/MySQL since 2017, covering Eastern Europe
•Previously working in the Security and Digital Transformation
(API) space
•From Italy but based in Warsaw
•Love movies, travelling, cooking...
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Agenda
4
Intro: state of the dolphin
MySQL Shell overview
MySQL Shell and NoSQL: XDev API
MySQL Shell and HA: Admin API for InnoDB Cluster
Summary
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Intro:
State of the dolphin
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
#1 MySQL is the #1 database for
the web, used by 10 of the top
10 websites
6Oracle Confidential – Authorized Partner Internal Use Only
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Authorized Partner Internal Use Only 7
Most popular open source
relational database*
*according to db-engines.com
Most popular database
behind only Oracle DB*
*according to db-engines.com
By 2022, more than 70% of
new in-house applications
will be developed on an
Open Source RDBMS
By 2022, 50% of commercial
RDBMS instances will have
been converted to open
source DBs
MySQL Facts & Figures
#1 #2
70% 50%
Source: Gartner, State of Relational Open Source RDBMSs 2018 Source: Gartner, State of Relational Open Source RDBMSs 2018
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL Innovation: 5.7 -> 8.0
- 3x Better Performance
- Replication Enhancements
- Optimizer Cost Model
- JSON Support
- Improved Security
- Sys & Performance Schema
- GIS
MySQL 5.7
MySQL InnoDB Cluster
- MySQL Group Replication
- MySQL Router
- MySQL Shell
MySQL 8.0
- 2x Better Performance
- NoSQL Document Store
- JSON
- CTEs
- Window Functions
- Data Dictionary
- InnoDB
- Replication
- Roles
- Unicode
- GIS
2 Years in Development
400+ Worklogs
5000+ Bugs Fixed
500 New Tests
GA
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL Community
Edition
MySQL Enterprise
Edition
MySQL Database •MySQL Database
•Advanced Features
•Management Tools
•24x7 Support
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
MySQL shell overview
MySQLShell: Introduction
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
11
•Interactive multi-language console interface that supports
development and administration for the MySQLServer
•Canbe used to perform data queries or updates, and
administration operations:
Scriptable “DevOps” APIs
Unified Interface for MySQLDevelopers and DBAs:one tool!
•Intuitive and easy to use
1.0
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
12
•Supports MySQLServer
5.7
8.0
Supports MySQLServer 5.7 and
8.0
Higly recommended version!
Note: Upgrade to 8.0 right
awayif you’re still using 1.0
MySQLShell:
Versions
MySQLShell: Goal
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
13
•One tool for MySQLdevelopment and administrative
tasks
•Natural interface for all MySQLrelated ”DevOps”!
–Unified Interface for Developers and DBAs
•Intuitive, flexible and powerful
•Provides scripting with development and
administrative APIs
Copyright @ 2018 Oracle and/or its affiliates. All right
MySQL
Server 5.7
MySQL 8.0
Upgrade Checker
Prompt Themes
Auto Completion
&
Command History
MySQL
Server 8.0
Document Store
X DevAPI
InnoDB ClusterSQL CLI
Output Formats
(Table, JSON, Tabbed)
Batch Execution
JavaScript
Python
SQL
MySQLShell: Architecture
MySQLShell: Features
•Multi-language support
– JavaScript, Python and SQL
– Both interactive and batch operations MySQL
Developme
nt
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
15
MySQLShell: Features
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
16
Scripting
•Support for scripting in Python and JavaScript
•APIsfor MySQLDBs,Document Store, InnoDB cluster, Shell and
more
•Import any installed module (in Python)
•Execute scripts from
– Interactive REPLinterface (interactive interpreter)
– Directly from the commandline
•mysqlsh --py –e "print 'Hello world'"
– From Python, JS,SQLscriptfiles
MySQLShell: Features
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
17
Scripting – Globals
•session
– Assigned to the DBsession when the shell connects to
MySQL
– The MySQLsession used by the Shell in SQLmode
– Execute queries
mysql-js> session.query(“show status”);
MySQLShell: Features
Scripting – Examples
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
18
•Connect to myserver.foo.com
•Execute create_account.js with any extra arguments forwarded
to the script (sys.argv[])
•The script can use the session global variable to execute SQLin
the target server
$ mysqlsh root@myserver.foo.com –f create_account.js appuser@’192.168.%.%’
MySQLShell: Features
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
19
Other development APIs
•mysql
– mysql.getSession(), etc.
– Connects to MySQLserver using classic MySQL
protocol
– run SQLqueries
– mysqlx for Xprotocol sessions and XDevAPI
MySQLShell: Features
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
20
Other development APIs
•shell
– Programmatic access to most shellfeatures
– Configuration options (option)
– Password Manager API
– Pager API (pager)
– logging
– URI parsing
– Prompting for userinput
– Establish connections:
shell.connect(‘user@host:port’)
MySQLShell: Features
•Shell Utilities: util object
– Upgrade checker
•Verify whether instances are ready for upgrading to
MySQL8
– Import JSONdocuments
•From a file or standard input to a MySQLServer
•Supports importing to a collection orrelational table
mysql-js> util.checkForServerUpgrade(“root@localhost:3306”);
MySQL
Administrati
on
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
21
MySQLShell: Features
•API Command line integration
– New cmdline syntax to invoke built-in Shellcommands
– Requires minimal extra typing, quoting andescaping
– Supported objects: dba, cluster, shell,shell.options and
util
Syntax: mysqlsh [OPTIONS] [URI] --<object_name> <method_name> [argument_list]
$ mysqlsh root@myserver:33060 –- util import-json
~/Downloads/myData/data.json --collections=‘zip codes’ --schema=‘json_test’
MySQL
Administrati
on
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
22
MySQLShell: Features (DBA toolbox)
Customizable Prompts
•Display context information
•Custom/dynamic tags that react to context
– export PRODUCTION_SERVERS=192.168.42.16
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
23
MySQLShell: Features (DBA toolbox)
Customizable Prompts
•Sample prompt file:
– mysql-shell/share/mysqlsh/prompt/
•Customization instructions:
– mysql-shell/share/mysqlsh/prompt/README
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
24
MySQLShell: Features (DBA toolbox)
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
25
Secure Credential Manager
•MySQLserver passwords can be queried from a secure password
store
•Usesexisting OSnative password storage APIs
– Keychain (macOS)
– Credential Manager (Windows)
– MySQLlogin-path encrypted files (all)
•Optionally auto-save typed passwords (default will prompt)
•Or use APIto store programmatically
– shell.storeCredential("root@192.168.1.32","s3cr37!");
•Write your own password store backend
MySQLShell: Features (DBA toolbox)
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
26
History
•Typed command history
•Persisting disabled by default, enable with
– option history.autoSave=true
•Filter SQL statements that may contain
sensitiveinfo
– e.g. SETPASSWORD='my password'
– option history.sql.ignorePattern
MySQLShell: Features (DBA toolbox)
Pager
•PassSQLresults through an external screen paging
program
– pager less
– showstatus;
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
27
MySQLShell: Features (DBA toolbox)
Built-in Help
•Documentation for included APIs, shell commands,
SQL, etc.
•help keyword
– (wildcardsallowed)
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
28
Shell meets continuous automation
•Continuous automation frameworks provide mechanisms
for setup, configuration and management of MySQL
Server
•DBAcan automate operations by usingmodules.
•Classic example:
Ensure MySQLServer deployments use the latest available version
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
29
Shell meets continuous automation
Let’s use asan example using
MySQLShell upgrade checker:
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
30
service { ‘mysql’: ensure => latest, enable => true,
require => Package[‘mysql-server-community’], before => Exec [‘upgrade
checker’]
}
exec { “upgrade checker”:
command => “mysqlsh -- util check-for-server-upgrade { --user=root --
host=localhost --port=3306} --password=‘myPwd’”
require => Service[“mysqlsh”]
}
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
MySQL Shell
and NoSQL:
XDev API
MySQLShell: Features
•Document and Relational models
– Supports the classic relational model
– Modern fluent APIfor the MySQLDocumentStore
•CRUDand Relational
– Supports the traditional Table results, aswell as
JSONor Tabseparated output
MySQL
Developme
nt
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
32
35 / 112
MySQL Document Store
Copyright @ 2018 Oracle and/or its affiliates. All right
MySQL Document Store: Architecture
Copyright @ 2018 Oracle and/or its affiliates. All right
MySQLShell: Features
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
35
Document Store – X DevAPI
•Support for MySQLDocument Store API
•Create collections
•Import JSONdumps
•Try out queries and write simple scripts interactively
•XDevAPI CRUDoperations
•SQL
MySQLShell: Features
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
36
Document Store – X DevAPI Examples
•Operations on collections:
– collection.add()
– collection.find()
– collection.remove()
– collection.modify()
– ...and much more..
•Operations on tables:
– table.insert()
– table.select()
– table.update()
– table.delete()
– ...and much more..
•Session Operations:
– session.create|drop.schema()
– session.StartTransaction()
– session.commit()|rollback()
– session.getSchemas()
– ...and much more..
•Operations on schemas:
– schema.getTable()
– schema.getCollection()
– schema.dropTable()
– schema.dropCollection()
– ...and much more..
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
MySQL Shell
and HA:
Admin API
for InnoDB Cluster
MySQLInnoDB Cluster:
Vision
“Asingleproduct— MySQL — withhigh availabilityand scaling features
bakedin;providingan integratedend-to-endsolution thatiseasy touse.”
– Engineering Team
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
38
MySQLInnoDB Cluster: Background
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
39
•High Availability: critical
factor
•Replication asa common
solution
•MySQLhas support for:
– Classic master-slave
replication
– DRBDS
– Other OSor VMsolutions…
Group Replication !
•Update-everywhere (m-m)
•Virtually synchronous
replication
•Automatic server fail-over
– Distributed recovery
– Group reconfiguration
•Powered by a GCS:
Implementation of Paxos
MySQLInnoDB Cluster: Background
•Challenging task
– Not easy to setup andmaintain
– Technical knowledge needed
– How to configure the
applications?
– How to integrate all the
components?
? ?
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
40
MySQLGroup Replication
InnoDB cluster
App Servers with
MySQL Router
MySQLShell
Setup,
Manage,
Orchestrate
Clients
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
41
MySQLShell: Features
•Administration API: AdminAPI
– Creation and Management of InnoDB
Clusters
– Hides the complexity of:
•Configuration
•Provisioning
•Orchestration
– Simple and straight-forward
– Doesn’t require MySQLexpertise
– Flexible, powerful and secure
– Available in both JavaScript andPython
MySQL
Administrati
on
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
42
MySQLShell: Features
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
43
AdminAPI - options
--cluster
• Prepares the Shell for managing the InnoDB cluster the target server
belongs to
•Automatically assigns the cluster global variable
--redirect-primary
• Connects the shell to the primary of the InnoDB cluster group, in case
the one we connect to is asecondary
--redirect-secondary
• Connects the shell to a secondary member of the InnoDB cluster group
MySQLShell: Features
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
44
AdminAPI - Create and Manage
•Deploy and manage InnoDBCuster:
– dba.configureInstance()
– dba.createCluster()
– dba.getCluster()
– dba.rebootClusterFromCompleteOutage()
– ...and much more...
•Manage InnoDBCuster:
– cluster.addInstance()
– cluster.removeInstance()
– cluster.rejoinInstance()
– cluster.status()
– ...and much more...
MySQLShell: Features
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
45
AdminAPI - Sandboxes
•Deploy and manage MySQL sandboxes:
– dba.deploySandboxInstance()
– dba.stopSandboxInstance()
– dba.startSandboxInstance()
– dba.deleteSandboxInstance()
– dba.killSandboxInstance()
Important: Sandbox instances are only suitable for testing
purposes!
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Summary
Summary
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
47
•MySQLShell brings together developers andDBAs
• Unified interface: one tool!
• Development and Administration APIsand features
•MySQLInnoDB Cluster is THEbuilt-in HAsolution for MySQL:
• Full-stack: High Availability out-of-the-box
• Acces to data SQL + NoSQL
• Easyto use: usability asa topconcern
Resources
Copyright © 2018, Oracle and/or its affiliates. All rights
reserved. |
48
•MySQLShellUserguide:
– https://dev.mysql.com/doc/refman/en/mysql-shell.html
•MySQLInnoDB ClusterUserguide:
– http://dev.mysql.com/doc/refman/en/mysql-innodb-cluster-userguide.html
•APIsReference manuals
– JavaScript: https://dev.mysql.com/doc/dev/mysqlsh-api-javascript/
– Python: https://dev.mysql.com/doc/dev/mysqlsh-api-python/
•Blogging
– http://mysqlserverteam.com/category/high-availability
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.

More Related Content

What's hot (20)

PDF
F5 OpenShift Workshop
Tyler Hatton
 
PDF
ОЛЕКСАНДР ЛИПКО «Graceful Shutdown Node.js + k8s» Online WDDay 2021
WDDay
 
PDF
FaSilET² full end-to-end testing solution presented at OW2con'19, June 12-13,...
OW2
 
PPTX
Building microservice for api with helidon and cicd pipeline
DonghuKIM2
 
PPTX
Api design and prototype
DonghuKIM2
 
PDF
Porion a new Build Manager
Stephane Carrez
 
PPTX
Advanced coding & deployment for Cisco Video Devices - CL20B - DEVNET-3244
Cisco DevNet
 
PPTX
Alfresco Tech Talk Live 106
Angel Borroy López
 
PPT
IstioD - From Microservices to Monolithic
All Things Open
 
PPTX
Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...
mfrancis
 
PDF
MongoDB.local DC 2018: MongoDB Ops Manager + Kubernetes
MongoDB
 
PDF
Leveraging CI/CD to improve open stack operation
María Angélica Bracho
 
PDF
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB
 
PDF
Service Discovery. Spring Cloud Internals
Aleksandr Tarasov
 
PPTX
Cloud nativemicroservices jax-london2020
Emily Jiang
 
PPT
Docker in the Wild
Chris Mague
 
PDF
Docker In the Bank
Aleksandr Tarasov
 
PDF
Monitoring OSGi Applications with the Web Console - Carsten Ziegeler
mfrancis
 
PPTX
Dockercon2015_paypal
ahunnargikar
 
PPTX
OpenShift Introduction
Red Hat Developers
 
F5 OpenShift Workshop
Tyler Hatton
 
ОЛЕКСАНДР ЛИПКО «Graceful Shutdown Node.js + k8s» Online WDDay 2021
WDDay
 
FaSilET² full end-to-end testing solution presented at OW2con'19, June 12-13,...
OW2
 
Building microservice for api with helidon and cicd pipeline
DonghuKIM2
 
Api design and prototype
DonghuKIM2
 
Porion a new Build Manager
Stephane Carrez
 
Advanced coding & deployment for Cisco Video Devices - CL20B - DEVNET-3244
Cisco DevNet
 
Alfresco Tech Talk Live 106
Angel Borroy López
 
IstioD - From Microservices to Monolithic
All Things Open
 
Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...
mfrancis
 
MongoDB.local DC 2018: MongoDB Ops Manager + Kubernetes
MongoDB
 
Leveraging CI/CD to improve open stack operation
María Angélica Bracho
 
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB
 
Service Discovery. Spring Cloud Internals
Aleksandr Tarasov
 
Cloud nativemicroservices jax-london2020
Emily Jiang
 
Docker in the Wild
Chris Mague
 
Docker In the Bank
Aleksandr Tarasov
 
Monitoring OSGi Applications with the Web Console - Carsten Ziegeler
mfrancis
 
Dockercon2015_paypal
ahunnargikar
 
OpenShift Introduction
Red Hat Developers
 

Similar to MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe. (20)

PDF
MySQL Shell: The DevOps Tool for MySQL
Miguel Araújo
 
PDF
MySQL Shell - The Best MySQL DBA Tool
Miguel Araújo
 
PDF
MySQL Shell for DBAs
Frederic Descamps
 
PDF
MySQL Shell: the best DBA tool !
Frederic Descamps
 
PDF
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
Miguel Araújo
 
PDF
MySQL Shell - the best DBA tool !
Frederic Descamps
 
PDF
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
Frederic Descamps
 
PDF
MySQL Shell - the best DBA tool ?
Frederic Descamps
 
PDF
UAE MySQL Users Group Meet-up : MySQL Shell Document Store & more...
Frederic Descamps
 
PDF
20201106 hk-py con-mysql-shell
Ivan Ma
 
PDF
MySQL InnoDB Cluster in a Nutshell - Hands-on Lab
Frederic Descamps
 
PDF
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
Dave Stokes
 
PDF
MySQL
PT.JUG
 
PPTX
MySQL Quick Dive
Sudipta Kumar Sahoo
 
PDF
MySQL 8.0 : High Availability Solution for Everybody
Frederic Descamps
 
PPTX
MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...
OracleMySQL
 
PDF
MySQL Technology Overview
Keith Hollman
 
PPTX
2018: State of the Dolphin, MySQL Keynote at Percona Live Europe 2018, Frankf...
Geir Høydalsvik
 
PDF
MySQL 8: Ready for Prime Time
Arnab Ray
 
PDF
MySQL Day Paris 2018 - Introduction & The State of the Dolphin
Olivier DASINI
 
MySQL Shell: The DevOps Tool for MySQL
Miguel Araújo
 
MySQL Shell - The Best MySQL DBA Tool
Miguel Araújo
 
MySQL Shell for DBAs
Frederic Descamps
 
MySQL Shell: the best DBA tool !
Frederic Descamps
 
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
Miguel Araújo
 
MySQL Shell - the best DBA tool !
Frederic Descamps
 
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
Frederic Descamps
 
MySQL Shell - the best DBA tool ?
Frederic Descamps
 
UAE MySQL Users Group Meet-up : MySQL Shell Document Store & more...
Frederic Descamps
 
20201106 hk-py con-mysql-shell
Ivan Ma
 
MySQL InnoDB Cluster in a Nutshell - Hands-on Lab
Frederic Descamps
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
Dave Stokes
 
MySQL
PT.JUG
 
MySQL Quick Dive
Sudipta Kumar Sahoo
 
MySQL 8.0 : High Availability Solution for Everybody
Frederic Descamps
 
MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...
OracleMySQL
 
MySQL Technology Overview
Keith Hollman
 
2018: State of the Dolphin, MySQL Keynote at Percona Live Europe 2018, Frankf...
Geir Høydalsvik
 
MySQL 8: Ready for Prime Time
Arnab Ray
 
MySQL Day Paris 2018 - Introduction & The State of the Dolphin
Olivier DASINI
 
Ad

More from Cloud Native Day Tel Aviv (20)

PDF
Cloud Native is a Cultural Decision. By Reshef Mann
Cloud Native Day Tel Aviv
 
PDF
Container Runtime Security with Falco, by Néstor Salceda
Cloud Native Day Tel Aviv
 
PDF
Kafka Mirror Tester: Go and Kubernetes Powered Test Suite for Kafka Replicati...
Cloud Native Day Tel Aviv
 
PDF
Running I/O intensive workloads on Kubernetes, by Nati Shalom
Cloud Native Day Tel Aviv
 
PDF
WTF Do We Need a Service Mesh? By Anton Weiss.
Cloud Native Day Tel Aviv
 
PDF
Update Strategies for the Edge, by Kat Cosgrove
Cloud Native Day Tel Aviv
 
PDF
Building a Cloud-Native SaaS Product The Hard Way. By Arthur Berezin
Cloud Native Day Tel Aviv
 
PDF
The Four Questions (Every Monitoring Engineer gets asked), by Leon Adato
Cloud Native Day Tel Aviv
 
PDF
K8s Pod Scheduling - Deep Dive. By Tsahi Duek.
Cloud Native Day Tel Aviv
 
PDF
Cloud Native: The Cattle, the Pets, and the Germs, by Avishai Ish-Shalom
Cloud Native Day Tel Aviv
 
PDF
Cloud native transformation patterns, by Pini Reznik
Cloud Native Day Tel Aviv
 
PPTX
Cloud and Edge: price, performance and privacy considerations in IOT, by Tsvi...
Cloud Native Day Tel Aviv
 
PDF
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Cloud Native Day Tel Aviv
 
PDF
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...
Cloud Native Day Tel Aviv
 
PDF
Not my problem! Delegating responsibilities to the infrastructure - Yshay Yaa...
Cloud Native Day Tel Aviv
 
PDF
Brain in the Cloud: Machine Learning on OpenStack & Kubernetes Done Right - E...
Cloud Native Day Tel Aviv
 
PPTX
A stateful application walks into a Kubernetes bar - Arthur Berezin, JovianX ...
Cloud Native Day Tel Aviv
 
PPTX
The story of how KubeMQ was born - Oz Golan, KubeMQ - Cloud Native Day Tel Av...
Cloud Native Day Tel Aviv
 
PPTX
I want it all: go hybrid - Orit Yaron, Outbrain - Cloud Native Day Tel Aviv 2018
Cloud Native Day Tel Aviv
 
PPTX
Keeping I.T. Real - Aaron Wolf, Mathematics and computer programming teacher,...
Cloud Native Day Tel Aviv
 
Cloud Native is a Cultural Decision. By Reshef Mann
Cloud Native Day Tel Aviv
 
Container Runtime Security with Falco, by Néstor Salceda
Cloud Native Day Tel Aviv
 
Kafka Mirror Tester: Go and Kubernetes Powered Test Suite for Kafka Replicati...
Cloud Native Day Tel Aviv
 
Running I/O intensive workloads on Kubernetes, by Nati Shalom
Cloud Native Day Tel Aviv
 
WTF Do We Need a Service Mesh? By Anton Weiss.
Cloud Native Day Tel Aviv
 
Update Strategies for the Edge, by Kat Cosgrove
Cloud Native Day Tel Aviv
 
Building a Cloud-Native SaaS Product The Hard Way. By Arthur Berezin
Cloud Native Day Tel Aviv
 
The Four Questions (Every Monitoring Engineer gets asked), by Leon Adato
Cloud Native Day Tel Aviv
 
K8s Pod Scheduling - Deep Dive. By Tsahi Duek.
Cloud Native Day Tel Aviv
 
Cloud Native: The Cattle, the Pets, and the Germs, by Avishai Ish-Shalom
Cloud Native Day Tel Aviv
 
Cloud native transformation patterns, by Pini Reznik
Cloud Native Day Tel Aviv
 
Cloud and Edge: price, performance and privacy considerations in IOT, by Tsvi...
Cloud Native Day Tel Aviv
 
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Cloud Native Day Tel Aviv
 
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...
Cloud Native Day Tel Aviv
 
Not my problem! Delegating responsibilities to the infrastructure - Yshay Yaa...
Cloud Native Day Tel Aviv
 
Brain in the Cloud: Machine Learning on OpenStack & Kubernetes Done Right - E...
Cloud Native Day Tel Aviv
 
A stateful application walks into a Kubernetes bar - Arthur Berezin, JovianX ...
Cloud Native Day Tel Aviv
 
The story of how KubeMQ was born - Oz Golan, KubeMQ - Cloud Native Day Tel Av...
Cloud Native Day Tel Aviv
 
I want it all: go hybrid - Orit Yaron, Outbrain - Cloud Native Day Tel Aviv 2018
Cloud Native Day Tel Aviv
 
Keeping I.T. Real - Aaron Wolf, Mathematics and computer programming teacher,...
Cloud Native Day Tel Aviv
 
Ad

Recently uploaded (20)

PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
July Patch Tuesday
Ivanti
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
July Patch Tuesday
Ivanti
 

MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.

  • 1. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | MySQL Shell: the daily tool for devs and admins Vittorio Cioe MySQL Sr. Sales Consultant [email protected]
  • 2. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. whoami •Used MySQL since 2006 •Working at Oracle/MySQL since 2017, covering Eastern Europe •Previously working in the Security and Digital Transformation (API) space •From Italy but based in Warsaw •Love movies, travelling, cooking... Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
  • 4. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Agenda 4 Intro: state of the dolphin MySQL Shell overview MySQL Shell and NoSQL: XDev API MySQL Shell and HA: Admin API for InnoDB Cluster Summary
  • 5. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Intro: State of the dolphin
  • 6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | #1 MySQL is the #1 database for the web, used by 10 of the top 10 websites 6Oracle Confidential – Authorized Partner Internal Use Only
  • 7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Authorized Partner Internal Use Only 7 Most popular open source relational database* *according to db-engines.com Most popular database behind only Oracle DB* *according to db-engines.com By 2022, more than 70% of new in-house applications will be developed on an Open Source RDBMS By 2022, 50% of commercial RDBMS instances will have been converted to open source DBs MySQL Facts & Figures #1 #2 70% 50% Source: Gartner, State of Relational Open Source RDBMSs 2018 Source: Gartner, State of Relational Open Source RDBMSs 2018
  • 8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL Innovation: 5.7 -> 8.0 - 3x Better Performance - Replication Enhancements - Optimizer Cost Model - JSON Support - Improved Security - Sys & Performance Schema - GIS MySQL 5.7 MySQL InnoDB Cluster - MySQL Group Replication - MySQL Router - MySQL Shell MySQL 8.0 - 2x Better Performance - NoSQL Document Store - JSON - CTEs - Window Functions - Data Dictionary - InnoDB - Replication - Roles - Unicode - GIS 2 Years in Development 400+ Worklogs 5000+ Bugs Fixed 500 New Tests GA
  • 9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | MySQL Community Edition MySQL Enterprise Edition MySQL Database •MySQL Database •Advanced Features •Management Tools •24x7 Support
  • 10. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | MySQL shell overview
  • 11. MySQLShell: Introduction Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 11 •Interactive multi-language console interface that supports development and administration for the MySQLServer •Canbe used to perform data queries or updates, and administration operations: Scriptable “DevOps” APIs Unified Interface for MySQLDevelopers and DBAs:one tool! •Intuitive and easy to use
  • 12. 1.0 Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 12 •Supports MySQLServer 5.7 8.0 Supports MySQLServer 5.7 and 8.0 Higly recommended version! Note: Upgrade to 8.0 right awayif you’re still using 1.0 MySQLShell: Versions
  • 13. MySQLShell: Goal Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 13 •One tool for MySQLdevelopment and administrative tasks •Natural interface for all MySQLrelated ”DevOps”! –Unified Interface for Developers and DBAs •Intuitive, flexible and powerful •Provides scripting with development and administrative APIs
  • 14. Copyright @ 2018 Oracle and/or its affiliates. All right MySQL Server 5.7 MySQL 8.0 Upgrade Checker Prompt Themes Auto Completion & Command History MySQL Server 8.0 Document Store X DevAPI InnoDB ClusterSQL CLI Output Formats (Table, JSON, Tabbed) Batch Execution JavaScript Python SQL MySQLShell: Architecture
  • 15. MySQLShell: Features •Multi-language support – JavaScript, Python and SQL – Both interactive and batch operations MySQL Developme nt Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 15
  • 16. MySQLShell: Features Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 16 Scripting •Support for scripting in Python and JavaScript •APIsfor MySQLDBs,Document Store, InnoDB cluster, Shell and more •Import any installed module (in Python) •Execute scripts from – Interactive REPLinterface (interactive interpreter) – Directly from the commandline •mysqlsh --py –e "print 'Hello world'" – From Python, JS,SQLscriptfiles
  • 17. MySQLShell: Features Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 17 Scripting – Globals •session – Assigned to the DBsession when the shell connects to MySQL – The MySQLsession used by the Shell in SQLmode – Execute queries mysql-js> session.query(“show status”);
  • 18. MySQLShell: Features Scripting – Examples Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 18 •Connect to myserver.foo.com •Execute create_account.js with any extra arguments forwarded to the script (sys.argv[]) •The script can use the session global variable to execute SQLin the target server $ mysqlsh [email protected] –f create_account.js appuser@’192.168.%.%’
  • 19. MySQLShell: Features Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 19 Other development APIs •mysql – mysql.getSession(), etc. – Connects to MySQLserver using classic MySQL protocol – run SQLqueries – mysqlx for Xprotocol sessions and XDevAPI
  • 20. MySQLShell: Features Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 20 Other development APIs •shell – Programmatic access to most shellfeatures – Configuration options (option) – Password Manager API – Pager API (pager) – logging – URI parsing – Prompting for userinput – Establish connections: shell.connect(‘user@host:port’)
  • 21. MySQLShell: Features •Shell Utilities: util object – Upgrade checker •Verify whether instances are ready for upgrading to MySQL8 – Import JSONdocuments •From a file or standard input to a MySQLServer •Supports importing to a collection orrelational table mysql-js> util.checkForServerUpgrade(“root@localhost:3306”); MySQL Administrati on Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 21
  • 22. MySQLShell: Features •API Command line integration – New cmdline syntax to invoke built-in Shellcommands – Requires minimal extra typing, quoting andescaping – Supported objects: dba, cluster, shell,shell.options and util Syntax: mysqlsh [OPTIONS] [URI] --<object_name> <method_name> [argument_list] $ mysqlsh root@myserver:33060 –- util import-json ~/Downloads/myData/data.json --collections=‘zip codes’ --schema=‘json_test’ MySQL Administrati on Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 22
  • 23. MySQLShell: Features (DBA toolbox) Customizable Prompts •Display context information •Custom/dynamic tags that react to context – export PRODUCTION_SERVERS=192.168.42.16 Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 23
  • 24. MySQLShell: Features (DBA toolbox) Customizable Prompts •Sample prompt file: – mysql-shell/share/mysqlsh/prompt/ •Customization instructions: – mysql-shell/share/mysqlsh/prompt/README Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 24
  • 25. MySQLShell: Features (DBA toolbox) Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 25 Secure Credential Manager •MySQLserver passwords can be queried from a secure password store •Usesexisting OSnative password storage APIs – Keychain (macOS) – Credential Manager (Windows) – MySQLlogin-path encrypted files (all) •Optionally auto-save typed passwords (default will prompt) •Or use APIto store programmatically – shell.storeCredential("[email protected]","s3cr37!"); •Write your own password store backend
  • 26. MySQLShell: Features (DBA toolbox) Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 26 History •Typed command history •Persisting disabled by default, enable with – option history.autoSave=true •Filter SQL statements that may contain sensitiveinfo – e.g. SETPASSWORD='my password' – option history.sql.ignorePattern
  • 27. MySQLShell: Features (DBA toolbox) Pager •PassSQLresults through an external screen paging program – pager less – showstatus; Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 27
  • 28. MySQLShell: Features (DBA toolbox) Built-in Help •Documentation for included APIs, shell commands, SQL, etc. •help keyword – (wildcardsallowed) Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 28
  • 29. Shell meets continuous automation •Continuous automation frameworks provide mechanisms for setup, configuration and management of MySQL Server •DBAcan automate operations by usingmodules. •Classic example: Ensure MySQLServer deployments use the latest available version Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 29
  • 30. Shell meets continuous automation Let’s use asan example using MySQLShell upgrade checker: Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 30 service { ‘mysql’: ensure => latest, enable => true, require => Package[‘mysql-server-community’], before => Exec [‘upgrade checker’] } exec { “upgrade checker”: command => “mysqlsh -- util check-for-server-upgrade { --user=root -- host=localhost --port=3306} --password=‘myPwd’” require => Service[“mysqlsh”] }
  • 31. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | MySQL Shell and NoSQL: XDev API
  • 32. MySQLShell: Features •Document and Relational models – Supports the classic relational model – Modern fluent APIfor the MySQLDocumentStore •CRUDand Relational – Supports the traditional Table results, aswell as JSONor Tabseparated output MySQL Developme nt Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 32
  • 33. 35 / 112 MySQL Document Store Copyright @ 2018 Oracle and/or its affiliates. All right
  • 34. MySQL Document Store: Architecture Copyright @ 2018 Oracle and/or its affiliates. All right
  • 35. MySQLShell: Features Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 35 Document Store – X DevAPI •Support for MySQLDocument Store API •Create collections •Import JSONdumps •Try out queries and write simple scripts interactively •XDevAPI CRUDoperations •SQL
  • 36. MySQLShell: Features Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 36 Document Store – X DevAPI Examples •Operations on collections: – collection.add() – collection.find() – collection.remove() – collection.modify() – ...and much more.. •Operations on tables: – table.insert() – table.select() – table.update() – table.delete() – ...and much more.. •Session Operations: – session.create|drop.schema() – session.StartTransaction() – session.commit()|rollback() – session.getSchemas() – ...and much more.. •Operations on schemas: – schema.getTable() – schema.getCollection() – schema.dropTable() – schema.dropCollection() – ...and much more..
  • 37. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | MySQL Shell and HA: Admin API for InnoDB Cluster
  • 38. MySQLInnoDB Cluster: Vision “Asingleproduct— MySQL — withhigh availabilityand scaling features bakedin;providingan integratedend-to-endsolution thatiseasy touse.” – Engineering Team Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 38
  • 39. MySQLInnoDB Cluster: Background Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 39 •High Availability: critical factor •Replication asa common solution •MySQLhas support for: – Classic master-slave replication – DRBDS – Other OSor VMsolutions… Group Replication ! •Update-everywhere (m-m) •Virtually synchronous replication •Automatic server fail-over – Distributed recovery – Group reconfiguration •Powered by a GCS: Implementation of Paxos
  • 40. MySQLInnoDB Cluster: Background •Challenging task – Not easy to setup andmaintain – Technical knowledge needed – How to configure the applications? – How to integrate all the components? ? ? Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 40
  • 41. MySQLGroup Replication InnoDB cluster App Servers with MySQL Router MySQLShell Setup, Manage, Orchestrate Clients Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 41
  • 42. MySQLShell: Features •Administration API: AdminAPI – Creation and Management of InnoDB Clusters – Hides the complexity of: •Configuration •Provisioning •Orchestration – Simple and straight-forward – Doesn’t require MySQLexpertise – Flexible, powerful and secure – Available in both JavaScript andPython MySQL Administrati on Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 42
  • 43. MySQLShell: Features Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 43 AdminAPI - options --cluster • Prepares the Shell for managing the InnoDB cluster the target server belongs to •Automatically assigns the cluster global variable --redirect-primary • Connects the shell to the primary of the InnoDB cluster group, in case the one we connect to is asecondary --redirect-secondary • Connects the shell to a secondary member of the InnoDB cluster group
  • 44. MySQLShell: Features Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 44 AdminAPI - Create and Manage •Deploy and manage InnoDBCuster: – dba.configureInstance() – dba.createCluster() – dba.getCluster() – dba.rebootClusterFromCompleteOutage() – ...and much more... •Manage InnoDBCuster: – cluster.addInstance() – cluster.removeInstance() – cluster.rejoinInstance() – cluster.status() – ...and much more...
  • 45. MySQLShell: Features Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 45 AdminAPI - Sandboxes •Deploy and manage MySQL sandboxes: – dba.deploySandboxInstance() – dba.stopSandboxInstance() – dba.startSandboxInstance() – dba.deleteSandboxInstance() – dba.killSandboxInstance() Important: Sandbox instances are only suitable for testing purposes!
  • 46. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Summary
  • 47. Summary Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 47 •MySQLShell brings together developers andDBAs • Unified interface: one tool! • Development and Administration APIsand features •MySQLInnoDB Cluster is THEbuilt-in HAsolution for MySQL: • Full-stack: High Availability out-of-the-box • Acces to data SQL + NoSQL • Easyto use: usability asa topconcern
  • 48. Resources Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 48 •MySQLShellUserguide: – https://dev.mysql.com/doc/refman/en/mysql-shell.html •MySQLInnoDB ClusterUserguide: – http://dev.mysql.com/doc/refman/en/mysql-innodb-cluster-userguide.html •APIsReference manuals – JavaScript: https://dev.mysql.com/doc/dev/mysqlsh-api-javascript/ – Python: https://dev.mysql.com/doc/dev/mysqlsh-api-python/ •Blogging – http://mysqlserverteam.com/category/high-availability