MySQL Gubbins Richard Sinclair HepSysMan – 11/05/2012.

Slides:



Advertisements
Similar presentations
MySQL DBA Spring Topics in the MySQL AB DBA Course I Describe the MySQL Architecture, general operational characteristics and resources utilized.
Advertisements

2 Proprietary & Confidential What is Sharding Benefits of Sharding Alternatives of Sharding When to start Sharding Agenda.
A comparison of MySQL And Oracle Jeremy Haubrich.
Overview of Database Administrator (DBA) Tools
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 2 Overview of Database Administrator (DBA) Tools.
Wim Coekaerts Director of Linux Engineering Oracle Corporation.
Maxim Zhvirblya EPAM Systems © 2013 Or make MSSQL breathe easily RBS and Blob Cache in SharePoint 2013.
Cacti Workshop Tony Roman Agenda What is Cacti? The Origins of Cacti Large Installation Considerations Automation The Current.
Installing Windows 7 Lesson 2.
Harvard University Oracle Database Administration Session 2 System Level.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 12: Managing and Implementing Backups and Disaster Recovery.
Chapter 7: Configuring Disks. 2/24 Objectives Learn about disk and file system configuration in Vista Learn how to manage storage Learn about the additional.
Hands-On Microsoft Windows Server 2003 Chapter 2 Installing Windows Server 2003, Standard Edition.
Advanced Databases Basic Database Administration Guide to Oracle 10g 1.
2 Copyright © 2009, Oracle. All rights reserved. Installing your Oracle Software.
5.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 5: Working with File Systems.
Genie Backup ManagerServer 7.0 Product Profile. Copyright© Genie-Soft Corporation All rights reserved. Overview GBM Server 7.0 is a fully integrated.
Backup and Recovery Part 1.
Reliable MySQL Using Replication Issac Goldstand Mirimar Networks
Agenda  Overview  Configuring the database for basic Backup and Recovery  Backing up your database  Restore and Recovery Operations  Managing your.
Introduction to Oracle Backup and Recovery
Replication with MySQL 5.1 Ligaya Turmelle Senior Technical Support Engineer - MySQL
Anders Karlsson Principal Sales Engineer, MySQL MySQL Embedded - Getting started with libmysqld.
Administration etc.. What is this ? This section is devoted to those bits that I could not find another home for… Again these may be useless, but humour.
1 Introduction to PostgreSQL. 2 Documents PostgreSQL 8 for Windows (*) Beginning Databases with PostgreSQL From Novice to Professional, Second Edition.
Chapter-4 Windows 2000 Professional Win2K Professional provides a very usable interface and was designed for use in the desktop PC. Microsoft server system.
ITN Wake Tech1 ITN270 Advanced Internet Databases Lecture 14. Introduction to MySQL Administration and the MySQL Data Directory Topics: –Overview.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
MySQL Would You Like Some Transactions With That Table?
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Hands-On Virtual Computing
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
WaveMaker Visual AJAX Studio 4.0 Training Installation.
Sakai and mysql Stephen Marquard, David Horwitz University of Cape Town July 2008.
Eurotrace Hands-On The Eurotrace File System. 2 The Eurotrace file system Under MS ACCESS EUROTRACE generates several different files when you create.
MySQL. Dept. of Computing Science, University of Aberdeen2 In this lecture you will learn The main subsystems in MySQL architecture The different storage.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
ITN Wake Tech1 ITN270 Advanced Internet Databases Lecture 15. General MySQL Administration Topics: –Securing a New MySQL Installation –MySQL Server.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
Copyright 2006 MySQL AB The World’s Most Popular Open Source Database MySQL Cluster: An introduction Geert Vanderkelen MySQL AB.
Selling the Storage Edition for Oracle November 2000.
Chris Wright Senior Systems Engineer, Lucity MOVING TO ONE DATABASE FOR SQL SERVER.
Copyright 2002, Jeremy Zawodny MySQL Backup & Recovery O’Reilly Open Source Convention Jeremy Zawodny Yahoo! Finance July 24th, 2002.
Present :Arezoo Mollahasani. Step 1  Define your server connection Open MySQL WorkBench and click New Server Instance on the right of the window.
© 2008 Quest Software, Inc. ALL RIGHTS RESERVED. Perfmon and Profiler 101.
A Brief Documentation.  Provides basic information about connection, server, and client.
MySQL More… 1. More on SQL In MySQL, the Information Schema is the “Catalog” in the SQL standard SQL has three components: Data definition Data manipulation.
What is a port The Ports Collection is essentially a set of Makefiles, patches, and description files placed in /usr/ports. The port includes instructions.
IT Database Administration Section 09. Backup and Recovery Backup: The available options Full Consistent (cold) Backup Database shutdown, all files.
IT Database Administration SECTION 02. CREATING DATABASES Creating a Database: Overview 1. Plan the physical design and storage structures 2. Back.
© 2009/2010 Pythian 1 mysqltuner 1.0 Author: Major Hayden Quick sanity check: » Status/system variables » Memory, Architecture, Tables Not all recommendations.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Database Administration.
Database server Campus-Booster ID : ****** Copyright © SUPINFO. All rights reserved MySQL.
MySQL An Introduction Databases 101.
Unit-8 Introduction Of MySql. Types of table in PHP MySQL supports various of table types or storage engines to allow you to optimize your database. The.
S ECURE P ROGRAMMING NOTES 13 MySQL Best Practices 1.
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
Lab 3.21 MySQL Database Lab Developing the Tools May 5 th, 2004 Montréal, Québec Dominik Gehl Hôpital Ste-Justine, Montréal.
Introduction to MySQL  Working with MySQL and MySQL Workbench.
Configuring SQL Server for a successful SharePoint Server Deployment Haaron Gonzalez Solution Architect & Consultant Microsoft MVP SharePoint Server
1 Backup and Replication Integration Techniques MySQL 6.0 Lars Thalmann, PhD Mats Kindahl, PhD Chuck Bell, PhD Replication and Backup Team Sun Microsystems.
CC ICT-SUD Installation and configuration
MySQL Backup and Security Best practices on how to run MySQL on Linux in a secure way Lenz Grimmer
DBMS ● What are they? ● Why used ● Examples? – Oracle – Access – MySQL – Postgres – SQLServer – Sqlite.
Would You Like Some Transactions With That Table?
The Involuntary DBA Where there is Linux, you most likely will find MySQL or MariaDB. Like it or not, if you're working with Linux, you're a DBA.
Introduction of Week 3 Assignment Discussion
OPS235: Week 1 Installing Linux ( Lab1: Investigations 1-4)
Database administration
Presentation transcript:

MySQL Gubbins Richard Sinclair HepSysMan – 11/05/2012

Agenda Installation Users Server Parameters Security Backup and Recovery (the important bit) Coffee (the more important bit)

Installation $ yum install mysql-server mysql Edit my.cnf to specify data directory: [mysqld] datadir=/var/data/mysql $ /usr/bin/mysql_install_db $ /usr/bin/mysql_secure_installation

Installation 2 Red Hat ships MySQL Introduced: –Better multi-core performance –Better Partitioning (Truncate Partition) –Innodb as default storage engine –Performance schema Install as RPM from MySQL website –Same Post Install Steps

Storage Engines MyISAM – default in 5.1: –Very fast read/writes –No row level locking (only table locks) –Separate datafiles for each table Innodb – default in 5.5: –Row level locking –Foreign key support –Storage for all Innodb tables in single file (by default)

Upgrading from 5.1 to 5.5 Shutdown MySQL Install new version from RPM Run the mysql_upgrade script If you get the “Table 'mysql.proxies_priv' doesn't exist” error then run: –$ mysqld --skip-grant-tables & –$ mysql_upgrade

Starting/Stopping MySQL Recommended to use mysqld_safe rather than mysqld start: –Will restart the MySQL server after a crash –Will read the [mysqld_safe] section of the my.cnf file as well as the [mysqld] section

User Administration (The Bad Way) CREATE USER IDENTIFIED BY 'some_pass'; GRANT ALL PRIVILEGES ON *.* TO %' WITH GRANT OPTION;

User Administration (The Good Way) CREATE USER montysmachine.ac.uk' IDENTIFIED BY 'some_pass'; GRANT ALL PRIVILEGES ON montydb.* TO

Server Parameters MySQL is pretty good straight ‘out of the box’ There are a few parameters you can change to improve performance, improve logging and ensure disaster recovery is possible. All set in /etc/my.cnf file

Basic Settings datadir=/var/lib/mysql/data socket=/var/lib/mysql/mysql.sock user=mysql

Log Files log-error=/var/log/mysqld.log slow_query_log_file=/var/log/slow.log long_query_time = 60 log-output=TABLE,FILE mysql> SHOW CREATE TABLE mysql.slow_log;

Performance Tweaks MySQL is pretty quick but it can be made A LOT faster very easily. These are the 2 parameters that have made the most difference for us….

key_buffer_size Allocates memory to cache indexes Defaults to 8MB Too low meaning that indexes are mostly read from disk needlessly Increasing to 256MB on a 4GB system improved throughput by 300% (on MyISAM tables)

innodb_buffer_pool_size Only relevant when using InnoDB Defines the maximum memory InnoDB can use to buffer data Defaults to 128MB Raising to 512MB on a 4GB system greatly increased throughput

Disaster (Avoidance) Enable Binary Logging (in my.cnf): –log-bin = /mysql-backup/binlog/bin.log –expire_logs_days = 10 –max_binlog_size = 256M Ensure Binary Logs are on separate disk to Data Directory Can be used for Point-in-Time recovery More later….

Security Don’t use port 3306 Only allow super user access from localhost (fixed by mysql_secure_installation script) Don’t run MySQL as root (set user=mysql in my.cnf file) Change name of root user: –mysql> UPDATE mysql.user SET user = ‘superman' WHERE user = 'root';

SQL Injection Attacks If your database is public facing via a web server: –Change root user name –Test, test and test web pages (using common injection strings – plenty on Google) –Do not grant FILE privilege to users

Backups Daily backups + binary logs should be all you need to return to any point in time. Which tool to use for backups…….

Backup Utilities Mysqldump Mysqlhotcopy Mysql-zrm Xtrabackup About a hundred more….

What We Do Xtrabackup with a homebrewed wrapper which deals with alerts, cataloguing of backups, compression and more. Very fast for innodb tables, table locks on MyISAM (no way to avoid this)

Key Advantages Catalogue (separate MySQL server) records Binary Log position so you know at what point in time the backup was taken. Cleans out old backups based on user defined retention policy. Easy to restore – drag and drop.

Point In Time Recovery Restore the databases from most recent backup Get the binlog position from catalogue or text file in backup directory Use mysqlbinlog tool to parse binlogs from position of backups onwards into.sql script Run the.sql script from MySQL Get a cuppa (beverage size is dependent on amount of changes in binlogs)

Links na-xtrabackup

Questions? (and hopefully answers)