Merge pull request #2 from major/master

Merge to fork
This commit is contained in:
Drew Schatt 2018-05-21 16:07:45 -07:00 committed by GitHub
commit c955c12d1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 2228 additions and 1222 deletions

2
.gitignore vendored
View file

@ -3,3 +3,5 @@ build/mysqltuner.spec
build/build.log
build/cve*
build/vulnerabilities*
*.bak
Vagrant/Vagrantfile

View file

@ -27,7 +27,7 @@ following restrictions:
respect the opinions of others.
##Before submitting an issue##
## Before submitting an issue
1. Upgrade to the latest version of MySQLTuner and see if the problem remains
@ -47,7 +47,7 @@ Good bug reports are extremely helpful — thank you!
Guidelines for bug reports:
1. **Use the [GitHub issue search](https://github.com/major/MySQLTuner-perl/search?type=Issues)** — check if the issue has already been
1. **Use the [GitHub issue search]** — check if the issue has already been
reported.
2. **Check if the bug has already been fixed** — try to reproduce it using the
@ -100,13 +100,13 @@ to MySQLTuner will be evaluated on a combination of scope (how well it fits into
project), maintenance burden and general usefulness.
Creating something great often means saying no to seemingly good ideas. Don't
dispair if your feature request isn't accepted, take action! Fork the
despair if your feature request isn't accepted, take action! Fork the
repository, build your idea and share it with others. We released MySQLTuner under
the MIT License for this purpose precisely. Open source works best when smart
and dedicated people riff off of each others' ideas to make even greater things.
## New feature request ##
* You can find Enhancement asked by community at [Enhancement issue](https://github.com/major/MySQLTuner-perl/labels/enhancement)
## New feature request
You can find Enhancement asked by community at [Enhancement issue]
<a name="pull-requests"></a>
## Pull requests
@ -153,8 +153,7 @@ these guidelines is the best way to get your work included in MySQLTuner.
git checkout -b <topic-branch-name>
```
4. Commit your changes in logical chunks. Please adhere to these [git commit
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
4. Commit your changes in logical chunks. Please adhere to these [git commit message guidelines]
or your code is unlikely be merged into the main project. Use Git's
[interactive rebase](https://help.github.com/articles/interactive-rebase)
feature to tidy up your commits before making them public.
@ -171,18 +170,23 @@ these guidelines is the best way to get your work included in MySQLTuner.
git push origin <topic-branch-name>
```
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
with a clear title and description.
7. [Open a Pull Request] with a clear title and description.
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
license your work under the [GPLv3 License](https://en.wikipedia.org/wiki/GNU_General_Public_License).
license your work under the [GPLv3 License].
Copy of the license is available at [LICENSE](https://github.com/major/MySQLTuner-perl/blob/master/LICENSE)
Copy of the license is available at [LICENSE]
<a name="code-conventions"></a>
#### MySQLTuner Code Conventions
## MySQLTuner Code Conventions
1. Check code convention using **perltidy** and **perlcritic**
2. Don't manually update the version number in `mysqltuner.pl`.
[Enhancement issue]:https://github.com/major/MySQLTuner-perl/labels/enhancement
[GitHub issue search]:https://github.com/major/MySQLTuner-perl/search?type=Issues
[git commit message guidelines]:http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[Open a Pull Request]:https://help.github.com/articles/using-pull-requests/
[GPLv3 License]:https://en.wikipedia.org/wiki/GNU_General_Public_License
[LICENSE]:https://github.com/major/MySQLTuner-perl/blob/master/LICENSE

View file

@ -84,7 +84,7 @@
## MySQLTuner Server version checks
* EOL MySQL version check
* Currently MySQL < 5.1 are EOF considerated.
* Currently MySQL < 5.1 are EOF considered.
* Using 5.5+ version of MySQL for performance issue (asynchronous IO).
## MySQL Storage engine general information
@ -179,7 +179,7 @@
* Query Cache Buffers
* Query Cache DISABLED, ALL REQUEST or ON DEMAND
* Query Cache Size
* Query cache hit ratio (cache efficienty)
* Query cache hit ratio (cache efficiency)
## MySQLTuner memory checks
@ -194,11 +194,16 @@
## MySQLTuner replication checks
* Is server replication configuarted as slave ?
* SQL replacation thread running ?
* IO replacation thread running ?
* Replication lag in seconds
* Is Slave configuratedd in read only ?
* Is server replication configured as slave ?
* SQL replication thread running ?
* IO replication thread running ?
* Replication lag in seconds (Seconds_behind_master)
* Is Slave configured in read only ?
* replication type ROW, MIX, STMT
* replication Semisync master
* replication Semisync slave
* XA support activated
* replication started ?
## MySQLTuner InnoDB information
@ -206,14 +211,16 @@
* If possible, innodb_buffer_pool_size should be greater data and index size for Innodb Table
* Innodb_buffer_pool_size should around 75 to 80 % of the available system memory.
* InnoDB Buffer Pool Instances
* MySQL needs 1 instanes 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 must be equals or lower than 64
* InnoDB Buffer Pool Usage
* If more than 20% of InnoDB buffer pool is not used, MySQLTuner raise an alert.
* InnoDB Read effiency
* InnoDB Buffer Pool Log Size
* InnoDB total log file size should be 25% of innodb_buffer_pool_size
* InnoDB Read efficiency
* Ratio of read without locks
* InnoDB Write effiency
* InnoDB Write efficiency
* Ratio of write without locks
* InnoDB Log Waits
* Checks that no lock is used on Innodb Log.
@ -249,6 +256,10 @@
* Joiner(Try to reach cluster group)
* SYNCED state able to read/write
* wsrep_cluster_conf_id configuration level must be identical in all nodes
* wsrep_slave_thread is between 3 or 4 times number of CPU core.
* gcs.limit should be equal to wsrep_slave_threads * 5
* gcs.fc_factor should be equal to 0.8
* Flow control fraction should be lower than 0.02 (wsrep_flow_control_paused < 0.02)
* wsrep_last_commited committed level must be identical in all nodes
* Look for tables without primary keys
* Look for non InnoDB tables for Galera
@ -292,7 +303,9 @@
* thread_pool_size between 4 to 8 for MyIsam usage
## MySQLTuner performance schema and sysschema information
* Check that Performance schema is activated for 5.6+ version
* Check that Performance schema is deactivated for 5.5- version
* Check that Sys schema is installed
* sys Schema version
* Top user per connection
* Top user per statement

View file

@ -4,17 +4,17 @@ MySQLTuner-perl
[![Project Status](http://opensource.box.com/badges/active.svg)](http://opensource.box.com/badges)
[![Project Status](http://opensource.box.com/badges/maintenance.svg)](http://opensource.box.com/badges)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Percentage of issues still open")
[![GPL Licence](https://badges.frapsoft.com/os/gpl/gpl.png?v=103)](https://opensource.org/licenses/GPL-3.0/)
[![Percentage of open issues](http://isitmaintained.com/badge/open/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Percentage of issues still open")
[![GPL License](https://badges.frapsoft.com/os/gpl/gpl.png?v=103)](https://opensource.org/licenses/GPL-3.0/)
**MySQLTuner** is a script written in Perl that allows you to review a MySQL installation quickly and make adjustments to increase performance and stability. The current configuration variables and status data is retrieved and presented in a brief format along with some basic performance suggestions.
**MySQLTuner** supports in this last version ~300 indicators for MySQL/MariaDB/Percona Server.
**MySQLTuner** supports ~300 indicators for MySQL/MariaDB/Percona Server in this last version.
**MySQLTuner** is maintained and indicator collect is increasing week after week supporting a lot of configuration such as ![Galera Cluster](http://galeracluster.com/), ![TokuDB](https://www.percona.com/software/mysql-database/percona-tokudb), ![ Performance schema](https://github.com/mysql/mysql-sys), Linux OS metrics, ![InnoDB](http://dev.mysql.com/doc/refman/5.7/en/innodb-storage-engine.html), ![MyISAM](http://dev.mysql.com/doc/refman/5.7/en/myisam-storage-engine.html), ![Aria](https://mariadb.com/kb/en/mariadb/aria/), ...
**MySQLTuner** is maintained and indicator collect is increasing week after week supporting a lot of configuration such as [Galera Cluster](http://galeracluster.com/), [TokuDB](https://www.percona.com/software/mysql-database/percona-tokudb), [Performance schema](https://github.com/mysql/mysql-sys), Linux OS metrics, [InnoDB](http://dev.mysql.com/doc/refman/5.7/en/innodb-storage-engine.html), [MyISAM](http://dev.mysql.com/doc/refman/5.7/en/myisam-storage-engine.html), [Aria](https://mariadb.com/kb/en/mariadb/aria/), ...
You can found more details on this indicators
![Indicators description](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md).
You can find more details on these indicators here:
[Indicators description](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md).
![MysqlTuner](https://github.com/major/MySQLTuner-perl/blob/master/mysqltuner.png)
@ -22,9 +22,9 @@ You can found more details on this indicators
MySQLTuner needs you:
===
**MySQLTuner** needs contributors for documentation, code and feedbacks..
**MySQLTuner** needs contributors for documentation, code and feedback..
* Please join us on issue track at [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues)</a>.
* Please join us on issue track at [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues).
* Contribution guide is available following [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md)
* Star **MySQLTuner project** at [MySQLTuner Git Hub Project](https://github.com/major/MySQLTuner-perl)
@ -34,8 +34,11 @@ Compatibility:
* MySQL 5.7 (full support)
* MySQL 5.6 (full support)
* MySQL 5.5 (full support)
* MariaDB 10.3 (full support)
* MariaDB 10.2 (full support)
* MariaDB 10.1 (full support)
* MariaDB 10.0 (full support)
* Percona Server 5.7 (full support)
* Percona Server 5.6 (full support)
* Percona XtraDB cluster (full support)
* MySQL 3.23, 4.0, 4.1, 5.0, 5.1 (partial support - deprecated version)
@ -43,7 +46,7 @@ Compatibility:
* 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)
* CVE vulnerabilites detection support from [https://cve.mitre.org](https://cve.mitre.org)
* CVE vulnerabilities detection support from [https://cve.mitre.org](https://cve.mitre.org)
***WARNING***
--
@ -57,6 +60,14 @@ MySQL in other areas.
**Seriously - please review the FAQ section below.**
Security recommendations
--
Hi directadmin user!
We detected that you run mysqltuner with da_admin's credentials taken from /usr/local/directadmin/conf/my.cnf, which might bring to a password discovery!
Read link for more details [Issue #289](https://github.com/major/MySQLTuner-perl/issues/289).
What MySQLTuner is checking exactly ?
--
All checks done by **MySQLTuner** are documented in [MySQLTuner Internals](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md) documentation.
@ -115,7 +126,7 @@ FAQ
**Question: Will MySQLTuner fix my slow MySQL server?**
**No.** MySQLTuner is a read only script. It won't write to any configuration files, change the status of any daemons, or call your mother to wish her a happy birthday. It will give you an overview of your server's performance and make some basic recommendations about improvements that you can make after it completes. *Make sure you read the warning above prior to following any recommendations.*
**No.** MySQLTuner is a read only script. It won't write to any configuration files, change the status of any daemons, or call your mother to wish her a happy birthday. It will give you an overview of your server's performance and make some basic recommendations for improvements that you can make after it completes. *Make sure you read the warning above prior to following any recommendations.*
**Question: Can I fire my DBA now?**
@ -136,10 +147,10 @@ Once you create it, make sure it's owned by your user and the mode on the file i
You could use mysql_config_editor utilities.
$ mysql_config_editor set --login-path=client --user=someusername --password --host=localhost
Enter passord: ********
Enter password: ********
$
At this time, ~/.mylogin.cnf has been written with appropriated rigth access.
After which, ~/.mylogin.cnf will be created with the appropriate access.
To get information about stored credentials, use the following command:
@ -181,7 +192,7 @@ Connection and Authentication
--port <port> Port to use for connection (default: 3306)
--user <username> Username to use for authentication
--pass <password> Password to use for authentication
--defaults-file <path> defaulfs file for credentials
--defaults-file <path> defaults file for credentials
Since you are using a remote host, use parameters to supply values from the OS
@ -195,6 +206,10 @@ If the database has too many tables, or very large table, use this:
--skipsize Don't enumerate tables and their types/sizes (default: on)
(Recommended for servers with many tables)
**Question: Can I install this project using homebrew on Apple Macintosh?**
Yes! `brew install mysqltuner` can be used to install this application using [homebrew](https://brew.sh/) on Apple Macintosh.
MySQLTuner and Vagrant
--
**MySQLTuner** contains following Vagrant configurations:
@ -228,9 +243,8 @@ MySQLTuner and Vagrant
MySQLTuner needs you
--
**MySQLTuner** needs contributors for documentation, code and feedbacks..
**MySQLTuner** needs contributors for documentation, code and feedback..
* Please join us on issue track at [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues)</a>.
* Contribution guide is avalaible following [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md)
* Please join us on issue track at [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues).
* Contribution guide is available following [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md)
* Star **MySQLTuner project** at [MySQLTuner Git Hub Project](https://github.com/major/MySQLTuner-perl)

View file

@ -13,10 +13,11 @@ MySQLTuner-perl
**MySQLTuner** поддерживает порядка 300 показателей для MySQL/MariaDB/Percona Server последних версий.
**MySQLTuner** поддерживает сбор показателей для множества таких конфигураций, как ![Galera Cluster](http://galeracluster.com/), ![TokuDB](https://www.percona.com/software/mysql-database/percona-tokudb), ![ Performance schema](https://github.com/mysql/mysql-sys), Linux OS metrics, ![InnoDB](http://dev.mysql.com/doc/refman/5.7/en/innodb-storage-engine.html), ![MyISAM](http://dev.mysql.com/doc/refman/5.7/en/myisam-storage-engine.html), ![Aria](https://mariadb.com/kb/en/mariadb/aria/), ...
**MySQLTuner** поддерживает сбор показателей для множества таких конфигураций, как [Galera Cluster](http://galeracluster.com/), [TokuDB](https://www.percona.com/software/mysql-database/percona-tokudb), [Performance schema](https://github.com/mysql/mysql-sys), метрики ОС Linux, [InnoDB](http://dev.mysql.com/doc/refman/5.7/en/innodb-storage-engine.html), [MyISAM](http://dev.mysql.com/doc/refman/5.7/en/myisam-storage-engine.html), [Aria](https://mariadb.com/kb/en/mariadb/aria/), ...
Вы можете найти больше информации об этих показателях на
![Indicators description](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md).
[Indicators description](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md).
![MysqlTuner](https://github.com/major/MySQLTuner-perl/blob/master/mysqltuner.png)
@ -26,7 +27,7 @@ MySQLTuner нуждается в вас:
**MySQLTuner** нуждается в вашем вкладе в документацию и код, а так же ждёт обратную связь.
* Присоединяйтесь, пожалуйста, к нашему трекеру ошибок [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues)</a>.
* Присоединяйтесь, пожалуйста, к нашему трекеру ошибок [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues).
* Руководство по поддержке проекта доступно на [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md)
* Ставьте "звезды" **проекту MySQLTuner** на [MySQLTuner Git Hub Project](https://github.com/major/MySQLTuner-perl)
@ -61,6 +62,15 @@ MySQLTuner нуждается в вас:
**Серьезно - прочитайте раздел ЧаВо, который расположен чуть ниже.**
Рекомендации по безопасности
--
Здравствуй, пользователь directadmin!
Мы обнаружили, что запуск mysqltuner с доступами da_admin, взятыми из файла /usr/local/directadmin/conf/my.cnf, может привести к компрометации пароля!
Детали можно прочитать по ссылке [Issue #289](https://github.com/major/MySQLTuner-perl/issues/289).
Что именно проверяет MySQLTuner?
--
Все проверки, что выполняет **MySQLTuner**, задокументированы в [MySQLTuner Internals](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md)
@ -199,6 +209,10 @@ __Пример:__ Включение вывода отладочной инфо
--skipsize Don't enumerate tables and their types/sizes (default: on)
(Recommended for servers with many tables)
**Вопрос: Я могу установить этот проект с помощью homebrew на Apple Macintosh?**
Да! Вы можете уставновить его командой `brew install mysqltuner` с помощью [homebrew](https://brew.sh/) на Apple Macintosh.
MySQLTuner и Vagrant
--
**MySQLTuner** содержится в следующих конфигурациях Vagrant:
@ -235,7 +249,7 @@ MySQLTuner нуждается в Вас:
**MySQLTuner** нуждается в вашем вкладе в документацию и код, а так же ждёт обратную связь.
* Присоединяйтесь, пожалуйста, к нашему трекеру ошибок [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues)</a>.
* Присоединяйтесь, пожалуйста, к нашему трекеру ошибок [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues).
* Руководство по поддержке проекта доступно на [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md)
* Ставьте "звезды" **проекту MySQLTuner** на [MySQLTuner Git Hub Project](https://github.com/major/MySQLTuner-perl)

View file

@ -1,6 +1,6 @@
# NAME
MySQLTuner 1.6.20 - MySQL High Performance Tuning Script
MySQLTuner 1.7.9 - MySQL High Performance Tuning Script
# IMPORTANT USAGE GUIDELINES
@ -9,17 +9,21 @@ Allow MySQL server to run for at least 24-48 hours before trusting suggestions
Some routines may require root level privileges (script will provide warnings)
You must provide the remote server's total memory when connecting to other servers
# CONNECTION AND AUTHENTIFICATION
# CONNECTION AND AUTHENTICATION
--host <hostname> Connect to a remote host to perform tests (default: localhost)
--socket <socket> Use a different socket for a local connection
--port <port> Port to use for connection (default: 3306)
--user <username> Username to use for authentication
--userenv <envvar> Name of env variable which contains username to use for authentication
--pass <password> Password to use for authentication
--passenv <envvar> Name of env variable which contains password to use for authentication
--ssl-ca <path> Path to public key
--mysqladmin <path> Path to a custom mysqladmin executable
--mysqlcmd <path> Path to a custom mysql executable
--defaults-file <path> Path to a custom .my.cnf
=head1 PERFORMANCE AND REPORTING OPTIONS
# PERFORMANCE AND REPORTING OPTIONS
--skipsize Don't enumerate tables and their types/sizes (default: on)
(Recommended for servers with many tables)
@ -43,7 +47,7 @@ You must provide the remote server's total memory when connecting to other serve
--pfstat Print Performance schema
--bannedports Ports banned separated by comma(,)
--maxportallowed Number of ports opened allowed on this hosts
--cvefile CVE File for vulnerability checks
--cvefile <path> CVE File for vulnerability checks
--nocolor Don't print output in color
--json Print result as JSON string
--buffers Print global and per-thread buffer values
@ -51,7 +55,8 @@ You must provide the remote server's total memory when connecting to other serve
--reportfile <path> Path to a report txt file
--template <path> Path to a template file
--verbose Prints out all options (default: no verbose)
=head1 PERLDOC
# PERLDOC
You can find documentation for this module with the perldoc command.
@ -120,7 +125,7 @@ Maintained by Major Hayden (major\\@mhtx.net) - Licensed under GPL
# COPYRIGHT AND LICENSE
Copyright (C) 2006-2015 Major Hayden - major@mhtx.net
Copyright (C) 2006-2017 Major Hayden - major@mhtx.net
For the latest updates, please visit http://mysqltuner.com/
@ -138,4 +143,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see &lt;http://www.gnu.org/licenses/>.

99
Vagrant/Vagrantfile vendored Normal file
View file

@ -0,0 +1,99 @@
# -*- 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-0"
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 yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install mariadb mariadb-server wget
sudo systemctl start mariadb.service
mysql -e 'select version();'
cd /data
sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2"
sudo tar xvjf employees_db-full-1.0.6.tar.bz2
cd employees_db
cat employees.sql | mysql
cd ..
cd MySQLTuner-perl
perl mysqltuner.pl --idxstat --dbstat
SHELL
config.vm.provision :hostmanager
end

View file

@ -12,11 +12,7 @@ Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "fc23-mariadb10-0"
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 = "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
@ -24,6 +20,12 @@ Vagrant.configure(2) do |config|
# 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"
@ -74,17 +76,30 @@ Vagrant.configure(2) do |config|
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 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-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 yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils
sudo cpanm install File::Util
sudo yum -y install mariadb mariadb-server wget
sudo systemctl start mariadb.service
#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"

View file

@ -12,11 +12,7 @@ Vagrant.configure(2) do |config|
# 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 = "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
@ -24,6 +20,12 @@ Vagrant.configure(2) do |config|
# 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"
@ -74,25 +76,30 @@ Vagrant.configure(2) do |config|
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 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
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.1/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
#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"

View file

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

View file

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

View file

@ -4,5 +4,5 @@ cp Vagrantfile_for_MariaDB10.0 Vagrantfile
mkdir data
vagrant plugin install vagrant-hostmanager
vagrant plugin install vagrant-vbguest
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 up
vagrant plugin install vagrant-proxyconf
vagrant --provision up

12
build/deployOn Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
set -xv
_DIR=$(dirname `readlink -f $0`)
ssh $1 mkdir /images/mysqltuner
rsync -avz ${_DIR}/.. $1:/images/mysqltuner
if [ "$2" = "run" ];then
ssh $1 "su - mysql -c 'cd /images/mysqltuner; source /opt/mysql/myqenv myserver1;perl mysqltuner.pl --verbose --color'"
fi

View file

@ -5,7 +5,7 @@ use WWW::Mechanize::GZip;
use File::Util;
use Data::Dumper;
use List::MoreUtils qw(uniq);
my $verbose;
my $verbose=1;
sub AUTOLOAD {
use vars qw($AUTOLOAD);
my $cmd = $AUTOLOAD;
@ -40,17 +40,18 @@ $mech->add_handler("response_redirect" => sub { print '#'x80,"\nREDIRECT RESPONS
my $url = 'http://cve.mitre.org/data/downloads/allitems.csv';
my $resp;
unlink ('cve.csv') if (-f 'cve.csv');
unless (-f 'cve.csv') {
$resp=$mech->get($url);
$mech->save_content( "cve.csv" );
}
my $f=File::Util->new( readlimit => 152428800);
File::Util->flock_rules( qw/ IGNORE/ );
my $f=File::Util->new('readlimit' => 100000000, 'use_flock'=>'false');
my(@lines) = $f->load_file('cve.csv', '--as-lines');
my @versions;
my $temp;
unlink '../vulnerabilities.csv' if -f '../vulnerabilities.csv';
foreach my $line (@lines) {
open(CVE, 'cve.csv') or die("Could not open file.");
foreach my $line (<CVE>) {
if ($line =~ /(mysql|mariadb)/i
and $line =~ /server/i
and $line =~ /CANDIDATE/i
@ -64,13 +65,15 @@ foreach my $line (@lines) {
foreach my $vers (uniq(@versions)) {
my @nb=split('\.', $vers);
$nb[2]-- if ($line =~ /before/i);
#print $vers."\n".Dumper @nb;
#exit 0;
$f->write_file('file' => '../vulnerabilities.csv', 'content' => "$vers;$nb[0];$nb[1];$nb[2];$line\n", 'mode' => 'append');
#print "$line";
#exit 0 if ($line =~/before/i) ;
$f->write_file('file' => '../vulnerabilities.csv', 'content' => "$nb[0].$nb[1].$nb[2];$nb[0];$nb[1];$nb[2];$line", 'mode' => 'append');
}
}
}
unlink ('cve.csv') if (-f 'cve.csv');
close(CVE);
#unlink ('cve.csv') if (-f 'cve.csv');
exit(0);

15
build/updateStaff.sh Normal file
View file

@ -0,0 +1,15 @@
#!/bin/sh
(cd ..
echo "* GENERATING USAGE FILE"
pod2markdown mysqltuner.pl >USAGE.md
echo "* TIDYFY SCRIPT"
perltidy -b mysqltuner.pl
)
echo "* Update CVE list"
perl updateCVElist.pl
git add ../vulnerabilities.csv ../mysqltuner.pl ./USAGE.md
git commit -m 'Update Vulnerabilities list
Indenting mysqltuner
Update Usage information'

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff