SlideShare a Scribd company logo
1 of 26
Copyright 2020 Severalnines AB
Lukas Vileikis, Marketing Manager, Severalnines
Presenter
lukasvileikis.com
lukas@severalnines.com
Managing the Moodle Database: Getting
Started
January 27th, 2021
Copyright 2020 Severalnines AB
Copyright 2019 Severalnines AB
Agenda
2
Copyright 2020 Severalnines AB
Agenda
● What is the Moodle Database?
● Moodle Database Configuration
● What to Monitor in the Moodle Database?
● Moodle Database Schema
● Database Activity in Moodle
● Managing the Moodle Database with ClusterControl
3
Copyright 2020 Severalnines AB 4
● Moodle database stores
○ all of the information related to Moodle.
● Moodle supports MySQL, MariaDB, PostgreSQL, MS SQL and Oracle
databases.
● The most frequently used database for Moodle is MySQL.
What is the Moodle Database?
Copyright 2020 Severalnines AB 5
Copyright 2020 Severalnines AB 6
● Moodle has thousands of plugins available - the plugin list includes
1,769 plugins.
○ The plugin list includes gamification plugins, questionnaire
plugins, certificate plugins etc.
○ Each plugin comes with its own schema.
Moodle Plug-ins
Copyright 2020 Severalnines AB
Copyright 2019 Severalnines AB
Moodle Database Configuration and
Monitoring
7
Copyright 2020 Severalnines AB 8
● Moodle Database Configuration File @ /var/www/html/moodle/config.php:
$CFG->dbtype = 'mariadb'; // 'pgsql', 'mariadb', 'mysqli', 'sqlsrv' or 'oci'
$CFG->dblibrary = 'native'; // 'native' only at the moment
$CFG->dbhost = '10.10.10.134'; // eg 'localhost' or 'db.isp.com' or IP
$CFG->dbname = 'moodle'; // database name, eg moodle
$CFG->dbuser = 'moodleuser'; // your database username
$CFG->dbpass = 'moodlepass'; // your database password
$CFG->prefix = 'mdl_'; // prefix to use for all table names
$CFG->dboptions = array(
'dbpersist' => false, // ‘false’ - most stable setting, ‘true’ sometimes improves performance
'dbsocket' => false, // Should connection via UNIX socket be used?
'dbport' => '', // The TCP port. Leave empty for the default port
'dbhandlesoptions' => false, // pgbouncer doesn’t support advanced options on connection
'dbcollation' => 'utf8mb4_unicode_ci' // database collation, best to leave at default
);
Moodle Database Configuration
Copyright 2020 Severalnines AB 9
Copyright 2020 Severalnines AB 10
What to Monitor in Moodle?
What to Do? How to Do It?
Take two things into account Take into account the OS and the
database.
Monitor the metrics in the context of your
system
Look for alterations in the behavioral
patterns: excessive CPU usage might be a
problem, high RAM usage probably means
that you need to check your DB
configuration, high load average could be
generated by excessive CPU, RAM or disk
usage.
Monitor your database Monitor your queries, the amount of active
sessions, database locks etc.
Copyright 2020 Severalnines AB 11
What to Monitor in Moodle?
What to Monitor? How to Do It?
Queries Know what data they access, are they
using indexes or partitions, what are their
patterns. Use EXPLAIN.
Active sessions If the number is high, increment the
maximum value or check if something is
wrong.
Database locks If you have a query waiting for another
query, check if it should be running in the
first place.
Backups Make sure they are up to date and can be
restored.
Copyright 2020 Severalnines AB
Copyright 2019 Severalnines AB
Moodle Database Schema
12
Copyright 2020 Severalnines AB 13
Moodle Database Schema
What do You Need to Do to Begin
Working with Moodle?
How to Do It?
Create a database that stores the Moodle
tables in MySQL, change the default
character set and collation to UTF-8, also
grant privileges.
Run the following queries:
CREATE DATABASE moodle DEFAULT
CHARACTER SET UTF8;
GRANT ALL PRIVILEGES ON moodle.*
TO ‘moodleuser’@’localhost’
IDENTIFIED BY ‘password’;
FLUSH PRIVILEGES;
Keep in mind the effects of the privileges. Keep in mind that GRANT ALL
PRIVILEGES allows a MySQL user full
access to a designated database.
Copyright 2020 Severalnines AB 14
Moodle Database Schema
Category of Database Schemas About
Configuration tables Consists of the following tables:
config, config_log, config_plugins
Users and their profile tables Consists of the following tables:
user, user_enrolments,
user_info_category,
user_info_data, user_info_field,
user_lastaccess,
user_preferences,
user_private_key
Copyright 2020 Severalnines AB 15
● Moodle’s database activity allows you to build, display and search
entries (files, images, links to websites, text...) on a topic of your
choice.
● Activities can be:
○ Moderated
○ Commented
○ Rated
○ Displayed as a list or individually
Database Activity in Moodle
Copyright 2020 Severalnines AB 16
● To add a database activity, turn on the editing, then select database
from the activity chooser. Database activities can also have names
and descriptions:
Database Activity in Moodle
Log in as a teacher,
then turn on editing.
Copyright 2020 Severalnines AB 17
● Database activities work through views
○ student views and teacher views
● In a student view, students can click
on the Database icon in the course
to access it and add entries.
● In a teacher view,
teachers can see the set up tabs and can edit, delete, approve and
unapprove entries as required.
Database Activity in Moodle – How Does it
Work?
Copyright 2020 Severalnines AB
Copyright 2019 Severalnines AB
Moodle Database and ClusterControl
18
Copyright 2020 Severalnines AB 19
● ClusterControl can help you with load balancing, adding or removing
slave nodes, automatic failover and recovery, backups and more:
○ Monitor your database servers in real-time
○ Create alerts which inform of events in your database
○ Scale-out your database
■ multi-master
■ primary with multiple secondaries
Monitoring the Moodle Database with
ClusterControl
Copyright 2020 Severalnines AB 20
● Provides a unified view of all DB instances (even across multiple
datacenters) letting you see the big picture or individual nodes.
● Backup management
○ Centralizes backups to protect, secure and recover your data
○ Backup verification feature to ensure backups are restorable
○ Support for different native backup methods
■ XtraBackup, MariaBackup, pg_basebackup, pgbackrest,
among others...
Monitoring the Moodle Database with
ClusterControl
Copyright 2020 Severalnines AB 21
Monitoring the Moodle Database with
ClusterControl
What can ClusterControl help with? How?
Security Manage database users and roles
(ClusterControl -> Your Cluster -> Manage
-> Schema and Users (or User
Management for PostgreSQL).
Logs See the ClusterControl log section.
Integration with your custom automation
scripts
s9s CLI available
Copyright 2020 Severalnines AB 22
Hardware specs
(CPU clock, cores, disk subsystem, RAM, swap, NIC, etc)
Hardware specs
(CPU clock, cores, disk subsystem, RAM, swap, NIC, etc)
Monitoring the Moodle Database with
ClusterControl - Backups
mysqldump, Percona
XtraBackup, MariaDB
Backup, NDB Backup
Backups can be
uploaded to the cloud
and restored
Copyright 2020 Severalnines AB 23
Monitoring the Moodle Database with
ClusterControl - Overview
Copyright 2020 Severalnines AB 24
Monitoring the Moodle Database with
ClusterControl - Query Monitoring
Copyright 2020 Severalnines AB 25
Adding a New Integration
Copyright 2020 Severalnines AB
Lukas Vileikis, Severalnines
Severalnines.com
lukasvileikis.com
Thank You! ☺
26

More Related Content

What's hot

Filesystem Comparison: NFS vs GFS2 vs OCFS2
Filesystem Comparison: NFS vs GFS2 vs OCFS2Filesystem Comparison: NFS vs GFS2 vs OCFS2
Filesystem Comparison: NFS vs GFS2 vs OCFS2
Giuseppe Paterno'
 
YugabyteDB - Distributed SQL Database on Kubernetes
YugabyteDB - Distributed SQL Database on KubernetesYugabyteDB - Distributed SQL Database on Kubernetes
YugabyteDB - Distributed SQL Database on Kubernetes
DoKC
 
Nosql-Module 1 PPT.pptx
Nosql-Module 1 PPT.pptxNosql-Module 1 PPT.pptx
Nosql-Module 1 PPT.pptx
Radhika R
 

What's hot (20)

depolyment on cloud.pptx
depolyment on cloud.pptxdepolyment on cloud.pptx
depolyment on cloud.pptx
 
Message oriented middleware
Message oriented middlewareMessage oriented middleware
Message oriented middleware
 
Cloud Computing Security
Cloud Computing SecurityCloud Computing Security
Cloud Computing Security
 
Distributed Trace & Log Analysis using ML
Distributed Trace & Log Analysis using MLDistributed Trace & Log Analysis using ML
Distributed Trace & Log Analysis using ML
 
Filesystem Comparison: NFS vs GFS2 vs OCFS2
Filesystem Comparison: NFS vs GFS2 vs OCFS2Filesystem Comparison: NFS vs GFS2 vs OCFS2
Filesystem Comparison: NFS vs GFS2 vs OCFS2
 
YugabyteDB - Distributed SQL Database on Kubernetes
YugabyteDB - Distributed SQL Database on KubernetesYugabyteDB - Distributed SQL Database on Kubernetes
YugabyteDB - Distributed SQL Database on Kubernetes
 
Advanced Ops Manager Topics
Advanced Ops Manager TopicsAdvanced Ops Manager Topics
Advanced Ops Manager Topics
 
Introduction to Operating System (Important Notes)
Introduction to Operating System (Important Notes)Introduction to Operating System (Important Notes)
Introduction to Operating System (Important Notes)
 
Multi threading models
Multi threading modelsMulti threading models
Multi threading models
 
Confluent Operator as Cloud-Native Kafka Operator for Kubernetes
Confluent Operator as Cloud-Native Kafka Operator for KubernetesConfluent Operator as Cloud-Native Kafka Operator for Kubernetes
Confluent Operator as Cloud-Native Kafka Operator for Kubernetes
 
Batch Processing at Scale with Flink & Iceberg
Batch Processing at Scale with Flink & IcebergBatch Processing at Scale with Flink & Iceberg
Batch Processing at Scale with Flink & Iceberg
 
Introduction to Cloud Computing
Introduction to Cloud ComputingIntroduction to Cloud Computing
Introduction to Cloud Computing
 
Cloud Computing Risk Management (IIA Webinar)
Cloud Computing Risk Management (IIA Webinar)Cloud Computing Risk Management (IIA Webinar)
Cloud Computing Risk Management (IIA Webinar)
 
Oracle zdm Migrate Amazon RDS Oracle to Oracle Autonomous 2021 Kamalesh Ramas...
Oracle zdm Migrate Amazon RDS Oracle to Oracle Autonomous 2021 Kamalesh Ramas...Oracle zdm Migrate Amazon RDS Oracle to Oracle Autonomous 2021 Kamalesh Ramas...
Oracle zdm Migrate Amazon RDS Oracle to Oracle Autonomous 2021 Kamalesh Ramas...
 
Nosql-Module 1 PPT.pptx
Nosql-Module 1 PPT.pptxNosql-Module 1 PPT.pptx
Nosql-Module 1 PPT.pptx
 
15 Troubleshooting tips and Tricks for Database 21c - KSAOUG
15 Troubleshooting tips and Tricks for Database 21c - KSAOUG15 Troubleshooting tips and Tricks for Database 21c - KSAOUG
15 Troubleshooting tips and Tricks for Database 21c - KSAOUG
 
Database Performance at Scale Masterclass: Database Internals by Pavel Emelya...
Database Performance at Scale Masterclass: Database Internals by Pavel Emelya...Database Performance at Scale Masterclass: Database Internals by Pavel Emelya...
Database Performance at Scale Masterclass: Database Internals by Pavel Emelya...
 
7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth7. Key-Value Databases: In Depth
7. Key-Value Databases: In Depth
 
Load balancing
Load balancingLoad balancing
Load balancing
 
Ansible, MongoDB Ops Manager and AWS v1.1
Ansible, MongoDB Ops Manager and AWS v1.1Ansible, MongoDB Ops Manager and AWS v1.1
Ansible, MongoDB Ops Manager and AWS v1.1
 

Similar to Working with the Moodle Database: The Basics

Sql interview-question-part-9
Sql interview-question-part-9Sql interview-question-part-9
Sql interview-question-part-9
kaashiv1
 

Similar to Working with the Moodle Database: The Basics (20)

Sql interview question part 10
Sql interview question part 10Sql interview question part 10
Sql interview question part 10
 
Ebook10
Ebook10Ebook10
Ebook10
 
Ebook9
Ebook9Ebook9
Ebook9
 
Sql interview question part 9
Sql interview question part 9Sql interview question part 9
Sql interview question part 9
 
Ebook9
Ebook9Ebook9
Ebook9
 
Sql interview-question-part-9
Sql interview-question-part-9Sql interview-question-part-9
Sql interview-question-part-9
 
Alejandro_Laverdet - EN
Alejandro_Laverdet - ENAlejandro_Laverdet - EN
Alejandro_Laverdet - EN
 
Accelerating Cloud Training With Alluxio
Accelerating Cloud Training With AlluxioAccelerating Cloud Training With Alluxio
Accelerating Cloud Training With Alluxio
 
BITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and InstallationBITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and Installation
 
Dataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStoreDataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStore
 
MySQL Cluster 8.0 tutorial
MySQL Cluster 8.0 tutorialMySQL Cluster 8.0 tutorial
MySQL Cluster 8.0 tutorial
 
Sql Server tips from the field
Sql Server tips from the fieldSql Server tips from the field
Sql Server tips from the field
 
Big Data: Big SQL web tooling (Data Server Manager) self-study lab
Big Data:  Big SQL web tooling (Data Server Manager) self-study labBig Data:  Big SQL web tooling (Data Server Manager) self-study lab
Big Data: Big SQL web tooling (Data Server Manager) self-study lab
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0
 
58750024 datastage-student-guide
58750024 datastage-student-guide58750024 datastage-student-guide
58750024 datastage-student-guide
 
MS SQL Backups explained by a DBA
MS SQL Backups explained by a DBAMS SQL Backups explained by a DBA
MS SQL Backups explained by a DBA
 
MySQL Performance Best Practices
MySQL Performance Best PracticesMySQL Performance Best Practices
MySQL Performance Best Practices
 
DevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 SecurityDevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 Security
 
The Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL DatabasesThe Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL Databases
 
New Capabilities with Cognos Data Modules
New Capabilities with Cognos Data ModulesNew Capabilities with Cognos Data Modules
New Capabilities with Cognos Data Modules
 

More from Severalnines

Webinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDBWebinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDB
Severalnines
 
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControlWebinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Severalnines
 
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Severalnines
 
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Severalnines
 
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Severalnines
 
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQLWebinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Severalnines
 
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDBWebinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Severalnines
 
Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?
Severalnines
 
Webinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High AvailabilityWebinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High Availability
Severalnines
 
Webinar slides: How to Get Started with Open Source Database Management
Webinar slides: How to Get Started with Open Source Database ManagementWebinar slides: How to Get Started with Open Source Database Management
Webinar slides: How to Get Started with Open Source Database Management
Severalnines
 

More from Severalnines (20)

Cloud's future runs through Sovereign DBaaS
Cloud's future runs through Sovereign DBaaSCloud's future runs through Sovereign DBaaS
Cloud's future runs through Sovereign DBaaS
 
Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloud
 
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDBSysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
 
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
 
Webinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDBWebinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDB
 
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControlWebinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
 
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
 
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
 
Disaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDBDisaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDB
 
MariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseMariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash Course
 
Performance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDBPerformance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDB
 
Advanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona ServerAdvanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona Server
 
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket KnifePolyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
 
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
 
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQLWebinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningWebinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
 
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDBWebinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
 
Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?
 
Webinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High AvailabilityWebinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High Availability
 
Webinar slides: How to Get Started with Open Source Database Management
Webinar slides: How to Get Started with Open Source Database ManagementWebinar slides: How to Get Started with Open Source Database Management
Webinar slides: How to Get Started with Open Source Database Management
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Working with the Moodle Database: The Basics

  • 1. Copyright 2020 Severalnines AB Lukas Vileikis, Marketing Manager, Severalnines Presenter lukasvileikis.com lukas@severalnines.com Managing the Moodle Database: Getting Started January 27th, 2021
  • 2. Copyright 2020 Severalnines AB Copyright 2019 Severalnines AB Agenda 2
  • 3. Copyright 2020 Severalnines AB Agenda ● What is the Moodle Database? ● Moodle Database Configuration ● What to Monitor in the Moodle Database? ● Moodle Database Schema ● Database Activity in Moodle ● Managing the Moodle Database with ClusterControl 3
  • 4. Copyright 2020 Severalnines AB 4 ● Moodle database stores ○ all of the information related to Moodle. ● Moodle supports MySQL, MariaDB, PostgreSQL, MS SQL and Oracle databases. ● The most frequently used database for Moodle is MySQL. What is the Moodle Database?
  • 6. Copyright 2020 Severalnines AB 6 ● Moodle has thousands of plugins available - the plugin list includes 1,769 plugins. ○ The plugin list includes gamification plugins, questionnaire plugins, certificate plugins etc. ○ Each plugin comes with its own schema. Moodle Plug-ins
  • 7. Copyright 2020 Severalnines AB Copyright 2019 Severalnines AB Moodle Database Configuration and Monitoring 7
  • 8. Copyright 2020 Severalnines AB 8 ● Moodle Database Configuration File @ /var/www/html/moodle/config.php: $CFG->dbtype = 'mariadb'; // 'pgsql', 'mariadb', 'mysqli', 'sqlsrv' or 'oci' $CFG->dblibrary = 'native'; // 'native' only at the moment $CFG->dbhost = '10.10.10.134'; // eg 'localhost' or 'db.isp.com' or IP $CFG->dbname = 'moodle'; // database name, eg moodle $CFG->dbuser = 'moodleuser'; // your database username $CFG->dbpass = 'moodlepass'; // your database password $CFG->prefix = 'mdl_'; // prefix to use for all table names $CFG->dboptions = array( 'dbpersist' => false, // ‘false’ - most stable setting, ‘true’ sometimes improves performance 'dbsocket' => false, // Should connection via UNIX socket be used? 'dbport' => '', // The TCP port. Leave empty for the default port 'dbhandlesoptions' => false, // pgbouncer doesn’t support advanced options on connection 'dbcollation' => 'utf8mb4_unicode_ci' // database collation, best to leave at default ); Moodle Database Configuration
  • 10. Copyright 2020 Severalnines AB 10 What to Monitor in Moodle? What to Do? How to Do It? Take two things into account Take into account the OS and the database. Monitor the metrics in the context of your system Look for alterations in the behavioral patterns: excessive CPU usage might be a problem, high RAM usage probably means that you need to check your DB configuration, high load average could be generated by excessive CPU, RAM or disk usage. Monitor your database Monitor your queries, the amount of active sessions, database locks etc.
  • 11. Copyright 2020 Severalnines AB 11 What to Monitor in Moodle? What to Monitor? How to Do It? Queries Know what data they access, are they using indexes or partitions, what are their patterns. Use EXPLAIN. Active sessions If the number is high, increment the maximum value or check if something is wrong. Database locks If you have a query waiting for another query, check if it should be running in the first place. Backups Make sure they are up to date and can be restored.
  • 12. Copyright 2020 Severalnines AB Copyright 2019 Severalnines AB Moodle Database Schema 12
  • 13. Copyright 2020 Severalnines AB 13 Moodle Database Schema What do You Need to Do to Begin Working with Moodle? How to Do It? Create a database that stores the Moodle tables in MySQL, change the default character set and collation to UTF-8, also grant privileges. Run the following queries: CREATE DATABASE moodle DEFAULT CHARACTER SET UTF8; GRANT ALL PRIVILEGES ON moodle.* TO ‘moodleuser’@’localhost’ IDENTIFIED BY ‘password’; FLUSH PRIVILEGES; Keep in mind the effects of the privileges. Keep in mind that GRANT ALL PRIVILEGES allows a MySQL user full access to a designated database.
  • 14. Copyright 2020 Severalnines AB 14 Moodle Database Schema Category of Database Schemas About Configuration tables Consists of the following tables: config, config_log, config_plugins Users and their profile tables Consists of the following tables: user, user_enrolments, user_info_category, user_info_data, user_info_field, user_lastaccess, user_preferences, user_private_key
  • 15. Copyright 2020 Severalnines AB 15 ● Moodle’s database activity allows you to build, display and search entries (files, images, links to websites, text...) on a topic of your choice. ● Activities can be: ○ Moderated ○ Commented ○ Rated ○ Displayed as a list or individually Database Activity in Moodle
  • 16. Copyright 2020 Severalnines AB 16 ● To add a database activity, turn on the editing, then select database from the activity chooser. Database activities can also have names and descriptions: Database Activity in Moodle Log in as a teacher, then turn on editing.
  • 17. Copyright 2020 Severalnines AB 17 ● Database activities work through views ○ student views and teacher views ● In a student view, students can click on the Database icon in the course to access it and add entries. ● In a teacher view, teachers can see the set up tabs and can edit, delete, approve and unapprove entries as required. Database Activity in Moodle – How Does it Work?
  • 18. Copyright 2020 Severalnines AB Copyright 2019 Severalnines AB Moodle Database and ClusterControl 18
  • 19. Copyright 2020 Severalnines AB 19 ● ClusterControl can help you with load balancing, adding or removing slave nodes, automatic failover and recovery, backups and more: ○ Monitor your database servers in real-time ○ Create alerts which inform of events in your database ○ Scale-out your database ■ multi-master ■ primary with multiple secondaries Monitoring the Moodle Database with ClusterControl
  • 20. Copyright 2020 Severalnines AB 20 ● Provides a unified view of all DB instances (even across multiple datacenters) letting you see the big picture or individual nodes. ● Backup management ○ Centralizes backups to protect, secure and recover your data ○ Backup verification feature to ensure backups are restorable ○ Support for different native backup methods ■ XtraBackup, MariaBackup, pg_basebackup, pgbackrest, among others... Monitoring the Moodle Database with ClusterControl
  • 21. Copyright 2020 Severalnines AB 21 Monitoring the Moodle Database with ClusterControl What can ClusterControl help with? How? Security Manage database users and roles (ClusterControl -> Your Cluster -> Manage -> Schema and Users (or User Management for PostgreSQL). Logs See the ClusterControl log section. Integration with your custom automation scripts s9s CLI available
  • 22. Copyright 2020 Severalnines AB 22 Hardware specs (CPU clock, cores, disk subsystem, RAM, swap, NIC, etc) Hardware specs (CPU clock, cores, disk subsystem, RAM, swap, NIC, etc) Monitoring the Moodle Database with ClusterControl - Backups mysqldump, Percona XtraBackup, MariaDB Backup, NDB Backup Backups can be uploaded to the cloud and restored
  • 23. Copyright 2020 Severalnines AB 23 Monitoring the Moodle Database with ClusterControl - Overview
  • 24. Copyright 2020 Severalnines AB 24 Monitoring the Moodle Database with ClusterControl - Query Monitoring
  • 25. Copyright 2020 Severalnines AB 25 Adding a New Integration
  • 26. Copyright 2020 Severalnines AB Lukas Vileikis, Severalnines Severalnines.com lukasvileikis.com Thank You! ☺ 26