Percona Server 8.0 - better support

Lot of bug fixes for percona.
This commit is contained in:
Jean-Marie Renouard 2019-10-02 00:07:46 +02:00
parent 3fd2e1c3c3
commit a9bed2ffa0
17 changed files with 222 additions and 1166 deletions

136
Vagrant/Vagrantfile vendored
View file

@ -1,105 +1,71 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
Vagrant.configure("2") do |config|
config.vm.box = "generic/fedora30"
config.vm.network "private_network", ip: "192.168.50.10", virtualbox__intnet: false
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
#config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
if Vagrant.has_plugin? "vagrant-vbguest"
config.vbguest.no_install = true
config.vbguest.auto_update = false
config.vbguest.no_remote = true
end
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_host = false
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'mysql57'
config.hostmanager.aliases = %w(mysql57.localdomain mysql57.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder "./data", "/data"
config.vm.hostname = 'fedora-generic'
config.hostmanager.aliases = %w(fedora-generic.localdomain fedora-generic.local fcg.local)
config.vm.synced_folder "/home/jmren/VagrantMachines/VagrantData", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
vb.name = "mysql57"
vb.memory = "2048"
vb.cpus = 2
vb.name="fedora-generic"
vb.gui = false
vb.memory = "3036"
vb.cpus = 4
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
echo "secret" | sudo passwd --stdin vagrant
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
sudo rpm -ivh https://dev.mysql.com/get/mysql57-community-release-fc23-7.noarch.rpm
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install mysql-community-server mysql-community-client wget
sudo systemctl start mysqld.service
PASSWORD=$(sudo grep -i "temporary password" /var/log/mysqld.log | cut -d':' -f4 | xargs -n 1 echo)
echo "PASSWORD: $PASSWORD"
mysql -uroot -p$PASSWORD --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySqlSecr3t#'"
mysql -uroot -psecret -e 'select version();'
cd /data
[ -f "employees_db-full-1.0.6.tar.bz2" ] || sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql -uroot -pMySqlSecr3t#
sudo dnf -y update
sudo dnf -y install telnet vim-enhanced net-tools git python python2-pip python34-PyYAML moreutils net-tools python-psutil perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils vim-enhanced unzip zip jq youtube-dl ffmpeg make mariadb psmisc PyYAML tofrodos python3 chromedriver wget
sudo dnf -y install python34-pip moreutils net-tools python-psutil perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils vim-enhanced unzip zip jq youtube-dl ffmpeg make mariadb psmisc PyYAML tofrodos python3 wget python-beautifulsoup4 npm rclone golang yum-utils device-mapper-persistent-data lvm2 docker
cd ..
cd MySQLTuner-perl
echo "alias h='function hdi(){ howdoi \$* -c -n 5; }; hdi'" >> /tmp/util.sh
echo "alias s=sudo" >> /tmp/util.sh
echo "alias h=history" >> /tmp/util.sh
echo "alias hserver='python -m http.server 8000'" >> /tmp/util.sh
sudo cp /tmp/util.sh /etc/profile.d
cat /tmp/util.sh
perl mysqltuner.pl --user root --pass MySqlSecr3t# --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
sudo dnf install -y yum-utils device-mapper-persistent-data lvm2
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf -y install docker-ce docker-ce-cli containerd.io
dnf list docker-ce --showduplicates | sort -r
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker vagrant
sudo systemctl daemon-reload
true
##########################################
# Install container
sudo systemctl restart docker
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,114 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# config.vm.box_check_update = false
# config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
if Vagrant.has_plugin?("vagrant-proxyconfx")
config.proxy.http = "http://10.195.50.51:3128/"
config.proxy.https = "http://10.195.50.51:3128/"
config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
end
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.100"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'maria100'
config.hostmanager.aliases = %w(maria100.localdomain maria100.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum-config-manager --enable base
echo "[mariadb]" >/tmp/mariadb.repo
echo "name = MariaDB" >>/tmp/mariadb.repo
echo "baseurl = http://yum.mariadb.org/10.0/centos7-amd64" >> /tmp/mariadb.repo
echo "gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" >> /tmp/mariadb.repo
echo "gpgcheck=1" >> /tmp/mariadb.repo
sudo cp /tmp/mariadb.repo /etc/yum.repos.d/
sudo rpm -Uvh http://mirrors.ircam.fr/pub/fedora/epel/7/x86_64/e/epel-release-latest.noarch.rpm
sudo yum -y install python2-pip git python perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils MariaDB-server MariaDB-Client wget
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
sudo cpanm install File::Util
#sudo systemctl start mariadb.service
sudo service mysql start
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,114 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://10.195.50.51:3128/"
config.proxy.https = "http://10.195.50.51:3128/"
config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
end
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'dev.app'
config.hostmanager.aliases = %w(dev.app.localdomain dev.app.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum-config-manager --enable base
echo "[mariadb]" >/tmp/mariadb.repo
echo "name = MariaDB" >>/tmp/mariadb.repo
echo "baseurl = http://yum.mariadb.org/10.1/centos7-amd64" >> /tmp/mariadb.repo
echo "gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" >> /tmp/mariadb.repo
echo "gpgcheck=1" >> /tmp/mariadb.repo
sudo cp /tmp/mariadb.repo /etc/yum.repos.d/
sudo rpm -Uvh http://mirrors.ircam.fr/pub/fedora/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
sudo yum -y install python2-pip git python perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils MariaDB-server MariaDB-Client wget
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
sudo cpanm install File::Util
#sudo systemctl start mariadb.service
sudo service mysql start
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,107 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "fc23-mariadb10-1"
config.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'dev.app'
config.hostmanager.aliases = %w(dev.app.localdomain dev.app.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
echo "# MariaDB 10.1 Fedora repository list - created 2016-01-25 13:11 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/fedora23-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" >> /etc/yum.repos.d/mariadb.repo
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install MariaDB-server MariaDB-client wget
sudo systemctl start mariadb.service
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,106 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'dev.app'
config.hostmanager.aliases = %w(dev.app.localdomain dev.app.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
echo "# MariaDB 10.1 Fedora repository list - created 2016-01-25 13:11 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/fedora23-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" >> /etc/yum.repos.d/mariadb.repo
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install MariaDB-server MariaDB-client wget
sudo systemctl start mariadb.service
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,109 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'maria104'
config.hostmanager.aliases = %w(maria104.localdomain maria104.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.name = "maria104"
vb.memory = "2048"
vb.cpus = 2
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
echo "# MariaDB 10.1 Fedora repository list - created 2016-01-25 13:11 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" >> /etc/yum.repos.d/mariadb.repo
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install MariaDB-server MariaDB-client wget
sudo systemctl start mariadb.service
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,109 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'maria104'
config.hostmanager.aliases = %w(maria104.localdomain maria104.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.name = "maria104"
vb.memory = "2048"
vb.cpus = 2
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
echo "# MariaDB 10.1 Fedora repository list - created 2016-01-25 13:11 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" >> /etc/yum.repos.d/mariadb.repo
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install MariaDB-server MariaDB-client wget
sudo systemctl start mariadb.service
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,107 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "fc23-mysql5-6"
config.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'dev.app'
config.hostmanager.aliases = %w(dev.app.localdomain dev.app.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python yum-utils
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
sudo rpm -ivh https://dev.mysql.com/get/mysql57-community-release-fc23-7.noarch.rpm
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum-config-manager --disable mysql57-community
sudo yum-config-manager --enable mysql56-community
sudo yum -y install mysql-community-server mysql-community-client wget
sudo systemctl start mysqld.service
mysql -uroot -e 'select version();'
cd /data
[ -f "employees_db-full-1.0.6.tar.bz2" ] || sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,105 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
#config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'mysql57'
config.hostmanager.aliases = %w(mysql57.localdomain mysql57.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
vb.name = "mysql57"
vb.memory = "2048"
vb.cpus = 2
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
sudo rpm -ivh https://dev.mysql.com/get/mysql57-community-release-fc23-7.noarch.rpm
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install mysql-community-server mysql-community-client wget
sudo systemctl start mysqld.service
PASSWORD=$(sudo grep -i "temporary password" /var/log/mysqld.log | cut -d':' -f4 | xargs -n 1 echo)
echo "PASSWORD: $PASSWORD"
mysql -uroot -p$PASSWORD --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySqlSecr3t#'"
mysql -uroot -psecret -e 'select version();'
cd /data
[ -f "employees_db-full-1.0.6.tar.bz2" ] || sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql -uroot -pMySqlSecr3t#
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --user root --pass MySqlSecr3t# --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -1,106 +0,0 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "fc23-mysql5-7"
config.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vbguest.auto_update = true
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.0.115"
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.vm.hostname = 'dev.app'
config.hostmanager.aliases = %w(dev.app.localdomain dev.app.local)
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = false
#
# # Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
sudo yum -y update
echo "secret" | sudo passwd --stdin root
sudo cp -pr ~vagrant/.ssh /root
sudo chown -R root.root /root/.ssh
sudo yum -y install git python
sudo pip install --upgrade pip
if [ ! -d "/data/MySQLTuner-perl" ]; then
cd /data
sudo git clone https://github.com/major/MySQLTuner-perl.git
fi
sudo rpm -ivh https://dev.mysql.com/get/mysql80-community-release-fc23-7.noarch.rpm
sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install mysql-community-server mysql-community-client wget
sudo systemctl start mysqld.service
PASSWORD=$(sudo grep -i "temporary password" /var/log/mysqld.log | cut -d':' -f4 | xargs -n 1 echo)
echo "PASSWORD: $PASSWORD"
mysql -uroot -p$PASSWORD --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySqlSecr3t#'"
mysql -uroot -psecret -e 'select version();'
cd /data
[ -f "employees_db-full-1.0.6.tar.bz2" ] || sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql -uroot -pMySqlSecr3t#
cd ..
cd MySQLTuner-perl
#perl mysqltuner.pl --user root --pass MySqlSecr3t# --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -7,6 +7,10 @@ alias la='ls -lsa'
alias gam='git status | grep "modified" | cut -d: -f2 | xargs -n 1 git add'
alias serve="python -m $(python -c 'import sys; print("http.server" if sys.version_info[:2] > (2,7) else "SimpleHTTPServer")')"
dcmd()
{
docker exec -i -t $1 bash
}
gen_mysqlalias()
{

View file

@ -2,7 +2,13 @@
input="./build/configimg.conf"
default_password="secret"
#rm -f $input
eco "[client]
user=root
password=$default_password" > $HOME/.my.cnf
chmod 600 $HOME/.my.cnf
[ -f "$input" ] || echo "
3306;mysql80;/var/lib/mysql8;mysql:8.0
3307;mysql57;/var/lib/mysql57;mysql:5.7
@ -21,10 +27,9 @@ default_password="secret"
5311;mariadb55;/var/lib/mariadb55;mariadb:5.5
" > $input
#
echo '* PRUNING DOCKER SYSTEM DATA'
#echo '* PRUNING DOCKER SYSTEM DATA'
#[ "$1" = "clean" ] || docker system prune -a -f
# download all images

25
build/createTestEnvs.sh Normal file
View file

@ -0,0 +1,25 @@
#!/bin/sh
source build/bashrc
sudo dnf install -y yum-utils device-mapper-persistent-data lvm2
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf -y install docker-ce docker-ce-cli containerd.io
dnf list docker-ce --showduplicates | sort -r
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker vagrant
sudo systemctl daemon-reload
sh build/createMassDockerImages.sh
sh build/fetchSampleDatabases.sh clean
sh build/fetchSampleDatabases.sh fetchall
exec_mysqls build/configimg.conf mysql contents/sakila-db/sakila-schema.sql
exec_mysqls build/configimg.conf mysql contents/sakila-db/sakila-data.sql

View file

@ -22,15 +22,17 @@ case "$1" in
[ -z "$2" ] && exit 1
mkdir -p ./contents
[ -f "contents/$(basename $(getVal "DB_$2_URL"))" ] || wget -O contents/$(basename $(getVal "DB_$2_URL")) $(getVal "DB_$2_URL")
[ $? -eq 0 ] && (cd contents;unzip $(basename $(getVal "DB_$2_URL")))
if [ $? -eq 0 ];then
(
cd contents
unzip $(basename $(getVal "DB_$2_URL")))
)
fi
;;
"clean")
rm -rf contents
;;
"load")
;;
*)
*)
echo "Unknown operation: $1"
;;
esac

25
build/runMT.sh Normal file
View file

@ -0,0 +1,25 @@
#!/bin/sh
input="./build/configimg.conf"
while IFS='' read -r line
do
[ -z "$line" ] && continue
container_port=$(echo "$line" | cut -d\; -f1)
container_name=$(echo "$line" | cut -d\; -f2)
container_datadir=$(echo "$line" | cut -d\; -f3)
image_name=$(echo "$line" | cut -d\; -f4)
if [ -n "$1" -a "$1" != "$container_name" ]; then
continue
fi
#set -x
sudo rm -f /var/lib/mysql
sudo ln -sf $container_datadir /var/lib/mysql
sudo chmod 777 /var/lib/mysql
#sudo docker logs $container_name > /tmp/mysqld.log
ls -ls /var/lib | grep -E 'mysql$'
#set +x
perl mysqltuner.pl --verbose --host 127.0.0.1 --port $container_port
done < "$input"

24
createTestEnvs.sh Normal file
View file

@ -0,0 +1,24 @@
#!/bin/sh
source build/bashrc
sudo dnf install -y yum-utils device-mapper-persistent-data lvm2
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf -y install docker-ce docker-ce-cli containerd.io
dnf list docker-ce --showduplicates | sort -r
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker vagrant
sudo systemctl daemon-reload
sh build/createMassDockerImages.sh
sh build/fetchSampleDatabases.sh fetchall
exec_mysqls build/configimg.conf mysql contents/sakila-db/sakila-schema.sql
exec_mysqls build/configimg.conf mysql contents/sakila-db/sakila-data.sql

View file

@ -1,5 +1,5 @@
#!/usr/bin/env perl
# mysqltuner.pl - Version 1.7.16
# mysqltuner.pl - Version 1.7.17
# High Performance MySQL Tuning Script
# Copyright (C) 2006-2018 Major Hayden - major@mhtx.net
#
@ -56,7 +56,7 @@ $Data::Dumper::Pair = " : ";
#use Env;
# Set up a few variables for use in the script
my $tunerversion = "1.7.16";
my $tunerversion = "1.7.17";
my ( @adjvars, @generalrec );
# Set defaults
@ -1238,6 +1238,10 @@ sub log_file_recommendations {
$myvar{'datadir'} );
subheaderprint "Log file Recommendations";
if ( "$myvar{'log_error'}" eq "stderr" ) {
badprint "log_error is set to $myvar{'log_error'} MT can't read stderr";
return
}
if ( -f "$myvar{'log_error'}" ) {
goodprint "Log file $myvar{'log_error'} exists";
}
@ -3953,11 +3957,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# InnoDB Buffer Pool by table
subheaderprint "Performance schema: InnoDB Buffer Pool by table";
subheaderprint "Performance schema: 40 InnoDB Buffer Pool by table";
$nbL = 1;
for my $lQuery (
select_array(
'select object_schema, object_name, allocated,data, pages from sys.x\\$innodb_buffer_stats_by_table ORDER BY pages DESC'
'select object_schema, object_name, allocated,data, pages from sys.x\\$innodb_buffer_stats_by_table ORDER BY pages DESC LIMIT 40'
)
)
{
@ -4013,11 +4017,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# High Cost SQL statements
subheaderprint "Performance schema: Top 5 Most latency statements";
subheaderprint "Performance schema: Top 15 Most latency statements";
$nbL = 1;
for my $lQuery (
select_array(
'select query, avg_latency from sys.x\\$statement_analysis order by avg_latency desc LIMIT 5'
'select LEFT(query, 120), avg_latency from sys.x\\$statement_analysis order by avg_latency desc LIMIT 15'
)
)
{
@ -4028,11 +4032,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# Top 5% slower queries
subheaderprint "Performance schema: Top 5 slower queries";
subheaderprint "Performance schema: Top 15 slower queries";
$nbL = 1;
for my $lQuery (
select_array(
'select query, exec_count from sys.x\\$statements_with_runtimes_in_95th_percentile order by exec_count desc LIMIT 5'
'select LEFT(query, 120), exec_count from sys.x\\$statements_with_runtimes_in_95th_percentile order by exec_count desc LIMIT 15'
)
)
{
@ -4043,11 +4047,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# Top 10 nb statement type
subheaderprint "Performance schema: Top 10 nb statement type";
subheaderprint "Performance schema: Top 15 nb statement type";
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select statement, sum(total) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
'use sys;select statement, sum(total) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
)
)
{
@ -4058,11 +4062,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# Top statement by total latency
subheaderprint "Performance schema: Top statement by total latency";
subheaderprint "Performance schema: Top 15 statement by total latency";
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select statement, sum(total_latency) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
'use sys;select statement, sum(total_latency) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
)
)
{
@ -4073,11 +4077,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# Top statement by lock latency
subheaderprint "Performance schema: Top statement by lock latency";
subheaderprint "Performance schema: Top 15 statement by lock latency";
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select statement, sum(lock_latency) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
'use sys;select statement, sum(lock_latency) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
)
)
{
@ -4088,11 +4092,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# Top statement by full scans
subheaderprint "Performance schema: Top statement by full scans";
subheaderprint "Performance schema: Top 15 statement by full scans";
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select statement, sum(full_scans) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
'use sys;select statement, sum(full_scans) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
)
)
{
@ -4103,11 +4107,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# Top statement by rows sent
subheaderprint "Performance schema: Top statement by rows sent";
subheaderprint "Performance schema: Top 15 statement by rows sent";
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select statement, sum(rows_sent) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
'use sys;select statement, sum(rows_sent) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
)
)
{
@ -4118,11 +4122,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# Top statement by rows modified
subheaderprint "Performance schema: Top statement by rows modified";
subheaderprint "Performance schema: Top 15 statement by rows modified";
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select statement, sum(rows_affected) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
'use sys;select statement, sum(rows_affected) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
)
)
{
@ -4133,11 +4137,11 @@ sub mysqsl_pfs {
if ( $nbL == 1 );
# Use temporary tables
subheaderprint "Performance schema: Some queries using temp table";
subheaderprint "Performance schema: 15 sample queries using temp table";
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select query from sys.x\\$statements_with_temp_tables LIMIT 20'
'use sys;select left(query, 120) from sys.x\\$statements_with_temp_tables LIMIT 15'
)
)
{
@ -4150,7 +4154,7 @@ sub mysqsl_pfs {
# Unused Indexes
subheaderprint "Performance schema: Unused indexes";
$nbL = 1;
for my $lQuery ( select_array('select * from sys.schema_unused_indexes') ) {
for my $lQuery ( select_array("select \* from sys.schema_unused_indexes where object_schema not in ('performance_schema')" )) {
infoprint " +-- $nbL: $lQuery";
$nbL++;
}
@ -4530,33 +4534,6 @@ sub mysqsl_pfs {
infoprint "No information found or indicators deactivated."
if ( $nbL == 1 );
subheaderprint "Performance schema: Tables not using InnoDB buffer";
$nbL = 1;
for my $lQuery (
select_array(
' Select table_schema, table_name from sys.x\\$schema_table_statistics_with_buffer where innodb_buffer_allocated IS NULL;'
)
)
{
infoprint " +-- $nbL: $lQuery";
$nbL++;
}
infoprint "No information found or indicators deactivated."
if ( $nbL == 1 );
subheaderprint "Performance schema: Table not using InnoDB buffer";
$nbL = 1;
for my $lQuery (
select_array(
' Select table_schema, table_name from sys.x\\$schema_table_statistics_with_buffer where innodb_buffer_allocated IS NULL;'
)
)
{
infoprint " +-- $nbL: $lQuery";
$nbL++;
}
infoprint "No information found or indicators deactivated."
if ( $nbL == 1 );
subheaderprint "Performance schema: Table not using InnoDB buffer";
$nbL = 1;
for my $lQuery (
@ -4603,7 +4580,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select db, query, exec_count from sys.x\\$statement_analysis order by exec_count DESC LIMIT 15;'
'select db, LEFT(query, 120), exec_count from sys.x\\$statement_analysis order by exec_count DESC LIMIT 15;'
)
)
{
@ -4618,7 +4595,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select query, last_seen from sys.x\\$statements_with_errors_or_warnings ORDER BY last_seen LIMIT 100;'
'select LEFT(query, 120), last_seen from sys.x\\$statements_with_errors_or_warnings ORDER BY last_seen LIMIT 40;'
)
)
{
@ -4632,7 +4609,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select db, query, exec_count from sys.x\\$statements_with_full_table_scans order BY exec_count DESC LIMIT 20;'
'select db, LEFT(query, 120), exec_count from sys.x\\$statements_with_full_table_scans order BY exec_count DESC LIMIT 20;'
)
)
{
@ -4646,7 +4623,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select db, query, last_seen from sys.x\\$statements_with_full_table_scans order BY last_seen DESC LIMIT 50;'
'select db, LEFT(query, 120), last_seen from sys.x\\$statements_with_full_table_scans order BY last_seen DESC LIMIT 50;'
)
)
{
@ -4660,7 +4637,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query , rows_sent from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY ROWs_sent DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), rows_sent from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY ROWs_sent DESC LIMIT 15;'
)
)
{
@ -4675,7 +4652,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query, rows_examined AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY rows_examined DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), rows_examined AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY rows_examined DESC LIMIT 15;'
)
)
{
@ -4690,7 +4667,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query, total_latency AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY total_latency DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), total_latency AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY total_latency DESC LIMIT 15;'
)
)
{
@ -4705,7 +4682,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query, max_latency AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY max_latency DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), max_latency AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY max_latency DESC LIMIT 15;'
)
)
{
@ -4720,7 +4697,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query, avg_latency AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY avg_latency DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), avg_latency AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY avg_latency DESC LIMIT 15;'
)
)
{
@ -4734,7 +4711,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select db, query, exec_count from sys.x\\$statements_with_sorting order BY exec_count DESC LIMIT 20;'
'select db, LEFT(query, 120), exec_count from sys.x\\$statements_with_sorting order BY exec_count DESC LIMIT 20;'
)
)
{
@ -4748,7 +4725,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select db, query, last_seen from sys.x\\$statements_with_sorting order BY last_seen DESC LIMIT 50;'
'select db, LEFT(query, 120), last_seen from sys.x\\$statements_with_sorting order BY last_seen DESC LIMIT 50;'
)
)
{
@ -4762,7 +4739,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query , rows_sorted from sys.x\\$statements_with_sorting ORDER BY ROWs_sorted DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), rows_sorted from sys.x\\$statements_with_sorting ORDER BY ROWs_sorted DESC LIMIT 15;'
)
)
{
@ -4776,7 +4753,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query, total_latency AS search from sys.x\\$statements_with_sorting ORDER BY total_latency DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), total_latency AS search from sys.x\\$statements_with_sorting ORDER BY total_latency DESC LIMIT 15;'
)
)
{
@ -4790,7 +4767,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query, sort_merge_passes AS search from sys.x\\$statements_with_sorting ORDER BY sort_merge_passes DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), sort_merge_passes AS search from sys.x\\$statements_with_sorting ORDER BY sort_merge_passes DESC LIMIT 15;'
)
)
{
@ -4805,7 +4782,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select db, query, avg_sort_merges AS search from sys.x\\$statements_with_sorting ORDER BY avg_sort_merges DESC LIMIT 15;'
'select db, LEFT(query, 120), avg_sort_merges AS search from sys.x\\$statements_with_sorting ORDER BY avg_sort_merges DESC LIMIT 15;'
)
)
{
@ -4819,7 +4796,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query, sorts_using_scans AS search from sys.x\\$statements_with_sorting ORDER BY sorts_using_scans DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), sorts_using_scans AS search from sys.x\\$statements_with_sorting ORDER BY sorts_using_scans DESC LIMIT 15;'
)
)
{
@ -4833,7 +4810,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query, sort_using_range AS search from sys.x\\$statements_with_sorting ORDER BY sort_using_range DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), sort_using_range AS search from sys.x\\$statements_with_sorting ORDER BY sort_using_range DESC LIMIT 15;'
)
)
{
@ -4869,7 +4846,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select db, query, exec_count from sys.x\\$statements_with_temp_tables order BY exec_count DESC LIMIT 20;'
'select db, LEFT(query, 120), exec_count from sys.x\\$statements_with_temp_tables order BY exec_count DESC LIMIT 20;'
)
)
{
@ -4883,7 +4860,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select db, query, last_seen from sys.x\\$statements_with_temp_tables order BY last_seen DESC LIMIT 50;'
'select db, LEFT(query, 120), last_seen from sys.x\\$statements_with_temp_tables order BY last_seen DESC LIMIT 50;'
)
)
{
@ -4898,7 +4875,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'select db, query, total_latency AS search from sys.x\\$statements_with_temp_tables ORDER BY total_latency DESC LIMIT 15;'
'select db, LEFT(query, 120), total_latency AS search from sys.x\\$statements_with_temp_tables ORDER BY total_latency DESC LIMIT 15;'
)
)
{
@ -4912,7 +4889,7 @@ sub mysqsl_pfs {
$nbL = 1;
for my $lQuery (
select_array(
'use sys;select db, query, disk_tmp_tables from sys.x\\$statements_with_temp_tables ORDER BY disk_tmp_tables DESC LIMIT 15;'
'use sys;select db, LEFT(query, 120), disk_tmp_tables from sys.x\\$statements_with_temp_tables ORDER BY disk_tmp_tables DESC LIMIT 15;'
)
)
{
@ -6019,6 +5996,9 @@ sub mysql_tables {
"Skip Database metrics from information schema missing in this version";
return;
}
if (mysql_version_ge(8) and not mysql_version_eq(10)) {
infoprint "MySQL and Percona version 8 and greater have remove PROCEDURE ANALYSE feature"
}
my @dblist = select_array(
"SELECT DISTINCT TABLE_SCHEMA FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );"
);
@ -6042,15 +6022,17 @@ sub mysql_tables {
my $isnull = select_one(
"SELECT IS_NULLABLE FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='$dbname' AND TABLE_NAME='$tbname' AND COLUMN_NAME='$_' "
);
infoprint " +-- Column $tbname.$_:";
my $current_type =
uc($ctype) . ( $isnull eq 'NO' ? " NOT NULL" : "" );
my $optimal_type = select_str_g( "Optimal_fieldtype",
my $optimal_type='';
$optimal_type = select_str_g( "Optimal_fieldtype",
"SELECT \\`$_\\` FROM \\`$dbname\\`.\\`$tbname\\` PROCEDURE ANALYSE(100000)"
);
if ( not defined($optimal_type) or $optimal_type eq '' ) {
) unless (mysql_version_ge(8) and not mysql_version_eq(10));
if ( $optimal_type eq '' ) {
infoprint " Current Fieldtype: $current_type";
infoprint " Optimal Fieldtype: Not available";
#infoprint " Optimal Fieldtype: Not available";
}
elsif ( $current_type ne $optimal_type ) {
infoprint " Current Fieldtype: $current_type";
@ -6159,7 +6141,7 @@ FROM performance_schema.table_io_waits_summary_by_index_usage
WHERE index_name IS NOT NULL
AND count_star =0
AND index_name <> 'PRIMARY'
AND object_schema != 'mysql'
AND object_schema NOT IN ( 'mysql', 'performance_schema', 'information_schema' )
ORDER BY count_star, object_schema, object_name;
ENDSQL
@idxinfo = select_array($selIdxReq);
@ -6341,19 +6323,19 @@ debugprint "MySQL FINAL Client : $mysqlcmd $mysqllogin";
debugprint "MySQL Admin FINAL Client : $mysqladmincmd $mysqllogin";
#exit(0);
os_setup; # Set up some OS variables
get_all_vars; # Toss variables/status into hashes
get_tuning_info; # Get information about the tuning connexion
validate_mysql_version; # Check current MySQL version
os_setup; # Set up some OS variables
get_all_vars; # Toss variables/status into hashes
get_tuning_info; # Get information about the tuning connexion
validate_mysql_version; # Check current MySQL version
check_architecture; # Suggest 64-bit upgrade
system_recommendations; # avoid to many service on the same host
log_file_recommendations; # check log file content
check_storage_engines; # Show enabled storage engines
check_architecture; # Suggest 64-bit upgrade
system_recommendations; # avoid to many service on the same host
log_file_recommendations; # check log file content
check_storage_engines; # Show enabled storage engines
check_metadata_perf; # Show parameter impacting performance during analysis
mysql_databases; # Show informations about databases
mysql_tables; # Show informations about table column
check_metadata_perf; # Show parameter impacting performance during analysis
mysql_databases; # Show informations about databases
mysql_tables; # Show informations about table column
mysql_indexes; # Show informations about indexes
security_recommendations; # Display some security recommendations
@ -6368,14 +6350,14 @@ mariadb_ariadb; # Print MariaDB AriaDB stats
mariadb_tokudb; # Print MariaDB Tokudb stats
mariadb_xtradb; # Print MariaDB XtraDB stats
#mariadb_rockdb; # Print MariaDB RockDB stats
#mariadb_spider; # Print MariaDB Spider stats
#mariadb_connect; # Print MariaDB Connect stats
mariadb_galera; # Print MariaDB Galera Cluster stats
get_replication_status; # Print replication info
make_recommendations; # Make recommendations based on stats
dump_result; # Dump result if debug is on
close_outputfile; # Close reportfile if needed
#mariadb_rockdb; # Print MariaDB RockDB stats
#mariadb_spider; # Print MariaDB Spider stats
#mariadb_connect; # Print MariaDB Connect stats
mariadb_galera; # Print MariaDB Galera Cluster stats
get_replication_status; # Print replication info
make_recommendations; # Make recommendations based on stats
dump_result; # Dump result if debug is on
close_outputfile; # Close reportfile if needed
# ---------------------------------------------------------------------------
# END 'MAIN'
@ -6390,7 +6372,7 @@ __END__
=head1 NAME
MySQLTuner 1.7.16 - MySQL High Performance Tuning Script
MySQLTuner 1.7.17 - MySQL High Performance Tuning Script
=head1 IMPORTANT USAGE GUIDELINES