merged
This commit is contained in:
commit
1e8b32a253
30 changed files with 7262 additions and 1269 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -7,3 +7,5 @@ build/vulnerabilities*
|
||||||
Vagrant/Vagrantfile
|
Vagrant/Vagrantfile
|
||||||
Vagrant/data
|
Vagrant/data
|
||||||
Vagrant/.vagrant
|
Vagrant/.vagrant
|
||||||
|
contents
|
||||||
|
contents/*
|
||||||
|
|
193
.travis.yml
193
.travis.yml
|
@ -4,18 +4,18 @@ language: perl
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- addons:
|
# - addons:
|
||||||
mariadb: "5.5"
|
# mariadb: "5.5"
|
||||||
name: "MariaDB 5.5/Perl 5.24"
|
# name: "MariaDB 5.5/Perl 5.24"
|
||||||
perl: "5.24"
|
# perl: "5.24"
|
||||||
- addons:
|
# - addons:
|
||||||
mariadb: "10.0"
|
# mariadb: "10.0"
|
||||||
name: "MariaDB 10.0/Perl 5.24"
|
# name: "MariaDB 10.0/Perl 5.24"
|
||||||
perl: "5.24"
|
# perl: "5.24"
|
||||||
- addons:
|
# - addons:
|
||||||
mariadb: "10.1"
|
# mariadb: "10.1"
|
||||||
name: "MariaDB 10.1/Perl 5.24"
|
# name: "MariaDB 10.1/Perl 5.24"
|
||||||
perl: "5.24"
|
# perl: "5.24"
|
||||||
- addons:
|
- addons:
|
||||||
mariadb: "10.2"
|
mariadb: "10.2"
|
||||||
name: "MariaDB 10.2/Perl 5.24"
|
name: "MariaDB 10.2/Perl 5.24"
|
||||||
|
@ -24,139 +24,37 @@ matrix:
|
||||||
mariadb: "10.3"
|
mariadb: "10.3"
|
||||||
name: "MariaDB 10.3/Perl 5.24"
|
name: "MariaDB 10.3/Perl 5.24"
|
||||||
perl: "5.24"
|
perl: "5.24"
|
||||||
- addons:
|
# - addons:
|
||||||
mariadb: "10.4"
|
# mariadb: "10.4"
|
||||||
name: "MariaDB 10.4/Perl 5.24"
|
# name: "MariaDB 10.4/Perl 5.24"
|
||||||
perl: "5.24"
|
# perl: "5.24"
|
||||||
- addons:
|
# - addons:
|
||||||
mysql: "5.5"
|
# mysql: "5.5"
|
||||||
name: "MySQL 5.5/Perl 5.24"
|
# name: "MySQL 5.5/Perl 5.24"
|
||||||
perl: "5.24"
|
# perl: "5.24"
|
||||||
- addons:
|
# - addons:
|
||||||
mysql: "5.6"
|
# mysql: "5.6"
|
||||||
name: "MySQL 5.6/Perl 5.24"
|
# name: "MySQL 5.6/Perl 5.24"
|
||||||
perl: "5.24"
|
# perl: "5.24"
|
||||||
- addons:
|
# - addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- mysql-5.7-trusty
|
# - mysql-5.7-trusty
|
||||||
packages:
|
# packages:
|
||||||
- mysql-server
|
# - mysql-server
|
||||||
- mysql-client
|
# - mysql-client
|
||||||
name: "MySQL 5.7/Perl 5.24"
|
# name: "MySQL 5.7/Perl 5.24"
|
||||||
perl: "5.24"
|
# perl: "5.24"
|
||||||
- addons:
|
# - addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- mysql-8.0-trusty
|
# - mysql-8.0-trusty
|
||||||
packages:
|
# packages:
|
||||||
- mysql-server
|
# - mysql-server
|
||||||
- mysql-client
|
# - mysql-client
|
||||||
name: "MySQL 8/Perl 5.24"
|
# name: "MySQL 8/Perl 5.24"
|
||||||
perl: "5.24"
|
# perl: "5.24"
|
||||||
|
|
||||||
- addons:
|
|
||||||
mariadb: "5.5"
|
|
||||||
name: "MariaDB 5.5/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.0"
|
|
||||||
name: "MariaDB 10.0/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.1"
|
|
||||||
name: "MariaDB 10.1/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.2"
|
|
||||||
name: "MariaDB 10.2/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.3"
|
|
||||||
name: "MariaDB 10.3/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.4"
|
|
||||||
name: "MariaDB 10.4/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
- addons:
|
|
||||||
mysql: "5.5"
|
|
||||||
name: "MySQL 5.5/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
- addons:
|
|
||||||
mysql: "5.6"
|
|
||||||
name: "MySQL 5.6/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
- addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- mysql-5.7-trusty
|
|
||||||
packages:
|
|
||||||
- mysql-server
|
|
||||||
- mysql-client
|
|
||||||
name: "MySQL 5.7/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
- addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- mysql-8.0-trusty
|
|
||||||
packages:
|
|
||||||
- mysql-server
|
|
||||||
- mysql-client
|
|
||||||
name: "MySQL 8/Perl 5.16"
|
|
||||||
perl: "5.16"
|
|
||||||
|
|
||||||
- addons:
|
|
||||||
mariadb: "5.5"
|
|
||||||
name: "MariaDB 5.5/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.0"
|
|
||||||
name: "MariaDB 10.0/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.1"
|
|
||||||
name: "MariaDB 10.1/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.2"
|
|
||||||
name: "MariaDB 10.2/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.3"
|
|
||||||
name: "MariaDB 10.3/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
- addons:
|
|
||||||
mariadb: "10.4"
|
|
||||||
name: "MariaDB 10.4/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
- addons:
|
|
||||||
mysql: "5.5"
|
|
||||||
name: "MySQL 5.5/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
- addons:
|
|
||||||
mysql: "5.6"
|
|
||||||
name: "MySQL 5.6/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
- addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- mysql-5.7-trusty
|
|
||||||
packages:
|
|
||||||
- mysql-server
|
|
||||||
- mysql-client
|
|
||||||
name: "MySQL 5.7/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
- addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- mysql-8.0-trusty
|
|
||||||
packages:
|
|
||||||
- mysql-server
|
|
||||||
- mysql-client
|
|
||||||
name: "MySQL 8/Perl 5.10"
|
|
||||||
perl: "5.10"
|
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- git clone git://github.com/haarg/perl-travis-helper
|
- git clone git://github.com/haarg/perl-travis-helper
|
||||||
- source perl-travis-helper/init
|
- source perl-travis-helper/init
|
||||||
|
@ -174,15 +72,12 @@ before_script:
|
||||||
- chmod 600 .my.cnf
|
- chmod 600 .my.cnf
|
||||||
- git clone https://github.com/datacharmer/test_db.git
|
- git clone https://github.com/datacharmer/test_db.git
|
||||||
- cd test_db
|
- cd test_db
|
||||||
- cat employees.sql | grep -v 'storage_engine' | mysql
|
- "cat employees.sql | grep -v 'storage_engine' | mysql"
|
||||||
- cd ..
|
- cd ..
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- perlcritic --exclude InputOutput::ProhibitInteractiveTest mysqltuner.pl
|
- ./mysqltuner.pl --verbose --tbstat 2>stderr.txt | tee -a "stdout.txt"
|
||||||
- ./mysqltuner.pl --verbose --tbstat 2>stderr.txt | tee -a "stdout.txt"
|
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- echo "Standard Output: $(cat stdout.txt)"
|
- echo "Standard Output: $(cat stdout.txt)"
|
||||||
- echo "Standard Error : $(cat stderr.txt)"
|
- echo "Standard Error : $(cat stderr.txt)"
|
||||||
- [ "0" = "$(wl -l stderr.txt)" ] || exit 2
|
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ Copy of the license is available at [LICENSE]
|
||||||
## MySQLTuner Code Conventions
|
## MySQLTuner Code Conventions
|
||||||
|
|
||||||
1. Check code convention using **perltidy** and **perlcritic**
|
1. Check code convention using **perltidy** and **perlcritic**
|
||||||
2. Don't manually update the version number in `mysqltuner.pl`.
|
2. Don't manually update the version number in `mysqltuner.pl`.
|
||||||
|
|
||||||
|
|
||||||
[Enhancement issue]:https://github.com/major/MySQLTuner-perl/labels/enhancement
|
[Enhancement issue]:https://github.com/major/MySQLTuner-perl/labels/enhancement
|
||||||
|
|
12
INTERNALS.md
12
INTERNALS.md
|
@ -6,6 +6,7 @@
|
||||||
* [Get login information steps](#mysqltuner-get-login-information-steps)
|
* [Get login information steps](#mysqltuner-get-login-information-steps)
|
||||||
* [System checks](#mysqltuner-system-checks)
|
* [System checks](#mysqltuner-system-checks)
|
||||||
* [Server version checks](#mysqltuner-server-version-checks)
|
* [Server version checks](#mysqltuner-server-version-checks)
|
||||||
|
* [Error log file checks](#mysql-error-log-file-analysis)
|
||||||
* [MySQL Storage engine general information](#mysql-storage-engine-general-information)
|
* [MySQL Storage engine general information](#mysql-storage-engine-general-information)
|
||||||
* [Security checks](#mysqltuner-security-checks)
|
* [Security checks](#mysqltuner-security-checks)
|
||||||
* [CVE checks](#mysqltuner-cve-checks)
|
* [CVE checks](#mysqltuner-cve-checks)
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
* Get information about the tuning connexion
|
* Get information about the tuning connexion
|
||||||
* Check current MySQL version
|
* Check current MySQL version
|
||||||
* Suggest 64-bit upgrade
|
* Suggest 64-bit upgrade
|
||||||
|
* Analyze mysqld error log file
|
||||||
* Show enabled storage engines
|
* Show enabled storage engines
|
||||||
* Show informations about databases (option: --dbstat)
|
* Show informations about databases (option: --dbstat)
|
||||||
* Show informations about indexes (option: --idxstat)
|
* Show informations about indexes (option: --idxstat)
|
||||||
|
@ -87,6 +89,13 @@
|
||||||
* Currently MySQL < 5.1 are EOF considered.
|
* Currently MySQL < 5.1 are EOF considered.
|
||||||
* Using 5.5+ version of MySQL for performance issue (asynchronous IO).
|
* Using 5.5+ version of MySQL for performance issue (asynchronous IO).
|
||||||
|
|
||||||
|
## Mysql error log file analysis
|
||||||
|
* Look for potential current error log file name
|
||||||
|
* Check permission on error log file
|
||||||
|
* Check size on error log file
|
||||||
|
* Check error and warning on error log file
|
||||||
|
* Find last start and shutdown on error log file
|
||||||
|
|
||||||
## MySQL Storage engine general information
|
## MySQL Storage engine general information
|
||||||
|
|
||||||
* Get storage engine counts/stats
|
* Get storage engine counts/stats
|
||||||
|
@ -158,6 +167,7 @@
|
||||||
* Thread cache (=4)
|
* Thread cache (=4)
|
||||||
* Thread cache hit ratio (>50%) if thread_handling is different of pools-of-threads
|
* Thread cache hit ratio (>50%) if thread_handling is different of pools-of-threads
|
||||||
* Table cache hit ratio(>2°%)
|
* Table cache hit ratio(>2°%)
|
||||||
|
* Table cache definition should be upper that total number of tables or in autoresizing mode
|
||||||
* Percentage of open file and open file limit(<85%)
|
* Percentage of open file and open file limit(<85%)
|
||||||
* Percentage of table locks (<95%)
|
* Percentage of table locks (<95%)
|
||||||
* Percentage of binlog cache lock (<90%)
|
* Percentage of binlog cache lock (<90%)
|
||||||
|
@ -215,7 +225,7 @@
|
||||||
* MySQL needs 1 instance per 1Go of Buffer Pool
|
* MySQL needs 1 instance per 1Go of Buffer Pool
|
||||||
* innodb_buffer_pool instances = round(innodb_buffer_pool_size / 1Go)
|
* innodb_buffer_pool instances = round(innodb_buffer_pool_size / 1Go)
|
||||||
* innodb_buffer_pool instances must be equals or lower than 64
|
* innodb_buffer_pool instances must be equals or lower than 64
|
||||||
|
|
||||||
- A bug in MySQL 5.6 causes SHOW VARIABLES to report an innodb_buffer_pool_instances value of 8 when innodb_buffer_pool_size is less than 1GB and only one buffer pool instance is present (Bug #18343670).
|
- A bug in MySQL 5.6 causes SHOW VARIABLES to report an innodb_buffer_pool_instances value of 8 when innodb_buffer_pool_size is less than 1GB and only one buffer pool instance is present (Bug #18343670).
|
||||||
|
|
||||||
* InnoDB Buffer Pool Usage
|
* InnoDB Buffer Pool Usage
|
||||||
|
|
93
README.md
93
README.md
|
@ -34,22 +34,37 @@ MySQLTuner needs you:
|
||||||
Compatibility
|
Compatibility
|
||||||
====
|
====
|
||||||
Test result are available here: [Travis CI/MySQLTuner-perl](https://travis-ci.org/major/MySQLTuner-perl)
|
Test result are available here: [Travis CI/MySQLTuner-perl](https://travis-ci.org/major/MySQLTuner-perl)
|
||||||
* MySQL 8 (partial support, password checks don't work)
|
* MySQL 8 (full support, password checks don't work)
|
||||||
* MySQL 5.7 (full support)
|
* MySQL 5.7 (full support)
|
||||||
* MySQL 5.6 (full support)
|
* MySQL 5.6 (full support)
|
||||||
|
* MySQL 5.5 (full support)
|
||||||
|
* MariaDB 10.4 (full support)
|
||||||
* MariaDB 10.3 (full support)
|
* MariaDB 10.3 (full support)
|
||||||
* MariaDB 10.2 (full support)
|
* MariaDB 10.2 (full support)
|
||||||
* MariaDB 10.1 (full support)
|
* MariaDB 10.1 (full support)
|
||||||
* MariaDB 10.0 (full support, 6 last month support)
|
* MariaDB 10.0 (full support, 6 last month support)
|
||||||
|
* MariaDB 5.5 (full support, no more MariaDB support)
|
||||||
|
* Percona Server 8.0 (full support, password checks don't work)
|
||||||
* Percona Server 5.7 (full support)
|
* Percona Server 5.7 (full support)
|
||||||
* Percona Server 5.6 (full support)
|
* Percona Server 5.6 (full support)
|
||||||
* Percona XtraDB cluster (full support)
|
|
||||||
|
* Percona XtraDB cluster (partial support, no test environment)
|
||||||
|
* Mysql Replications (partial support, no test environment)
|
||||||
|
* Galera replication (partial support, no test environment)
|
||||||
|
|
||||||
* MySQL 3.23, 4.0, 4.1, 5.0, 5.1, 5.5 (partial support - deprecated version)
|
* MySQL 3.23, 4.0, 4.1, 5.0, 5.1, 5.5 (partial support - deprecated version)
|
||||||
|
|
||||||
|
*** UNSUPPORTED ENVIRONMENTS - NEED HELP FOR THAT :) ***
|
||||||
|
* Windows is not supported at this time (Help wanted !!!!!)
|
||||||
|
* Cloud based is not supported at this time (Help wanted !!!!!)
|
||||||
|
|
||||||
|
* CVE vulnerabilities detection support from [https://cve.mitre.org](https://cve.mitre.org)
|
||||||
|
|
||||||
|
*** MINIMAL REQUIREMENTS ***
|
||||||
|
|
||||||
* Perl 5.6 or later (with [perl-doc](http://search.cpan.org/~dapm/perl-5.14.4/pod/perldoc.pod) package)
|
* Perl 5.6 or later (with [perl-doc](http://search.cpan.org/~dapm/perl-5.14.4/pod/perldoc.pod) package)
|
||||||
* Unix/Linux based operating system (tested on Linux, BSD variants, and Solaris variants)
|
* Unix/Linux based operating system (tested on Linux, BSD variants, and Solaris variants)
|
||||||
* Windows is not supported at this time (Help wanted !!!!!)
|
|
||||||
* Unrestricted read access to the MySQL server (OS root access recommended for MySQL < 5.1)
|
* Unrestricted read access to the MySQL server (OS root access recommended for MySQL < 5.1)
|
||||||
* CVE vulnerabilities detection support from [https://cve.mitre.org](https://cve.mitre.org)
|
|
||||||
|
|
||||||
***WARNING***
|
***WARNING***
|
||||||
--
|
--
|
||||||
|
@ -125,6 +140,11 @@ You can follow this command to create a new database sys containing very useful
|
||||||
cd mariadb-sys-master/
|
cd mariadb-sys-master/
|
||||||
mysql -u root -p < ./sys_10.sql
|
mysql -u root -p < ./sys_10.sql
|
||||||
|
|
||||||
|
Errors & solutions for performance schema installation
|
||||||
|
|
||||||
|
ERROR at line 21: Failed to open file './tables/sys_config_data_10.sql -- ported', error: 2
|
||||||
|
Have a look at #452 solution given by @ericx
|
||||||
|
|
||||||
Performance tips
|
Performance tips
|
||||||
--
|
--
|
||||||
Metadata statistic updates can impact strongly performance of database servers and MySQLTuner.
|
Metadata statistic updates can impact strongly performance of database servers and MySQLTuner.
|
||||||
|
@ -171,6 +191,10 @@ __Usage:__ Enable debugging information
|
||||||
|
|
||||||
perl mysqltuner.pl --debug
|
perl mysqltuner.pl --debug
|
||||||
|
|
||||||
|
__Usage:__ Update MySQLTuner and data files (password and cve) if needed
|
||||||
|
|
||||||
|
perl mysqltuner.pl --checkversion --updateversion
|
||||||
|
|
||||||
FAQ
|
FAQ
|
||||||
--
|
--
|
||||||
|
|
||||||
|
@ -262,15 +286,11 @@ Yes! `brew install mysqltuner` can be used to install this application using [ho
|
||||||
MySQLTuner and Vagrant
|
MySQLTuner and Vagrant
|
||||||
--
|
--
|
||||||
**MySQLTuner** contains following Vagrant configurations:
|
**MySQLTuner** contains following Vagrant configurations:
|
||||||
* Fedora Core 23 / MariaDB 10.0
|
* Fedora Core 30 / Docker
|
||||||
* Fedora Core 23 / MariaDB 10.1
|
|
||||||
* Fedora Core 23 / MySQL 5.6
|
|
||||||
* Fedora Core 23 / MySQL 5.7
|
|
||||||
|
|
||||||
**Vagrant File** are stored in Vagrant subdirectory.
|
**Vagrant File** is stored in Vagrant subdirectory.
|
||||||
* Follow this 2 steps after vagrant installation:
|
* Follow following step after vagrant installation:
|
||||||
* Rename VagrantFile_for_Mxxx into Vagrantfile
|
$ vagrant up
|
||||||
* vagrant up
|
|
||||||
|
|
||||||
**MySQLTuner** contains a Vagrant configurations for test purpose and development
|
**MySQLTuner** contains a Vagrant configurations for test purpose and development
|
||||||
* Install VirtualBox and Vagrant
|
* Install VirtualBox and Vagrant
|
||||||
|
@ -281,14 +301,51 @@ MySQLTuner and Vagrant
|
||||||
* Install Vagrant plugins vagrant-hostmanager and vagrant-vbguest
|
* Install Vagrant plugins vagrant-hostmanager and vagrant-vbguest
|
||||||
* vagrant plugin install vagrant-hostmanager
|
* vagrant plugin install vagrant-hostmanager
|
||||||
* vagrant plugin install vagrant-vbguest
|
* vagrant plugin install vagrant-vbguest
|
||||||
* Add Fedora Core 23 box for official Fedora Download Website
|
* Add Fedora Core 30 box for official Fedora Download Website
|
||||||
* vagrant box add --name fc23 https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box
|
* vagrant box add --name generic/fedora30
|
||||||
* Create a data directory
|
* Create a data directory
|
||||||
* mkdir data
|
* mkdir data
|
||||||
* Rename Vagrantfile_MariaDB10.0 into Vagrantfile
|
|
||||||
* cp MySQLTuner-perl/Vagrant/Vagrantfile_for_MariaDB10.0 Vagrantfile
|
|
||||||
* Start vagrant
|
## setup test environments
|
||||||
* vagrant up
|
|
||||||
|
$ sh build/createTestEnvs.sh
|
||||||
|
|
||||||
|
$ source build/bashrc
|
||||||
|
$ mysql_percona80 sakila
|
||||||
|
sakila> ...
|
||||||
|
|
||||||
|
$ docker images
|
||||||
|
mariadb 10.1 fc612450e1f1 12 days ago 352MB
|
||||||
|
mariadb 10.2 027b7c57b8c6 12 days ago 340MB
|
||||||
|
mariadb 10.3 47dff68107c4 12 days ago 343MB
|
||||||
|
mariadb 10.4 92495405fc36 12 days ago 356MB
|
||||||
|
mysql 5.6 95e0fc47b096 2 weeks ago 257MB
|
||||||
|
mysql 5.7 383867b75fd2 2 weeks ago 373MB
|
||||||
|
mysql 8.0 b8fd9553f1f0 2 weeks ago 445MB
|
||||||
|
percona/percona-server 5.7 ddd245ed3496 5 weeks ago 585MB
|
||||||
|
percona/percona-server 5.6 ed0a36e0cf1b 6 weeks ago 421MB
|
||||||
|
percona/percona-server 8.0 390ae97d57c6 6 weeks ago 697MB
|
||||||
|
mariadb 5.5 c7bf316a4325 4 months ago 352MB
|
||||||
|
mariadb 10.0 d1bde56970c6 4 months ago 353MB
|
||||||
|
mysql 5.5 d404d78aa797 4 months ago 205MB
|
||||||
|
|
||||||
|
$ docker ps
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
da2be9b050c9 mariadb:5.5 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5311->3306/tcp mariadb55
|
||||||
|
5deca25d5ac8 mariadb:10.0 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5310->3306/tcp mariadb100
|
||||||
|
73aaeb37e2c2 mariadb:10.1 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5309->3306/tcp mariadb101
|
||||||
|
72ffa77e01ec mariadb:10.2 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5308->3306/tcp mariadb102
|
||||||
|
f5996f2041df mariadb:10.3 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5307->3306/tcp mariadb103
|
||||||
|
4890c52372bb mariadb:10.4 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5306->3306/tcp mariadb104
|
||||||
|
6b9dc078e921 percona/percona-server:5.6 "/docker-entrypoint.…" 7 hours ago Up 7 hours 0.0.0.0:4308->3306/tcp percona56
|
||||||
|
3a4c7c826d4c percona/percona-server:5.7 "/docker-entrypoint.…" 7 hours ago Up 7 hours 0.0.0.0:4307->3306/tcp percona57
|
||||||
|
3dda408c91b0 percona/percona-server:8.0 "/docker-entrypoint.…" 7 hours ago Up 7 hours 33060/tcp, 0.0.0.0:4306->3306/tcp percona80
|
||||||
|
600a4e7e9dcd mysql:5.5 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3309->3306/tcp mysql55
|
||||||
|
4bbe54342e5d mysql:5.6 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3308->3306/tcp mysql56
|
||||||
|
a49783249a11 mysql:5.7 "docker-entrypoint.s…" 7 hours ago Up 7 hours 33060/tcp, 0.0.0.0:3307->3306/tcp mysql57
|
||||||
|
d985820667c2 mysql:8.0 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3306->3306/tcp, 33060/tcp mysql 8 0
|
||||||
|
|
||||||
|
|
||||||
MySQLTuner needs you
|
MySQLTuner needs you
|
||||||
--
|
--
|
||||||
|
|
159
README.ru.md
159
README.ru.md
|
@ -37,22 +37,38 @@ MySQLTuner нуждается в вас:
|
||||||
|
|
||||||
Совместимость
|
Совместимость
|
||||||
====
|
====
|
||||||
|
Результаты тестов: [Travis CI/MySQLTuner-perl](https://travis-ci.org/major/MySQLTuner-perl)
|
||||||
|
* MySQL 8 (полная поддержка, проверка пароля не работает)
|
||||||
* MySQL 5.7 (полная поддержка)
|
* MySQL 5.7 (полная поддержка)
|
||||||
* MySQL 5.6 (полная поддержка)
|
* MySQL 5.6 (полная поддержка)
|
||||||
* MySQL 5.5 (полная поддержка)
|
* MySQL 5.5 (полная поддержка)
|
||||||
|
* MariaDB 10.4 (полная поддержка)
|
||||||
* MariaDB 10.3 (полная поддержка)
|
* MariaDB 10.3 (полная поддержка)
|
||||||
* MariaDB 10.2 (полная поддержка)
|
* MariaDB 10.2 (полная поддержка)
|
||||||
* MariaDB 10.1 (полная поддержка)
|
* MariaDB 10.1 (полная поддержка)
|
||||||
* MariaDB 10.0 (полная поддержка)
|
* MariaDB 10.0 (полная поддержка, последние 6 месяцeв)
|
||||||
|
* MariaDB 5.5 (полная поддержка, но без поддержки от MariaDB)
|
||||||
|
* Percona Server 8.0 (полная поддержка, проверка пароля не работает)
|
||||||
* Percona Server 5.7 (полная поддержка)
|
* Percona Server 5.7 (полная поддержка)
|
||||||
* Percona Server 5.6 (полная поддержка)
|
* Percona Server 5.6 (полная поддержка)
|
||||||
* Percona XtraDB cluster (полная поддержка)
|
* Percona XtraDB cluster (частичная поддержка, нет тестового окружения)
|
||||||
* MySQL 3.23, 4.0, 4.1, 5.0, 5.1 (частичная поддержка - устаревшие версии)
|
|
||||||
|
* Mysql Replications (частичная поддержка, нет тестового окружения)
|
||||||
|
* Galera replication (частичная поддержка, нет тестового окружения)
|
||||||
|
|
||||||
|
* MySQL 3.23, 4.0, 4.1, 5.0, 5.1, 5.5 (частичная поддержка - устаревшие версии)
|
||||||
|
|
||||||
|
*** НЕ ПОДДЕРЖИВАЕМЫЕ ОКРУЖЕНИЯ - НУЖНА ПОМОЩЬ С НИМИ :) ***
|
||||||
|
* Windows не поддерживается на данное время (Необходима помощь!!!!!)
|
||||||
|
* Облачные сервисы(cloud based) не поддерживаются на данное время (Необходима помощь!!!!!)
|
||||||
|
|
||||||
|
* Поддержка детектирования CVE уязвимостей из [https://cve.mitre.org](https://cve.mitre.org)
|
||||||
|
|
||||||
|
*** МИНИМАЛЬНЫЕ ТРЕБОВАНИЯ ***
|
||||||
|
|
||||||
* Perl 5.6 или более поздний (с пакетом [perl-doc](http://search.cpan.org/~dapm/perl-5.14.4/pod/perldoc.pod))
|
* Perl 5.6 или более поздний (с пакетом [perl-doc](http://search.cpan.org/~dapm/perl-5.14.4/pod/perldoc.pod))
|
||||||
* Операционная система семейства Unix/Linux (протестировано на Linux, различных вариациях BSD и Solaris)
|
* Операционная система семейства Unix/Linux (протестировано на Linux, различных вариациях BSD и Solaris)
|
||||||
* Windows не поддерживается на данное время (Необходима помощь!!!!!)
|
|
||||||
* Неограниченный доступ на чтение для MySQL-сервера (Для работы с MySQL < 5.1 требуется root-доступ к серверу)
|
* Неограниченный доступ на чтение для MySQL-сервера (Для работы с MySQL < 5.1 требуется root-доступ к серверу)
|
||||||
* Поддержка детектирования CVE уязвимостей из [https://cve.mitre.org](https://cve.mitre.org)
|
|
||||||
|
|
||||||
Пожалуйста, прочитайте раздел ЧаВо, который расположен чуть ниже.
|
Пожалуйста, прочитайте раздел ЧаВо, который расположен чуть ниже.
|
||||||
|
|
||||||
|
@ -67,6 +83,8 @@ MySQLTuner нуждается в вас:
|
||||||
и всегда будьте готовы к тому, что улучшения в одной области могут иметь
|
и всегда будьте готовы к тому, что улучшения в одной области могут иметь
|
||||||
отрицательный эфект в работе MySQL в другой области.
|
отрицательный эфект в работе MySQL в другой области.
|
||||||
|
|
||||||
|
Так же **важно** подождать, что бы сервер баз данных отработал хотя бы день, для получения точных реультатов. Запуск **mysqltuner** на только что перезапущенном сервере баз данных, по факту полностью бесполезен.
|
||||||
|
|
||||||
**Серьезно - прочитайте раздел ЧаВо, который расположен чуть ниже.**
|
**Серьезно - прочитайте раздел ЧаВо, который расположен чуть ниже.**
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,22 +103,69 @@ MySQLTuner нуждается в вас:
|
||||||
Загрузка/Установка
|
Загрузка/Установка
|
||||||
--
|
--
|
||||||
|
|
||||||
Вы можете скачать весь репозиторий с помощью 'git clone' c URL текущего репозитория. Самый простой и короткий метод:
|
Доступны несколько методов:
|
||||||
|
1) Прямая загрузка скрипта(самый простой и короткий метод):
|
||||||
|
```
|
||||||
|
wget http://mysqltuner.pl/ -O mysqltuner.pl
|
||||||
|
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
|
||||||
|
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv
|
||||||
|
```
|
||||||
|
|
||||||
wget http://mysqltuner.pl/ -O mysqltuner.pl
|
2) Вы можете скачать весь репозиторий с помощью `git clone` или `git clone --depth 1 -b master` c URL текущего репозитория.
|
||||||
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
|
|
||||||
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv
|
|
||||||
perl mysqltuner.pl
|
|
||||||
|
|
||||||
Конечно, вам нужно будет добавить права на выполнение скрипта (chmod +x mysqltuner.pl), если вы хотите запускать его напрямую, без указания perl.
|
|
||||||
|
|
||||||
|
Оциональная установка Sysschema для MySQL 5.6
|
||||||
|
--
|
||||||
|
|
||||||
|
Sysschema по умолчанию установлена на MySQL 5.7 и MySQL 8 от Oracle.
|
||||||
|
В MySQL 5.6/5.7/8 по умолчанию performance schema включена.
|
||||||
|
Для версий старше 5.6 вы можете создать новую базу данных sys, содержащую очень полезный взгляд на Performance schema следующими командами:
|
||||||
|
|
||||||
|
curl "https://codeload.github.com/mysql/mysql-sys/zip/master" > sysschema.zip
|
||||||
|
# check zip file
|
||||||
|
unzip -l sysschema.zip
|
||||||
|
unzip sysschema.zip
|
||||||
|
cd mysql-sys-master
|
||||||
|
mysql -uroot -p < sys_56.sql
|
||||||
|
|
||||||
|
Опциональная установка Performance schema и Sysschema для MariaDB 10.x
|
||||||
|
--
|
||||||
|
|
||||||
|
Sysschema не установлена по умолчанию на MariaDB 10.x.
|
||||||
|
А performance schema по умолчанию отключена в MariaDB. Для активации ее требуется включить в конфигурационном файле my.cnf:
|
||||||
|
|
||||||
|
[mysqld]
|
||||||
|
performance_schema = on
|
||||||
|
|
||||||
|
Вы можете создать новую базу данных sys, содержащую очень полезный взгляд на Performance schema следующими командами:
|
||||||
|
|
||||||
|
curl "https://codeload.github.com/FromDual/mariadb-sys/zip/master" > mariadb-sys.zip
|
||||||
|
# check zip file
|
||||||
|
unzip -l mariadb-sys.zip
|
||||||
|
unzip mariadb-sys.zip
|
||||||
|
cd mariadb-sys-master/
|
||||||
|
mysql -u root -p < ./sys_10.sql
|
||||||
|
|
||||||
|
Ошибки и их решения при установке performance schema
|
||||||
|
|
||||||
|
ERROR at line 21: Failed to open file './tables/sys_config_data_10.sql -- ported', error: 2
|
||||||
|
Посмотрите на #452 решение, данное @ericx
|
||||||
|
|
||||||
|
Советы по производительности
|
||||||
|
--
|
||||||
|
Обновление статистики метадаты могут очень сильно влиять на производительсноить сервера баз данных и MySQLTuner.
|
||||||
|
Убедитесь, что innodb_stats_on_metadata отключен.
|
||||||
|
|
||||||
|
set global innodb_stats_on_metadata = 0;
|
||||||
|
|
||||||
Примеры использования
|
Примеры использования
|
||||||
--
|
--
|
||||||
|
|
||||||
__Пример:__ Минимальный локальный запуск
|
__Пример:__ Минимальный локальный запуск
|
||||||
|
|
||||||
perl mysqltuner.pl
|
perl mysqltuner.pl --host 127.0.0.1
|
||||||
|
|
||||||
|
Конечно, вам нужно будет добавить права на выполнение скрипта (chmod +x mysqltuner.pl), если вы хотите запускать его напрямую, без указания perl.
|
||||||
|
|
||||||
__Пример:__ Минимальный удаленный запуск
|
__Пример:__ Минимальный удаленный запуск
|
||||||
|
|
||||||
|
@ -109,7 +174,7 @@ __Пример:__ Минимальный удаленный запуск
|
||||||
__Пример:__ Включение максимамльного вывода информации о MySQL/MariaDb без отладочной информации
|
__Пример:__ Включение максимамльного вывода информации о MySQL/MariaDb без отладочной информации
|
||||||
|
|
||||||
perl mysqltuner.pl --verbose
|
perl mysqltuner.pl --verbose
|
||||||
perl mysqltuner.pl --buffers --dbstat --idxstat --sysstat --pfstat
|
perl mysqltuner.pl --buffers --dbstat --idxstat --sysstat --pfstat --tbstat
|
||||||
|
|
||||||
|
|
||||||
__Пример:__ Включение проверки на CVE уязвимости для MariaDB или MySQL
|
__Пример:__ Включение проверки на CVE уязвимости для MariaDB или MySQL
|
||||||
|
@ -132,6 +197,10 @@ __Пример:__ Включение вывода отладочной инфо
|
||||||
|
|
||||||
perl mysqltuner.pl --debug
|
perl mysqltuner.pl --debug
|
||||||
|
|
||||||
|
__Пример:__ Обновление MySQLTuner и файлов с данными (пароль и cve), если необходимо.
|
||||||
|
|
||||||
|
perl mysqltuner.pl --checkversion --updateversion
|
||||||
|
|
||||||
ЧаВо
|
ЧаВо
|
||||||
--
|
--
|
||||||
|
|
||||||
|
@ -149,7 +218,7 @@ __Пример:__ Включение вывода отладочной инфо
|
||||||
|
|
||||||
[client]
|
[client]
|
||||||
user=distributions
|
user=distributions
|
||||||
pass=thatuserspassword
|
password=thatuserspassword
|
||||||
|
|
||||||
Сразу после создания файла убедитесь, что его владельцем является ваш пользователь, а права на файл - 0600. Это защитит ваш логин и пароль от базы данных от любопытных глаз в нормальных условиях. Но у вас не будет выбора, если появится [T-1000 в униформе полицейского из Лос-Анджелеса](https://ru.wikipedia.org/wiki/T-1000) и потребует доступы от вашей базы данных.
|
Сразу после создания файла убедитесь, что его владельцем является ваш пользователь, а права на файл - 0600. Это защитит ваш логин и пароль от базы данных от любопытных глаз в нормальных условиях. Но у вас не будет выбора, если появится [T-1000 в униформе полицейского из Лос-Анджелеса](https://ru.wikipedia.org/wiki/T-1000) и потребует доступы от вашей базы данных.
|
||||||
|
|
||||||
|
@ -171,7 +240,7 @@ __Пример:__ Включение вывода отладочной инфо
|
||||||
|
|
||||||
**Вопрос: Какие минимальные привелегии нужны для специального пользователя базы данных mysqltuner?**
|
**Вопрос: Какие минимальные привелегии нужны для специального пользователя базы данных mysqltuner?**
|
||||||
|
|
||||||
mysql>GRANT SELECT, PROCESS,EXECUTE, REPLICATION CLIENT,SHOW DATABASES,SHOW VIEW ON *.* FOR 'mysqltuner'@'localhost' identified by pwd1234;
|
mysql>GRANT SELECT, PROCESS,EXECUTE, REPLICATION CLIENT,SHOW DATABASES,SHOW VIEW ON *.* TO 'mysqltuner'@'localhost' identified by pwd1234;
|
||||||
|
|
||||||
**Вопрос: Это не работает на моей ОС! Что делать?!**
|
**Вопрос: Это не работает на моей ОС! Что делать?!**
|
||||||
|
|
||||||
|
@ -222,15 +291,11 @@ __Пример:__ Включение вывода отладочной инфо
|
||||||
MySQLTuner и Vagrant
|
MySQLTuner и Vagrant
|
||||||
--
|
--
|
||||||
**MySQLTuner** содержится в следующих конфигурациях Vagrant:
|
**MySQLTuner** содержится в следующих конфигурациях Vagrant:
|
||||||
* Fedora Core 23 / MariaDB 10.0
|
* Fedora Core 10 / Docker
|
||||||
* Fedora Core 23 / MariaDB 10.1
|
|
||||||
* Fedora Core 23 / MySQL 5.6
|
|
||||||
* Fedora Core 23 / MySQL 5.7
|
|
||||||
|
|
||||||
**Vagrant File** are stored in Vagrant subdirectory.
|
**Vagrant File** is stored in Vagrant subdirectory.
|
||||||
* Follow this 2 steps after vagrant installation:
|
* Follow following step after vagrant installation:
|
||||||
* Rename VagrantFile_for_Mxxx into Vagrantfile
|
$ vagrant up
|
||||||
* vagrant up
|
|
||||||
|
|
||||||
**MySQLTuner** contains a Vagrant configurations for test purpose and development
|
**MySQLTuner** contains a Vagrant configurations for test purpose and development
|
||||||
* Install VirtualBox and Vagrant
|
* Install VirtualBox and Vagrant
|
||||||
|
@ -241,14 +306,50 @@ MySQLTuner и Vagrant
|
||||||
* Install Vagrant plugins vagrant-hostmanager and vagrant-vbguest
|
* Install Vagrant plugins vagrant-hostmanager and vagrant-vbguest
|
||||||
* vagrant plugin install vagrant-hostmanager
|
* vagrant plugin install vagrant-hostmanager
|
||||||
* vagrant plugin install vagrant-vbguest
|
* vagrant plugin install vagrant-vbguest
|
||||||
* Add Fedora Core 23 box for official Fedora Download Website
|
* Add Fedora Core 30 box for official Fedora Download Website
|
||||||
* vagrant box add --name fc23 https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box
|
* vagrant box add --name generic/fedora30
|
||||||
* Create a data directory
|
* Create a data directory
|
||||||
* mkdir data
|
* mkdir data
|
||||||
* Rename Vagrantfile_MariaDB10.0 into Vagrantfile
|
|
||||||
* cp MySQLTuner-perl/Vagrant/Vagrantfile_for_MariaDB10.0 Vagrantfile
|
|
||||||
* Start vagrant
|
## Настройка тестовых окружений
|
||||||
* vagrant up
|
|
||||||
|
$ sh build/createTestEnvs.sh
|
||||||
|
|
||||||
|
$ source build/bashrc
|
||||||
|
$ mysql_percona80 sakila
|
||||||
|
sakila> ...
|
||||||
|
|
||||||
|
$ docker images
|
||||||
|
mariadb 10.1 fc612450e1f1 12 days ago 352MB
|
||||||
|
mariadb 10.2 027b7c57b8c6 12 days ago 340MB
|
||||||
|
mariadb 10.3 47dff68107c4 12 days ago 343MB
|
||||||
|
mariadb 10.4 92495405fc36 12 days ago 356MB
|
||||||
|
mysql 5.6 95e0fc47b096 2 weeks ago 257MB
|
||||||
|
mysql 5.7 383867b75fd2 2 weeks ago 373MB
|
||||||
|
mysql 8.0 b8fd9553f1f0 2 weeks ago 445MB
|
||||||
|
percona/percona-server 5.7 ddd245ed3496 5 weeks ago 585MB
|
||||||
|
percona/percona-server 5.6 ed0a36e0cf1b 6 weeks ago 421MB
|
||||||
|
percona/percona-server 8.0 390ae97d57c6 6 weeks ago 697MB
|
||||||
|
mariadb 5.5 c7bf316a4325 4 months ago 352MB
|
||||||
|
mariadb 10.0 d1bde56970c6 4 months ago 353MB
|
||||||
|
mysql 5.5 d404d78aa797 4 months ago 205MB
|
||||||
|
|
||||||
|
$ docker ps
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
da2be9b050c9 mariadb:5.5 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5311->3306/tcp mariadb55
|
||||||
|
5deca25d5ac8 mariadb:10.0 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5310->3306/tcp mariadb100
|
||||||
|
73aaeb37e2c2 mariadb:10.1 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5309->3306/tcp mariadb101
|
||||||
|
72ffa77e01ec mariadb:10.2 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5308->3306/tcp mariadb102
|
||||||
|
f5996f2041df mariadb:10.3 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5307->3306/tcp mariadb103
|
||||||
|
4890c52372bb mariadb:10.4 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:5306->3306/tcp mariadb104
|
||||||
|
6b9dc078e921 percona/percona-server:5.6 "/docker-entrypoint.…" 7 hours ago Up 7 hours 0.0.0.0:4308->3306/tcp percona56
|
||||||
|
3a4c7c826d4c percona/percona-server:5.7 "/docker-entrypoint.…" 7 hours ago Up 7 hours 0.0.0.0:4307->3306/tcp percona57
|
||||||
|
3dda408c91b0 percona/percona-server:8.0 "/docker-entrypoint.…" 7 hours ago Up 7 hours 33060/tcp, 0.0.0.0:4306->3306/tcp percona80
|
||||||
|
600a4e7e9dcd mysql:5.5 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3309->3306/tcp mysql55
|
||||||
|
4bbe54342e5d mysql:5.6 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3308->3306/tcp mysql56
|
||||||
|
a49783249a11 mysql:5.7 "docker-entrypoint.s…" 7 hours ago Up 7 hours 33060/tcp, 0.0.0.0:3307->3306/tcp mysql57
|
||||||
|
d985820667c2 mysql:8.0 "docker-entrypoint.s…" 7 hours ago Up 7 hours 0.0.0.0:3306->3306/tcp, 33060/tcp mysql 8 0
|
||||||
|
|
||||||
MySQLTuner нуждается в Вас:
|
MySQLTuner нуждается в Вас:
|
||||||
===
|
===
|
||||||
|
|
136
Vagrant/Vagrantfile
vendored
136
Vagrant/Vagrantfile
vendored
|
@ -1,105 +1,71 @@
|
||||||
# -*- mode: ruby -*-
|
# -*- mode: ruby -*-
|
||||||
# vi: set ft=ruby :
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
Vagrant.configure("2") do |config|
|
||||||
# configures the configuration version (we support older styles for
|
config.vm.box = "generic/fedora30"
|
||||||
# backwards compatibility). Please don't change it unless you know what
|
config.vm.network "private_network", ip: "192.168.50.10", virtualbox__intnet: false
|
||||||
# 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
|
if Vagrant.has_plugin? "vagrant-vbguest"
|
||||||
# boxes at https://atlas.hashicorp.com/search.
|
config.vbguest.no_install = true
|
||||||
|
config.vbguest.auto_update = false
|
||||||
config.vm.box = "centos/7"
|
config.vbguest.no_remote = true
|
||||||
# Disable automatic box update checking. If you disable this, then
|
end
|
||||||
# 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.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.ignore_private_ip = false
|
||||||
config.hostmanager.include_offline = true
|
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.network "public_network"
|
||||||
config.vm.hostname = 'mysql57'
|
config.vm.hostname = 'fedora-generic'
|
||||||
config.hostmanager.aliases = %w(mysql57.localdomain mysql57.local)
|
config.hostmanager.aliases = %w(fedora-generic.localdomain fedora-generic.local fcg.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
|
config.vm.synced_folder "/home/jmren/VagrantMachines/VagrantData", "/data"
|
||||||
# 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|
|
config.vm.provider "virtualbox" do |vb|
|
||||||
vb.name = "mysql57"
|
vb.name="fedora-generic"
|
||||||
vb.memory = "2048"
|
vb.gui = false
|
||||||
vb.cpus = 2
|
vb.memory = "3036"
|
||||||
|
vb.cpus = 4
|
||||||
end
|
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
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
sudo yum -y update
|
|
||||||
echo "secret" | sudo passwd --stdin root
|
echo "secret" | sudo passwd --stdin root
|
||||||
|
echo "secret" | sudo passwd --stdin vagrant
|
||||||
sudo cp -pr ~vagrant/.ssh /root
|
sudo cp -pr ~vagrant/.ssh /root
|
||||||
sudo chown -R root.root /root/.ssh
|
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 dnf -y update
|
||||||
sudo systemctl start mysqld.service
|
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
|
||||||
PASSWORD=$(sudo grep -i "temporary password" /var/log/mysqld.log | cut -d':' -f4 | xargs -n 1 echo)
|
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
|
||||||
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 ..
|
echo "alias h='function hdi(){ howdoi \$* -c -n 5; }; hdi'" >> /tmp/util.sh
|
||||||
cd MySQLTuner-perl
|
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
|
sudo dnf install -y yum-utils device-mapper-persistent-data lvm2
|
||||||
SHELL
|
sudo dnf -y install dnf-plugins-core
|
||||||
config.vm.provision :hostmanager
|
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
|
end
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
8
bashrc
8
bashrc
|
@ -1,8 +0,0 @@
|
||||||
alias gst='git status'
|
|
||||||
alias gcm='git commit -m'
|
|
||||||
alias gmh='git log --follow -p --'
|
|
||||||
alias ll='ls -ls'
|
|
||||||
alias lh='ls -lsh'
|
|
||||||
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")')"
|
|
|
@ -601,6 +601,8 @@ mysql
|
||||||
MySQL
|
MySQL
|
||||||
dba
|
dba
|
||||||
mypass
|
mypass
|
||||||
|
mypasswd
|
||||||
|
mypassword
|
||||||
MyNewPass
|
MyNewPass
|
||||||
some_pass
|
some_pass
|
||||||
admin_pass
|
admin_pass
|
||||||
|
|
69
build/bashrc
Normal file
69
build/bashrc
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
alias gst='git status'
|
||||||
|
alias gcm='git commit -m'
|
||||||
|
alias gmh='git log --follow -p --'
|
||||||
|
alias ll='ls -ls'
|
||||||
|
alias lh='ls -lsh'
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
input="$1"
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
alias mysql_$container_name="mysql -u root -h 127.0.0.1 -P $container_port"
|
||||||
|
done < "$input"
|
||||||
|
}
|
||||||
|
|
||||||
|
exec_mysql()
|
||||||
|
{
|
||||||
|
input="$1"
|
||||||
|
name=$2
|
||||||
|
db=$3
|
||||||
|
sqlfile=$4
|
||||||
|
while IFS='' read -r line
|
||||||
|
do
|
||||||
|
[ -z "$line" ] && continue
|
||||||
|
echo "$line" | grep -q $name
|
||||||
|
[ $? -ne 0 ] && 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)
|
||||||
|
|
||||||
|
|
||||||
|
echo "* Executing $sqlfile on $container_name"
|
||||||
|
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
|
||||||
|
done < "$input"
|
||||||
|
}
|
||||||
|
exec_mysqls()
|
||||||
|
{
|
||||||
|
input="$1"
|
||||||
|
db=$2
|
||||||
|
sqlfile=$3
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
echo "* Executing $sqlfile on $container_name"
|
||||||
|
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
|
||||||
|
done < "$input"
|
||||||
|
}
|
5
build/clearContainer.sh
Normal file
5
build/clearContainer.sh
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
docker ps | awk '{ print $NF}' |grep -v NAMES | xargs -n 1 docker kill
|
||||||
|
docker ps -a | awk '{ print $NF}' |grep -v NAMES | xargs -n 1 docker rm
|
||||||
|
docker ps -a
|
15
build/configimg.conf
Normal file
15
build/configimg.conf
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
3306;mysql80;/var/lib/mysql8;mysql:8.0
|
||||||
|
3307;mysql57;/var/lib/mysql57;mysql:5.7
|
||||||
|
3308;mysql56;/var/lib/mysql56;mysql:5.6
|
||||||
|
3309;mysql55;/var/lib/mysql55;mysql:5.5
|
||||||
|
|
||||||
|
4306;percona80;/var/lib/percona8;percona/percona-server:8.0
|
||||||
|
4307;percona57;/var/lib/percona57;percona/percona-server:5.7
|
||||||
|
4308;percona56;/var/lib/percona56;percona/percona-server:5.6
|
||||||
|
|
||||||
|
5306;mariadb104;/var/lib/mariadb104;mariadb:10.4
|
||||||
|
5307;mariadb103;/var/lib/mariadb103;mariadb:10.3
|
||||||
|
5308;mariadb102;/var/lib/mariadb102;mariadb:10.2
|
||||||
|
5309;mariadb101;/var/lib/mariadb101;mariadb:10.1
|
||||||
|
5310;mariadb100;/var/lib/mariadb100;mariadb:10.0
|
||||||
|
5311;mariadb55;/var/lib/mariadb55;mariadb:5.5
|
90
build/createMassDockerImages.sh
Normal file
90
build/createMassDockerImages.sh
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
input="./build/configimg.conf"
|
||||||
|
default_password="secret"
|
||||||
|
|
||||||
|
echo "[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
|
||||||
|
3308;mysql56;/var/lib/mysql56;mysql:5.6
|
||||||
|
3309;mysql55;/var/lib/mysql55;mysql:5.5
|
||||||
|
|
||||||
|
4306;percona80;/var/lib/percona8;percona/percona-server:8.0
|
||||||
|
4307;percona57;/var/lib/percona57;percona/percona-server:5.7
|
||||||
|
4308;percona56;/var/lib/percona56;percona/percona-server:5.6
|
||||||
|
|
||||||
|
5306;mariadb104;/var/lib/mariadb104;mariadb:10.4
|
||||||
|
5307;mariadb103;/var/lib/mariadb103;mariadb:10.3
|
||||||
|
5308;mariadb102;/var/lib/mariadb102;mariadb:10.2
|
||||||
|
5309;mariadb101;/var/lib/mariadb101;mariadb:10.1
|
||||||
|
5310;mariadb100;/var/lib/mariadb100;mariadb:10.0
|
||||||
|
5311;mariadb55;/var/lib/mariadb55;mariadb:5.5
|
||||||
|
" > "$input"
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
#echo '* PRUNING DOCKER SYSTEM DATA'
|
||||||
|
|
||||||
|
#[ "$1" = "clean" ] || docker system prune -a -f
|
||||||
|
# download all images
|
||||||
|
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" != "clean" ]; then
|
||||||
|
echo $line | grep -q "$1"
|
||||||
|
[ $? -eq 0 ] || continue
|
||||||
|
fi
|
||||||
|
echo "* PULLING DOCKER IMAGE: $image_name"
|
||||||
|
docker images | grep -E " $image_name$"
|
||||||
|
[ $? -ne 0 ] && docker pull $image_name
|
||||||
|
|
||||||
|
echo "* REMOVING CONTAINER : $image_name"
|
||||||
|
docker ps -a | grep -qE "$container_name^"
|
||||||
|
docker rm -f $container_name
|
||||||
|
|
||||||
|
if [ 1 -eq 0 ]; then
|
||||||
|
echo "* DELETING DATADIR: $container_datadir"
|
||||||
|
sudo rm -rf $container_datadir
|
||||||
|
[ "$1" = "clean" ] && continue
|
||||||
|
|
||||||
|
echo "* CREATING DATADIR: $container_datadir"
|
||||||
|
sudo mkdir -p $container_datadir
|
||||||
|
fi
|
||||||
|
#sudo chown -R mysql.mysql $container_datadir
|
||||||
|
sudo chmod 777 $container_datadir
|
||||||
|
echo "* STARTING CONTAINER: $container_name($container_port/TCP) BASED ON $image_name -> $container_datadir"
|
||||||
|
set -x
|
||||||
|
docker run -d -e MYSQL_ROOT_PASSWORD=$default_password -p $container_port:3306 --name $container_name -v $container_datadir:/var/lib/mysql $image_name
|
||||||
|
set +x
|
||||||
|
sleep 6s
|
||||||
|
echo "* LOGS: $container_name"
|
||||||
|
docker logs $container_name
|
||||||
|
echo "* LISTING PORTS: $container_name BASED ON $image_name"
|
||||||
|
docker port $container_name
|
||||||
|
|
||||||
|
echo "* LISTING VOLUMES: $container_name BASED ON $image_name"
|
||||||
|
docker inspect -f "{{ .Mounts }}" $container_name
|
||||||
|
|
||||||
|
echo "* LISTING $container_datadir"
|
||||||
|
ls -ls $container_datadir
|
||||||
|
#break
|
||||||
|
docker logs $container_name | grep -q "ready for connections"
|
||||||
|
done < "$input"
|
||||||
|
|
||||||
|
echo "* LISTING DOCKER IMAGES"
|
||||||
|
docker images
|
||||||
|
|
||||||
|
echo "* LISTING DOCKER CONTAINER"
|
||||||
|
docker ps
|
||||||
|
|
28
build/createTestEnvs.sh
Normal file
28
build/createTestEnvs.sh
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
source build/bashrc
|
||||||
|
|
||||||
|
systemctl status docker &>/dev/null
|
||||||
|
if [ $? -ne 0 ];then
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
35
build/fetchSampleDatabases.sh
Normal file
35
build/fetchSampleDatabases.sh
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
DB_WORLD_URL="https://downloads.mysql.com/docs/world.sql.zip"
|
||||||
|
DB_WORLDX_URL="https://downloads.mysql.com/docs/world_x-db.zip"
|
||||||
|
DB_SAKILA_URL="https://downloads.mysql.com/docs/sakila-db.zip"
|
||||||
|
DB_MESSAGERIE_URL="https://downloads.mysql.com/docs/menagerie-db.zip"
|
||||||
|
DB_TESTDB_URL="https://github.com/datacharmer/test_db/archive/master.zip"
|
||||||
|
|
||||||
|
getVal()
|
||||||
|
{
|
||||||
|
local vari=$1
|
||||||
|
eval "echo \$$vari"
|
||||||
|
}
|
||||||
|
case "$1" in
|
||||||
|
"fetchall")
|
||||||
|
for sample in WORLD WORLDX SAKILA MESSAGERIE TESTDB; do
|
||||||
|
sh $0 fetch $sample
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
"fetch")
|
||||||
|
[ -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")
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
(cd contents; unzip $( basename $(getVal "DB_$2_URL")) )
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"clean")
|
||||||
|
rm -rf contents
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown operation: $1"
|
||||||
|
;;
|
||||||
|
esac
|
26
build/runMT.sh
Normal file
26
build/runMT.sh
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/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
|
||||||
|
shift
|
||||||
|
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 $* --host 127.0.0.1 --port $container_port
|
||||||
|
exit $?
|
||||||
|
done < "$input"
|
|
@ -8,7 +8,7 @@ perltidy -b mysqltuner.pl
|
||||||
)
|
)
|
||||||
echo "* Update CVE list"
|
echo "* Update CVE list"
|
||||||
perl updateCVElist.pl
|
perl updateCVElist.pl
|
||||||
|
dos2unix ../mysqltuner.pl
|
||||||
git add ../vulnerabilities.csv ../mysqltuner.pl ../USAGE.md
|
git add ../vulnerabilities.csv ../mysqltuner.pl ../USAGE.md
|
||||||
git commit -m 'Update Vulnerabilities list
|
git commit -m 'Update Vulnerabilities list
|
||||||
Indenting mysqltuner
|
Indenting mysqltuner
|
||||||
|
|
6677
mysqltuner.pl
6677
mysqltuner.pl
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue