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 ...
随机推荐
- 关于SQL视图的创建和使用方法
SQL视图的创建和使用 视图这个东西在其他的软件中,我们也经常看得到,例如word中就有视图,我们不难发现,视图似乎是一种显示方式,就像WORD一样,有几种显示版面,这就是视图,那么SQL中的视图又该 ...
- Java中try、finally语句中有return时的执行情况 [转]
原文:http://kingj.iteye.com/blog/1436761 在Java中当try.finally语句中包含return语句时,执行情况到底是怎样的,finally中的代码是否执行,大 ...
- [Luogu]A%BProblem——线性筛素数与前缀和
题目描述 题目背景 题目名称是吸引你点进来的[你怎么知道的] 实际上该题还是很水的[有种不祥的预感..] 题目描述 区间质数个数 输入输出格式 输入格式: 一行两个整数 询问次数n,范围m接下来n行, ...
- python 设置位置参数是整数类型
- 高度自适应不能触发transition的解决方法
1. 前言 在我们不能确定一个元素的高度的时候,要使用transition过渡,是不会触发的,比如一个p标签 内容行数不固定 我们可能就要初始 height: 0 ; 过渡到 height: au ...
- Struts2 使用Jquery+ajax 文件上传
话不多说 直接上代码 前台js: var formData = new FormData(); formData.append("file1",$("#file1&quo ...
- RPM 包的构建 - 实例
打包目录 rpm 打包目录有一些严格的层次上的要求. rpm 的版本 <=4.4.x,rpmbuid 工具其默认的工作路径是 /usr/src/redhat.因为权限的问题,普通用户不能制作 r ...
- BOM简介
BOM简介 BOM Browser Object Model 浏览器对象模型 // 通过window对象来访问浏览器 console.log(window.document); // frames:当 ...
- ssm回顾笔记(一)
这两天来到了农银,这边即将进行的一个项目是将ssh框架的电商项目迁移到springboot+ssm框架上,所以我基本上是三门技术在同时进行学习,当然以前学过ssm,现在只是回顾. spring 注解 ...
- Mybatis自动生成,针对字段类型为text等会默认产生XXXXWithBlobs的方法问题
需要修改generatorConfiguration.xml,里面的table加属性:<table tableName="t_ticketcase" domainObject ...