Mysql 编译安装脚本
##安装mariadb依赖包
function install_yum()
{
yum -y install $1
}
i="ncurses* bison gcc* screen make gcc-c++ cmake bison-devel ncurses-devel libaio libaio libaio-devel perl-Data-Dumper net-tools lvm2* unzip zlib-* mdadm libaio* bison* openssl* libcurl-devel libarchive-devel boost* kernel-headers kernel-devel pcre-devel"
for j in $i
do
install_yum $j
done
echo "###################################finish yum install rpm package 10%"
sleep 5
m1=`ls /dev/* |grep md0`
if [ ! -n "$m1" ]
then
ra=`ls /tmp/raiddir/*|awk -F'/' '{print $4}'|awk -F'.' 'BEGIN{ORS=" "}{print "/dev/"$1}'`
rb=`ls /tmp/raiddir/*|wc -l`
if [ $rb -eq 0 ]
then
echo "no init partition storage"
else
mdadm -C /dev/md0 -l raid0 -n $rb $ra
mkfs.ext4 /dev/md0
mdadm -E -s -v >> /etc/mdadm.conf
mkdir /u02
mount /dev/md0 /u02
echo '/dev/md0 /u02 ext4 defaults 0 0'>>/etc/fstab
fi
else
echo 'Md0 has been created'
fi
echo "###################################finish install raid0 15%"
sleep 5
mkdir /u04/mysql -p
chown root. $oz
for oi in $oz
do
tar -vzxf $oi -C /u04/mysql
done
if [ $ox -eq 0 ]
then
echo "###################################finish tar mysql soft 20%"
sleep 5
else
echo "###################################Tar mysql soft is wrong!"
exit
fi
groupadd mysql
useradd -r -g mysql mysql
#mkdir /u02
#mount /dev/md0 /u02
mkdir /u02/mysql -p
mkdir /u02/mysql/binlog
mkdir /u02/mysql/undo
mkdir /u02/mysql/tmp
mkdir /u02/mysql/slowlog
mkdir /u02/mysql/redo
mkdir /u02/mysql/data
mkdir /u02/mysql/sock
mkdir /u02/mysql/error
chown mysql. /u02/mysql -R
echo "####################################25%"
sleep 5
cd /u04/mysql/mariadb-10.3.8
a=`echo $?`
if [ $a -eq 0 ]
then
echo ""
echo "finish cmake##################################################30%"
sleep 5
else
echo "cmake wrong!"
exit
fi
b=`echo $?`
if [ $b -eq 0 ]
then
echo ""
echo "finish make##################################################40%"
sleep 5
else
echo "make wrong!"
exit
fi
c=`echo $?`
if [ $c -eq 0 ]
then
echo ""
echo "finishi make install##################################################60%"
sleep 5
else
echo "make install wrong!"
exit
fi
g=`free -g|grep Mem|awk '{print $2}'`
h=$(($g*4/5))
rm -rf /etc/my.cnf
touch /etc/my.cnf
echo "[mysql]
default-character-set =utf8mb4
[mysqld]
basedir = /u02/mysql/
datadir = /u02/mysql/data
tmpdir = /u02/mysql/tmp
port = 3306
socket = /u02/mysql/sock/mysql.sock
character_set_server = utf8mb4
max_user_connections=2980
default-storage-engine=InnoDB
partition
lock_wait_timeout=900
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
init_connect='SET collation_connection = utf8mb4_unicode_ci'
skip-character-set-client-handshake
lower_case_table_names=1
default-time-zone=\"+8:00\"
join_buffer_size=128K
sort_buffer_size=8m
table_open_cache=1024
table_definition_cache=1024
query_cache_type=0
query_cache_size=0
query_cache_limit=0
back_log=300
thread_cache_size=512
max_connections=3000
tmp_table_size=128m #for mairadb
max_heap_table_size=128m #for mairadb
skip-name-resolve
net_buffer_length=8k
max_allowed_packet=1g
connect_timeout=10
wait_timeout=120
interactive_timeout=120
net_read_timeout=3 #set to 10 if across IDC
net_write_timeout=6 #set to 10 if across IDC
net_retry_count=2 #set to 5 if across IDC
log-error=/u02/mysql/error/error3306.log
skip-log-warnings
slow-query-log
slow_query_log_file=/u02/mysql/slowlog/slow3306.log
log_slow_verbosity='Query_plan,Innodb' #for mariadb
innodb_log_group_home_dir=/u02/mysql/redo
innodb_log_files_in_group=4
innodb_log_file_size=256M
innodb_open_files=4096
innodb_change_buffering=inserts
innodb_adaptive_hash_index=ON
innodb_autoinc_lock_mode=2
innodb_buffer_pool_size="$h"G
innodb_buffer_pool_instances=4
innodb_max_dirty_pages_pct=50
innodb_old_blocks_pct=25
innodb_old_blocks_time=3000
innodb_log_buffer_size=50m
innodb_flush_method=O_DIRECT
innodb_use_native_aio
innodb_adaptive_flushing
innodb_flush_log_at_trx_commit=1
innodb_io_capacity=20000
innodb_read_io_threads=4
innodb_write_io_threads=4
innodb_read_ahead_threshold=56
innodb_purge_threads=1
innodb_purge_batch_size=20
innodb_file_per_table
innodb_autoextend_increment=32
innodb_stats_on_metadata=0 #for mariadb
innodb_stats_sample_pages=32
innodb_stats_method=nulls_unequal
innodb_fast_shutdown=1
autocommit=1
transaction-isolation=READ-COMMITTED #for mariadb
completion_type=NO_CHAIN
#innodb_support_xa
innodb_table_locks
innodb_lock_wait_timeout=900
innodb_spin_wait_delay=6
innodb_sync_spin_loops=30
innodb_commit_concurrency=0
innodb_thread_concurrency=32 #at least equal cpu nums
#server-id=1
#log_bin=/u02/mysql/binlog/master
#sync_binlog=1
#innodb_flush_log_at_trx_commit=1
#log_bin_trust_function_creators=1
#expire_logs_days = 1
#binlog_format=ROW
" >/etc/my.cnf
echo "finish mysql /etc/my.cnf##################################################70%"
sleep 5
cd /u04/mysql/mariadb-10.3.8/scripts
./mysql_install_db --user=mysql --basedir=/u02/mysql --datadir=/u02/mysql/data
sleep 120
echo $'\003'
cd /u02
chown mysql. mysql/ -R
echo "finish mysql init##################################################80%"
sleep 5
cd /u04/mysql/mariadb-10.3.8
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig mysqld on
nohup /etc/init.d/mysqld start >/dev/null 2>&1 &
sleep 30
echo "finish mysql start##################################################90%"
sleep 5
ln -s /u02/mysql/bin/mysql /usr/bin/mysql
ln -s /u02/mysql/bin/mysqldump /usr/bin/mysqldump
/u02/mysql/bin/mysqladmin -u root -h 127.0.0.1 password 'oracletest'
echo "finish mysql install ok##################################################100%"
sleep 5
mysql -uroot -poracletest -h127.0.0.1 -e "create database dbadmin"
mysql -uroot -poracletest -h127.0.0.1 -e "grant all on *.* to dbadmin@'127.0.0.1' identified by 'dbadmin'"
#backup
mkdir /u03/mysql/backup -p
mkdir /u01/dba_scripts/mysqldump -p
mkdir /u01/dba_scripts/mysql_add_partition -p
mv /tmp/mysqlbackup.sh /u01/dba_scripts/mysqldump
mv /tmp/mysql_add_partition_tables.sh /u01/dba_scripts/mysql_add_partition
cat /tmp/mysql_crontab.txt >> /var/spool/cron/root
echo "#################################finish shell"
###############################################
yum -y install java
unzip /tmp/flyway-commandline-4.2.0-windows-x64.zip -d /u10/flyway_mysql
flyway_conf=/u10/flyway_mysql/flyway-4.2.0/conf/flyway.conf
flyway_sql=/u10/flyway_mysql/flyway-4.2.0/sql/db/migration
flyway_drivers=/u10/flyway_mysql/flyway-4.2.0/drivers
#cp /tmp/ojdbc6.jar $flyway_drivers
ln -s /u10/flyway_mysql/flyway-4.2.0/flyway /usr/bin/flyway_mysql
#a=`who|awk '{print $1}'`
#cd
echo "alias flymysql='cd /u10/flyway_mysql/flyway-4.2.0'" >>/etc/profile
source /etc/profile
####Sql?..?½å§..ï####V3_1__20170921_1.sql
flyway.url=jdbc:mariadb://127.0.0.1:3306/dbadmin
flyway.user=dbadmin
flyway.password=dbadmin
flyway.schemas=dbadmin
flyway.table=schema_version
flyway.baselineOnMigrate=true" >> $flyway_conf
cd /u10/flyway_mysql/flyway-4.2.0
chmod 777 sql
flyway_mysql migrate
echo "#################################finish flyway install"
Mysql 编译安装脚本的更多相关文章
- Nginx PHP MySql 编译安装
以CentOS5.6为平台编译安装.确保系统已经安装gcc/gcc-c++编译器! 1.Nginx-1.0.14 2.PHP-5.3.10 3.MySql-5.1.61 安装相关依赖开发库: auto ...
- mysql编译安装(详细)(转载)
mysql编译安装(详细) 一.编译安装MySQL前的准备工作 安装编译源码所需的工具和库 yum install gcc gcc-c++ ncurses-devel perl 安装cmake,从 ...
- Linux(centos)下mysql编译安装教程
Linux下mysql编译安装教程 #查看linux发行版本 cat /etc/issue #查看linux内核版本号 uname -r 本文測试环境centOS6.6 一.Linux下编译安装MyS ...
- php-fpm编译安装脚本
PHP是开源.轻量级.高效的开发语言,特别适合web项目开发,在中小型互联网公司中常用于开发web后端.PHP常与Nginx及MySQL数据库结合,搭建LNMP环境.以下为centos7系统下ph ...
- mysql 编译安装
mysql 编译安装方式: ```cd /home/oldboy/tools``` 创建 目录 if not have then mkd ...
- centos mysql 编译安装
centos mysql 编译安装 1.安装 创建MySQL用户 sudo useradd mysql 下载MySQL的源码包,我们这里使用的时5.5.18 安装依赖 sudo yum -y inst ...
- Mysql编译安装及优化
采取编译安装的方法,其好处为:编译安装与平台无关,安装的MySQL目录独立,维护起来方便,而且拥有更好的性能. 环境:CentOS release 6.9 (Final) x86_64 1)下载my ...
- rpm安装MySQL5.5后配置,在centos5上;mysql编译安装在centos6.5上;
[1] 没有/etc/my.cnf: rpm包安装的MySQL是不会安装/etc/my.cnf文件的:处理:cp /usr/share/mysql/my-huge.cnf /etc/my.cnf [2 ...
- 20190418 CentOS7实用技能综合:系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/RocketMQ/RabbitMQ编译安装 + ...各类常用生产环境软件的编译安装
系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/Roc ...
随机推荐
- 深入理解Java虚拟机3-chap4-5-斗之气10段
一.虚拟机性能监控与故障处理 1.JDK的命令行工具:对jdk/lib/tools.jar的薄包装,Linux下可能是Shell编写,执行类似于Linux中的命令 2.可视化工具JConsole 打开 ...
- cocos2dx JS layuot纯代码实现背景颜色渐变
// view._partyBtnClassify.setBackGroundColorType(ccui.Layout.BG_COLOR_GRADIENT);// view._partyBtnCla ...
- make pycaffe时候报错:Makefile:501: recipe for target 'python/caffe/_caffe.so' failed
安装caffe-ssd编译环境的时候报错: python/caffe/_caffe.cpp:10:31: fatal error: numpy/arrayobject.h: No such file ...
- oracle 死锁
oracle 死锁 --查用户名,查客户端机器 SELECT distinct s.username,s.MACHINE, s.sid||','||s.serial# FROM gv$session ...
- 时间序列预测——Tensorflow.Keras.LSTM
1.测试数据下载 https://datamarket.com/data/set/22w6/portland-oregon-average-monthly-bus-ridership-100-janu ...
- 在vue项目中引入jquery
在vue项目中引入jquerycnpm install jquery --save在main.js中引入,加入下面这行代码:import 'jquery'注:有些项目是按需加载的,在main.js里面 ...
- javascript时间处理
1.将一般格式时间转换为时间戳: var systime = "2018年04月28日 16:01:09"; systime = systime.replace('年', &quo ...
- php 根据日期获取星座
根据日期获取星座 /* * * 获取星座 * 星座是按阳历来计算的 * $month 阳历月份 * $day 阳历日期 * */ public static function get_xingzuo( ...
- Codeforces 932G Palindrome Partition - 回文树 - 动态规划
题目传送门 通往???的传送点 通往神秘地带的传送点 通往未知地带的传送点 题目大意 给定一个串$s$,要求将$s$划分为$t_{1}t_{2}\cdots t_{k}$,其中$2\mid k$,且$ ...
- MySQL基础和JDBC
第一章 命令行工具 mysqladmin:MySQL服务器管理工具 mysql:MySQL客服端链接工具 mysqldump 演示链接到服务器host=127.0.0.1,用户名为root,密码为空 ...