MySQL 源码编译安装脚本
mysql_init.sh mysql_init.sh.20190401 mysql_init.sh.back20171030 mysql_init.sh.back20180327 mysql_init.sh.bak
[admin@yifudevops-jenkins-master-12 files]$ cat mysql_init.sh.20190401
##安装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 /dev/vd*|grep -v vda`
rb=`ls /dev/vd*|grep -v vda|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 源码编译安装脚本的更多相关文章
- Dubbo入门到精通学习笔记(十九):MySQL源码编译安装、MySQL主从复制的配置
文章目录 MySQL 源码编译安装(CentOS-6.6+MySQL-5.6) 一.服务器配置: 二.源码安装 MySQL5.6.26: MySQL主从复制的配置 环境 依赖课程 MySQL 主从复制 ...
- bash-2 httpd服务的源码编译安装脚本
httpd服务的源码编译安装脚本 #!/bin/bash # #******************************************************************** ...
- Mysql源码编译安装&主从复制
一)camke源码编译安装mysql 1)创建软件安装目录software [root@master software]# ls cmake-2.8.8.tar.gz mysql-5.5.32.tar ...
- MySQL 源码编译安装
脚本须知: 1. 该脚本目前只测试过mysql版本为5.6.x的源码,其他源码可以对本脚本稍作修改即可 2. 本脚本也可以使用wget mysql源码的方式进行,但考虑到后期提供源码的地址不可用,所以 ...
- ubuntu下mysql源码编译安装
建议:cpu4核以上,内存4G以上 1. 安装环境:Ubuntu Server 14.10MySQL-5.6.23.tar.gz 2. 安装必备的工具sudo apt-get install make ...
- mysql源码编译安装
首先去官网http://dev.mysql.com/downloads/mysql/ 下载mysql源码.我下的是5.7.10 源码选择的是 Generic Linux (Architecture I ...
- Apache源码编译安装脚本
Apache是开源的的.最流行的Web服务器软件之一,它快速.可靠并且可通过简单的API扩充,将Perl/Python/PHP等解释器编译到服务器中.Apache的模块超多,以及具有运行稳定,强大 ...
- Mysql 源码编译安装 ( 5.5 、5.6 共存 )
简介: 如何在一台服务器同时运行两 ( 多 ) 个 MySQL 服务. 1.MySQL 5.6 shell > useradd -r -s /sbin/nologin mysql shell & ...
- Shell脚本一键部署——源码编译安装MySQL及自动补全工具
Shell脚本一键部署--源码编译安装MySQL及自动补全工具 编译安装MySQL 1.软件包 Mysql安装包 将安装包拖至/opt目录下,编辑一个脚本文件,将以下内容复制进去,然后source或者 ...
随机推荐
- python中内存地址
遇到一个朋友,给我提了一个问题:python中的两个相同的值,内存地址是否一样? 当时印象里有这样一句话:Python采用基于值的内存管理模式,相同的值在内存中只有一份 于是张嘴就说是一样的 朋友说不 ...
- 创客课堂——Scratch的操作界面
大家好,这里是蓝精灵创客公益课堂,我是蓝老师 上期我们了解了scratch软件进行了简单的了解,很多朋友都已经按照上期方法下载安装好了软件. 那么今天蓝老师就和大家一起认识下Scratch的操作界面及 ...
- SAS学习笔记14 利用SAS绘制地图(二)
笔记9讲过利用SAS绘制地图,这次接着讲 用中国各地(不含港澳台)的平均湿度数据来绘制地图 在地图上标出地名 宏%maplabel有9个参数,依次为:地图文件名.包含区域名称的数据集文件.输出的注释数 ...
- Eureka 注册中心一直报Connect to localhost:8761 time out 的问题
忽略了配置eureka.client.service-url.defaultZone而导致的异常,重新覆盖配置就好 client: fetch-registry: false register-wit ...
- Ubuntu Server 18.04 无法修改 hostname
对于运维而言,我们希望每台服务器的 hostname 都能体现出它自己的功能/ip,方便排查. ubuntu server live 18.04 的安装流程非常友好,从 ip 到 hostname 都 ...
- Qt实现艺术字效果
Qt实现艺术字效果,通常有三种方式,一种是通过绘制机制,另外一种是使用样式表,最后一种是通过图片代替,本次介绍使用绘制来实现艺术字效果. 代码如下(分两种实现): 第一种: QPainter pain ...
- (二)easyUI之消息提示框
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- (七)发送、接收SOAP消息(以HttpClient方式)(2)
一.为什么要用soap 原本我们使用web服务都是根据wsdl生成客户端(生成一堆java文件)然后再调用,本章节讲解如何用soap消息来替代这种方式. 二.SOAP消息格式 SOAP(简单对象访问协 ...
- Java Web 深入分析(1)B/S架构概述
B/S结构即浏览器和服务器结构.它是随着Internet技术的兴起,对C/S结构的一种变化或者改进的结构.在这种结构下,用户工作界面是通过WWW浏览器来实现,极少部分事务逻辑在前端(Browser)实 ...
- 【推荐】 Neutralizer 安卓上特殊的均衡器
首先 直切正题 这个均衡器特殊就特殊在 会产生 特定频率的声音 根据声音来调整 自己喜欢的声音 下载地址: https://d-02.apkplz.org/dl.php?s=czlDeEt ...