-- background cloud
Used to like the source of the installation of MySQL, always feel that the source code is tall on the matter, but the source code also need time, especially when make, if the disk and the CPU is poor, the time is very long, in the virtual machine installed MySQL especially slow.
Now the business development, began to deploy in the cloud, need to install MySQL frequently, and sometimes deploy a lot of stations, if the source is installed one by one to execute, the efficiency is relatively poor, so ready to adopt a faster and more efficient binary system to achieve a single-button automatic installation of MySQL.
1,mysql binary installation package
: http://download.csdn.net/detail/mchdba/9488918, including
1) One-click Automatic installation script: auto_install_mysql5.7.sh;
2) MySQL parameter file my.cnf
3) Mysql5.7 binary installation package, there is a connection in the Readme_mysql5.7_down_address.txt file, more than the MySQL website download speed many times faster.
PS: After downloading, put the script already all the software in the same directory such as the/soft directory.
Blog Source Address: http://blog.csdn.net/mchdba/article/details/51138063, declined reprint.
2, automating the initialization of Linux server Scripts
Execution of Bash-x init_linux.sh started the automatic initialization of the Linux server, the automated installation script init_linux.sh as follows, for http://download.csdn.net/detail/mchdba/9488929:
#1 instal jdk, add tomcat user SH init_jdk.sh Useradd Tomcat Mkdir-p/usr/local/app/ Chown-r Tomcat.tomcat/usr/local/app #2 # Vim/etc/sudoers echo "Tomcat all= (All) all" >>/etc/sudoers #3 Set limits.conf echo "* Soft nofile 65536" >>/etc/security/limits.conf echo "* Hard Nofile 65536" >>/etc/security/limits.conf Ulimit-a #4 Kernel optimization grep "Net.ipv4.tcp_keepalive_time ="/etc/sysctl.conf If [$?! = 0] Then Cat <<EOF>>/etc/sysctl.conf Net.ipv4.tcp_max_tw_buckets = 6000 Net.ipv4.ip_local_port_range = 1024 65000 net.ipv4.tcp_tw_recycle = 0 Net.ipv4.tcp_tw_reuse = 1 Net.core.somaxconn = 262144 Net.core.netdev_max_backlog = 262144 Net.ipv4.tcp_max_orphans = 262144 Net.ipv4.tcp_max_syn_backlog = 262144 Net.ipv4.tcp_synack_retries = 2 Net.ipv4.tcp_syn_retries = 1 Net.ipv4.tcp_fin_timeout = 1 Net.ipv4.tcp_keepalive_time = 30 Net.ipv4.tcp_keepalive_probes = 6 NET.IPV4.TCP_KEEPALIVE_INTVL = 5 Net.ipv4.tcp_timestamps = 0 Eof Sed-i ' s/net.bridge.bridge-nf-call-ip6tables = 0/#net. bridge.bridge-nf-call-ip6tables = 0/g '/etc/sysctl.conf Sed-i ' s/net.bridge.bridge-nf-call-iptables = 0/#net. bridge.bridge-nf-call-iptables = 0/g '/etc/sysctl.conf Sed-i ' s/net.bridge.bridge-nf-call-arptables = 0/#net. bridge.bridge-nf-call-arptables = 0/g '/etc/sysctl.conf Fi Sysctl-p #5 SELinux Disabled Sed-i ' s/selinux=enforcing/selinux=disabled/g '/etc/sysconfig/selinux Sed-i ' s/id:5:initdefault:/id:3:initdefault:/g '/etc/inittab #6 Stop Some services Service Iptables Stop SH stopservice.sh #7 See the version #less/etc/issue #8 Set 90-nproc Sed-i ' s/* soft nproc 1024/#* soft nproc 1024/g '/etc/security/limits.d/90-nproc.conf Sed-i ' s/root soft nproc unlimited/* soft nproc unlimited/g '/etc/security/limits.d/90-nproc. Conf #9 System basic LIB package install Yum install gcc gcc-c++ ncurses-devel.x86_64 cmake.x86_64 libaio.x86_64 bison.x86_64 gcc-c++.x86_64 bind-utils wget Curl C Url-devel Perl openssh-clients Setuptool sysstat-y Yum Search Rz-y Yum Install-y lrzsz.x86_64 #10 Set Shanghai Time Cp-f/usr/share/zoneinfo/asia/shanghai/etc/localtime Hwclock #11 Restart the Linux server Shutdown-r now |
3, automated installation scripts
Execute the script bash-x auto_install_mysql5.7.sh, start a one-click installation, and automate the installation script as follows:
# Install the Basie Lib Yum Install Cmake-y Groupadd MySQL useradd-g MySQL MySQL autoreconf--force--install Libtoolize--automake--force Automake--force--add-missing Yum Install-y libtoolize Yum install gcc gcc-c++-y Yum Install-y ncurses-devel.x86_64 Yum Install-y cmake.x86_64 Yum Install-y libaio.x86_64 Yum Install-y bison.x86_64 Yum Install-y gcc-c++.x86_64 Yum Install Make-y # add MySQL account,create the basic directory Mkdir-p/data/mysql/data Cd/data/mysql/data Chown-r Mysql.mysql/data Chown-r mysql.mysql/usr/local/mysql5711 Mkdir-p/data/mysql/binlog/ Chown-r mysql.mysql/data/mysql/binlog/ cd/usr/local/mysql5711/ # init databases rm-rf/data/mysql/data/* CP MY.CNF/USR/LOCAL/MYSQL5711/MY.CNF Time Bin/mysqld--defaults-file=/usr/local/mysql5711/my.cnf--initialize--user=mysql # Set the auto start on Linux server started CP Support-files/mysql.server/etc/init.d/mysql chmod 700/etc/init.d/mysql echo "Export path= $PATH:/usr/local/mysql5711/bin" >>/etc/profile Source/etc/profile Chkconfig--add MySQL # do a soft link to start MySQL cd/usr/local/ Ln-s/usr/local/mysql5711 MySQL # Remove Default my.cnf mv/etc/my.cnf/tmp/ # Set the default password /usr/local/mysql/bin/mysqld_safe--skip-grant-tables--skip-networking & /usr/local/mysql/bin/mysql-uroot--password= '--socket= '/usr/local/mysql/mysql.sock '-e ' update mysql.user set Authentication_string=password (' Dns_yuerld ') where user= ' root ' and Host = ' localhost '; Flush privileges; " /usr/local/mysql/bin/mysql-uroot--password= ' dns_yuerld '--socket= '/usr/local/mysql/mysql.sock '-e ' set password= PASSWORD (' Dns_yuerld '); Create DATABASE T; CREATE TABLE T1 select 1 as A; SELECT * from T1; " # Restart the MySQL server Service MySQL Restart # Check the test /usr/local/mysql/bin/mysql-uroot--password= ' dns_yuerld '--socket= '/usr/local/mysql/mysql.sock '-e ' select * from T1; " |
4, batch installation of many MySQL instances
the script and installation software SCP to n servers, then SSH IP address "sh/soft/init_linux.sh; sh/soft/install_mysql.sh; ", install with a background batch process.
5,why? Binary installation with no source installation
The source is mainly installed in make link need to consume too much time, a source code installation MySQL takes a long while, and the binary installation eliminates the Configure, make, make install this step, greatly reduced the installation time increased efficiency, a single installation MySQL feel little, If you install thousands of units at once, the gap is the sky underground.
Latest version of MySQL on Azure cloud MySQL5.7.11 batch Automation One-click Installation (RPM)