5.6.26 Source installation package:Http://pan.baidu.com/s/1kUl44WR
CMake installation package Link:Http://pan.baidu.com/s/1c0LuwJA
Operating system version: CentOS release 6.3 (Final)
installation process: (Remember to mount the image and configure Yum to facilitate yum to install a variety of dependent packages)
CentOS configuration yum:
1, CD/ETC/YUM.REPOS.D
2, create any directory, to move all files to the created directory, in addition to Centos-media.repo
3. Edit Centos-media.repo
VI Centos-media.repo
[C6-media]
name=centos-$releasever-media
baseurl=file:///media/centos/
# file:///media/cdrom/
# file:///media/cdrecorder/
Gpgcheck=1
Enabled=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
4. Create/media/centos/Directory
5. Mounting
mount/dev/cdrom/media/centos/
[Email protected] ~]# mkdir-p/export/servers
[[email protected] servers]# upload installation script, MySQL source installation package, CMake installation package
[[email protected] servers] #ls
cmake-2.8.3.tar.gz mysql-5.6.26.tar.gz install.sh
[[email protected] servers] #sh install.sh
[[email protected] Servers] #cat install.sh script content
#!/bin/bash
# check
Echo-e "\033[;37;34mcheck Memory size...\033[0m"
If [' Free-g|grep ^mem|awk ' {print $} ' '! = 125]
Then
Read-p "Memory size is ' Free-g|grep ^mem|awk ' {print $} ' G, enter innodb_buffer_pool_size (default 20G):" Pool
Else
Echo-e "\033[;37;32mmemory Size is 125G, Innodb_buffer_pool_size set 100g\033[0m"
Fi
Echo-e "\033[;37;34mcheck network...\033[0m"
#if! Ping-c 1-w 1 www.baidu.com >/dev/null;then echo-e "\033[;37;31mplease Check Network before setup\033[0m"; Exit 1;els E echo-e "\033[;37;32mok\033[0m"; fi
Echo-e "\033[;37;34mcheck packet...\033[0m"
if! ls mysql-5.6.26.tar.gz cmake-2.8.3.tar.gz >/dev/null;then echo-e "\033[;37;31mno packets\033[0m"; Exit 1;else ECHO-E "\033[;37;32mok\033[0m"; fi
# Replace YUM.REPOS.D
#rm-F/etc/yum.repos.d/*
#wget-P/etc/yum.repos.d/http://172.22.197.62/centos/app/script/centos-media.repo
#sed-i ' s/6.3/6.5/'/etc/yum.repos.d/centos-media.repo
#echo-E "\033[;37;34mreplace yum.repos.d...\033[0m"
#wget MySQL CMake
#change IO Scheduler
echo Deadline >/sys/block/sda/queue/scheduler
Echo-e "\033[;37;34mchange IO Scheduler to deadline...\033[0m"
# init enviroment
Echo-e "\033[;37;34mstarting Yum install...\033[0m"
Yum install-y ncurses-devel glibc gcc gcc-c++ libstdc++* libtool cmake lrzsz libaio-devel
Echo-e "\033[;37;32myum Install done\033[0m"
Echo-e "\033[;37;34madd MySQL OS user...\033[0m"
Useradd MySQL
Echo-e "\033[;37;32madd User done\033[0m"
Setuplog=/home/mysql/logs/install-log
setupdir=$ (PWD)
Mysqldir= (/export/data/mysql/tmp/export/data/mysql/undo/export/data/mysql/data/export/servers/mysql/etc/export /data/mysql/dumps/export/data/mysql/log/home/mysql/scripts/home/mysql/logs)
Mkdir-p ${mysqldir[*]}
Chown Mysql:mysql-r/export/data/mysql/home/mysql/
ECHO-E "\033[;37;34mextracting Package to/usr/local/src/\033[0m"
Tar xzf cmake-2.8.3.tar.gz-c/usr/local/src
Tar xzf mysql-5.6.26.tar.gz-c/usr/local/src
MV *.tar.gz/usr/local/src
Echo-e "\033[;37;32mextracting done\033[0m"
# Install
Echo-e "\033[;37;34minstall cmake...\033[0m"
cd/usr/local/src/cmake-2.8.3:/bootstrap && gmake && make install
If [$ = 0];then echo-e "\033[;37;32mcmake install done\033[0m"; else echo-e "\033[;37;31mcmake Install faild\033[0m"; f I
Echo-e "\033[;37;34minstall mysql...\033[0m"
echo "Configure Error" > $setuplog
cd/usr/local/src/mysql-5.6.26; CMake. -dcmake_install_prefix=/export/servers/mysql/-dmysql_datadir=/export/data/mysql/data-dsysconfdir=/export/ Servers/mysql/etc-dwith_innobase_storage_engine=1-dwith_perfschema_storage_engine=1-ddefault_charset=utf8- Ddefault_collation=utf8_general_ci-dmysql_unix_addr=/export/data/mysql/tmp/mysql.sock-denabled_local_infile=on -denabled_profiling=on-dwith_debug=0-denable_dtrace=off-dmysql_tcp_port=3358 2>> $setuplog
Make && make install
If [$ = 0];then echo-e "\033[;37;32mmysql install done\033[0m"; else echo-e "\033[;37;31mmysql Install faild\033[0m"; e XIT 1;fi
/sbin/ldconfig/export/servers/mysql/lib/
Echo-e "\033[;37;34mmodify/home/mysql/.bash_profile...\033[0m"
echo "Export Lang=en_us. UTF-8 ">>/home/mysql/.bash_profile
Sed-i ' s! Path= $PATH: $HOME/bin! Path= $PATH: $HOME/bin:/export/servers/mysql/bin! '/home/mysql/.bash_profile
Source/home/mysql/.bash_profile
Echo-e "\033[;37;32mdone\033[0m"
# MY.CNF
Echo-e "\033[;37;34mcreate/export/servers/mysql/etc/my.cnf...\033[0m"
Cat >>/export/servers/mysql/etc/my.cnf << EOF
[Client]
Port = 3358
Socket =/export/data/mysql/tmp/mysql.sock
[Mysqld]
Port = 3358
Socket =/export/data/mysql/tmp/mysql.sock
DataDir =/export/data/mysql/data/
#---GLOBAL---#
Character-set-server = UTF8
Lower_case_table_names = 1
Log-output = FILE
Log-error =/export/data/mysql/log/error.log
General_log = 0
General_log_file =/export/data/mysql/log/mysql.log
Pid-file =/export/data/mysql/mysql.pid
Slow-query-log
Slow_query_log_file =/export/data/mysql/log/slow.log
Tmpdir =/export/data/mysql/tmp
Long_query_time = 1
#--------------#
#thread_concurrency = 16
Thread_cache_size = 512
Table_open_cache = 16384
Table_definition_cache = 16384
Sort_buffer_size = 2M
Join_buffer_size = 2M
Read_buffer_size = 4M
Read_rnd_buffer_size = 4M
Key_buffer_size = 8M
Myisam_sort_buffer_size = 8M
Tmp_table_size = 64M
Max_heap_table_size = 64M
Open_files_limit = 65535
Query_cache_size = 0
#add Z #################
Innodb_undo_directory =/export/data/mysql/undo
Innodb_undo_tablespaces = 4
Explicit_defaults_for_timestamp = 1
#---NETWORK---#
Back_log = 1024
Max_allowed_packet = 16M
Interactive_timeout = 28800
Wait_timeout = 28800
Skip-external-locking
max-connections = 1000
Skip-name-resolve
#read_only = 1
#---REPL---#
Server-id = 360360
Log-bin = Mysql-bin
Binlog_format = Mixed
Expire_logs_days = 7
Relay-log = Relay-log
Replicate-ignore-db = Mysql.slave_master_info
Replicate-ignore-db = Mysql.slave_relay_log_info
Replicate-ignore-db = Mysql.slave_worker_info
REPLICATE-IGNORE-DB = Test
Replicate-ignore-db = Information_schema
Replicate-ignore-db = Performance_schema
Log_slave_updates
Skip-slave-start
Slave-parallel-workers= 4
Sync_master_info= 1
Sync_relay_log= 1
Sync_relay_log_info= 1
relay_log_info_repository= TABLE
master_info_repository= TABLE
#rpl_semi_sync_master_enabled = 1
#rpl_semi_sync_slave_enabled = 1
#rpl_semi_sync_master_timeout = 1000
#---INNODB---#
Default-storage-engine = INNODB
Innodb_data_home_dir =/export/data/mysql/data
Innodb_file_per_table
Innodb_log_group_home_dir =/export/data/mysql/data
Innodb_log_files_in_group = 3
Innodb_log_file_size = 512M
Innodb_log_buffer_size = 16M
Innodb_flush_log_at_trx_commit = 1
Innodb_lock_wait_timeout = 120
Innodb_flush_method = O_direct
innodb_max_dirty_pages_pct = 75
#change Z #####
Sync_binlog= 1
Innodb_buffer_pool_size = 100G
Innodb_data_file_path = Ibdata1:2g;ibdata2:2g:autoextend
Innodb_autoextend_increment = 500
Innodb_thread_concurrency = 32
Innodb_open_files = 65535
innodb_write_io_threads= 20
innodb_read_io_threads= 20
innodb_spin_wait_delay= 10
Innodb_flush_neighbors= 1
Innodb_use_native_aio = 1
innodb_io_capacity = 2000
Innodb_io_capacity_max = 6000
relay_log_recovery= 1
#innodb_additional_mem_pool_size = 128M
#change h #####
#innodb_numa_interleave =on
innodb_lru_scan_depth=512
Innodb_checksum_algorithm=crc32
Innodb_purge_threads=4
[Mysqldump]
Quick
Max_allowed_packet = 16M
[MySQL]
# Auto-rehash
# Remove The next comment character if you is not a familiar with SQL
# safe-updates
Default-character-set=utf8
[Myisamchk]
Key_buffer_size = 128M
Sort_buffer_size = 128M
Read_buffer = 2M
Write_buffer = 2M
[Mysqlhotcopy]
Interactive-timeout
Eof
serverid=$ (ifconfig |grep bcast|grep ' inet addr: ' | awk ' {print $} ' |awk-f. ' {print $3$4} ')
#serverid =$ (ifconfig eth0|grep bcast|grep ' inet addr: ' | awk ' {print $} ' |awk-f. ' {print $3$4} ')
Sed-i ' s/360360/' $serverid '/'/export/servers/mysql/etc/my.cnf
if [!-Z $pool];then sed-i ' s/innodb_buffer_pool_size = 100g/innodb_buffer_pool_size = ' $pool '/'/expor T/servers/mysql/etc/my.cnf;echo-e "\033[;37;34m ' Cat/export/servers/mysql/etc/my.cnf|grep innodb_buffer_pool_size ' \033[0m '; fi
Echo-e "\033[;37;32mdone\033[0m"
# start
/export/servers/mysql/scripts/mysql_install_db--user=mysql--basedir=/export/servers/mysql/--datadir=/export/ data/mysql/data/
/export/servers/mysql/bin/mysqld_safe--DEFAULTS-FILE=/EXPORT/SERVERS/MYSQL/ETC/MY.CNF &
Echo-e "\033[;37;34mstart mysql\033[0m"
For i in {1..500};d o [-s/export/data/mysql/tmp/mysql.sock] && echo-e "\033[;37;32m[ok]\033[0m" && Brea K | | Echo-n "."; Sleep 2;done
if [!-s/export/data/mysql/tmp/mysql.sock];then echo-e "\033[;37;31m[start faild,see/export/data/mysql/log/ Error.log]\033[0m "; Exit 1;fi
# cutting
Echo-e "\033[;37;34mcreate cutting.sh to Crontab\033[0m"
Cat >>/home/mysql/scripts/cutting.sh << EOF
#!/bin/bash
Mysql=/export/servers/mysql/bin/mysql
User=backup
Password= ' 7fh3iwix90vduinu '
Generallog=/export/data/mysql/log/mysql.log
If [-f \ $generallog]
Then
MV \ $generallog \${generallog}.\ ' date ' +%y%m%d%h ' \ '
\ $mysql-u\ $user-p\ $password-E "flush no_write_to_binlog general logs;"
Fi
Slowlog=/export/data/mysql/log/slow.log
if [\ ' date ' +%w ' \ ' = 6-a-f \ $slowlog]
Then
MV \ $slowlog \${slowlog}.\ ' date ' +%y%m%d%h ' \ '
\ $mysql-u\ $user-p\ $password-E "flush no_write_to_binlog slow logs;"
Fi
find/export/data/mysql/log/-type f-name "*.log.*"-mtime +7 |xargs rm-f
Eof
Chown mysql.mysql/home/mysql/scripts/cutting.sh
chmod +x/home/mysql/scripts/cutting.sh
echo "1 0 * * */home/mysql/scripts/cutting.sh" >>/var/spool/cron/mysql
echo "1 0 * * */usr/sbin/ntpdate 172.17.1.134 | Hwclock-w ">>/var/spool/cron/root
Chown Mysql.root/var/spool/cron/mysql
chmod 600/var/spool/cron/mysql
/etc/init.d/crond restart
Echo-e "\033[;37;32mdone\033[0m"
Mkdir/var/lib/mysql
Ln-s/export/data/mysql/tmp/mysql.sock/var/lib/mysql/mysql.sock
Chown-r Mysql.mysql/var/lib/mysql
Echo-e "\033[;37;34mclean...\033[0m"
>/export/data/mysql/log/mysql.log
Rm-f ${setupdir}/' basename
Echo-e "\033[;37;32mdone\033[0m"
# Add Service
Cp/export/servers/mysql/support-files/mysql.server/etc/init.d/mysql
# RPL Semi sync on
/export/servers/mysql/bin/mysql-uroot-e "Install plugin rpl_semi_sync_master soname ' semisync_master.so '"
/export/servers/mysql/bin/mysql-uroot-e "Install plugin rpl_semi_sync_slave soname ' semisync_slave.so '";
Sed-i ' s/#rpl_semi_sync_master_enabled/rpl_semi_sync_master_enabled/'/export/servers/mysql/etc/my.cnf
Sed-i ' s/#rpl_semi_sync_slave_enabled/rpl_semi_sync_slave_enabled/'/export/servers/mysql/etc/my.cnf
Sed-i ' s/#rpl_semi_sync_master_timeout/rpl_semi_sync_master_timeout/'/export/servers/mysql/etc/my.cnf
# mysql Restart
Service MySQL Restart
MySQL 5.6.26 Source Installation