export PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin
:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/j2sdk/bin:/usr/local/mysql/bin:/root/b
in:/usr/local/shell/bs/script"
mispath='/mysqlbinlog/MIS/'
bakpath='/mysqldata/tmp/'
datapath='/mysqldata/data/'
bakpathcur="$bakpath`date +%Y%m%d`"
param="-uadmin -p******** -hlocalhost --default-character-set=utf8 --opt --triggers -R --hex-blob --single-transaction -K -A"
parampom="-umonitor -pmonitor -hlocalhost --default-character-set=utf8 --opt --triggers -R --hex-blob --single-transaction -K -A"
ip=1.13
function make_log(){
if [ ! -e "$bakpath`date +%Y%m%d`" ]
then
mkdir $bakpathcur
fi
}
make_log
sh shutdown.sh
sh mysqlstart.sh
sleep 10
#mysqldump $param -S /tmp/mysql3306.sock > "$bakpathcur/3306.sql"
#mysqldump $param -S /tmp/mysql3307.sock > "$bakpathcur/3307.sql"
mysqldump $param -S /tmp/mysql3308.sock > "$bakpathcur/3308.sql"
echo "`date` SD5 dump FINSH.">>"/usr/local/shell/bs/script/log/bak.log"
mysqldump $parampom -S /tmp/mysql3309.sock > "$bakpathcur/3309.sql"
sh shutdown.sh
sleep 30
for bin in `ls /mysqldata/data/ | grep binlog`
do
# echo "b_flag3"
# echo "$datapath$bin/*"
`rm -rf $datapath$bin/mysql_instance*`
done
for err in `ls /mysqldata/data/ | grep data`
do
# echo "b_flag3"
# echo $err
`rm -rf $datapath$err/PIL-Data-Center.err`
#`rm -rf $datapath$err/relay-log.info`
`cp $datapath$err/master.info $bakpathcur/$err.master.info`
done
sh mysqlstart.sh
sleep 30
sh slavestart.sh
#tar cvzf $mispath$ip.`date +%Y%m%d`.tar.gz "$bakpathcur/" --
tar cvzf $mispath$ip.`date +%Y%m%d`._sd5.tar.gz "$bakpathcur/3308.sql"
echo "`date` SD5 BACKUP FINSH.">>"/usr/local/shell/bs/script/log/bak.log"
sleep 30
tar cvzf $mispath$ip.`date +%Y%m%d`._pom.tar.gz "$bakpathcur/3309.sql"
echo "`date` ">>"/usr/local/shell/bs/script/log/bak.log"
$ more mysqlstart.sh
mysqld_multi start
$ more shutdown.sh
param="-uadmin -p******** -hlocalhost "
mysqladmin $param -S /tmp/mysql3306.sock shutdown
mysqladmin $param -S /tmp/mysql3307.sock shutdown
mysqladmin $param -S /tmp/mysql3308.sock shutdown
#mysqladmin $param -S /tmp/mysql3309.sock shutdown
mysqld_multi stop
$ more slavestart.sh
param="-uadmin -p******** -hlocalhost "
#mysql $param -S /tmp/mysql3306.sock -e 'slave start';
#sleep 900
mysql $param -S /tmp/mysql3307.sock -e 'slave start';
#sleep 900
mysql $param -S /tmp/mysql3308.sock -e 'slave start';
#sleep 900
#mysql $param -S /tmp/mysql3309.sock -e 'slave start';
$ more slavestop.sh
param="-uadmin -p******** -hlocalhost "
#mysql $param -S /tmp/mysql3306.sock -e 'slave stop';
mysql $param -S /tmp/mysql3307.sock -e 'slave stop';
mysql $param -S /tmp/mysql3308.sock -e 'slave stop';
#mysql $param -S /tmp/mysql3309.sock -e 'slave stop';
/*
more my.cnf
[client]
#user =
#password =
#character_set_client=utf8
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
user = 'multi_admin'
password = 'gniw1Ihju70ZrEc@'
log = /usr/local/mysql/data/mysqld_multi.log
# PIL_CENTER ****.11
#[mysqld1]
#!include /etc/my330**f
# REPORT_BAK
[mysqld2]
!include /etc/my3307.cnf
# sd5_pil_28
[mysqld3]
!include /etc/my3308.cnf
# pom_40
[mysqld4]
!include /etc/my3309.cnf
# data_generator
#[mysqld5]
#!include /etc/my3310.cnf
[mysqldump]
quick
max_allowed_packet = 100M
[mysql]
no-auto-rehash
[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
*/
/*
more /etc/my330**f
[mysqld1]
ignore-builtin-innodb
plugin-load=innodb=ha_innodb_plugin.so;innodb_trx=ha_innodb_plugin.so;innodb_locks=ha_innodb_plugin.so;innodb_cmp=ha_innodb_plugin.so;innodb_cmp_reset=ha_inn
odb_plugin.so;innodb_cmpmem=ha_innodb_plugin.so;innodb_cmpmem_reset=ha_innodb_plugin.so
#GameRequirSpecialSet
interactive_timeout=28800
wait_timeout=28800
#normalVariableSet
default-storage-engine=InnoDB
innodb_file_per_table=1
innodb_file_format=barracuda
innodb_strict_mode=1
character-set-server=utf8
#skip-networking
port = 3306
socket =/tmp/mysql3306.sock
pid-file =/mysqldata/data/data_instance1/gamedb.pid
basedir =/usr/local/mysql/
datadir =/mysqldata/data/data_instance1
skip-external-locking
skip-name-resolve
key_buffer = 256M
max_allowed_packet = 256M
table_open_cache = 512
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 4M
#--------------------- log bin -------------------------------------------
log-bin = /mysqldata/data/binlog_instance1/mysql_instance1
log-bin-trust-function-creators=1
max_binlog_cache_size = 500M
max_binlog_size = 500M
sync_binlog = 0
#expire_logs_days = 30
log-slave-updates
binlog_format=mixed
binlog_format = mixed
log-bin-trust-function-creators = 1
binlog-row-event-max-size = 1024
binlog_direct_non_transactional_updates = 1
#log-slow-queries
#slow_query_log
#long_query_time = 0
#log-queries-not-using-indexes
##-------------------- slave start PIL -----------------------------------
master-host = 1.3.1.11
master-user = pilrepl
master-password = lJY8rtY1jqodQ
master-port = 3306
master-connect-retry = 30
master-retry-count = 10
low_priority_updates = 1
report-host = 13113
server-id = 13113
##slave-skip-errors = 1022,1062
slave_transaction_retries = 10
slave-net-timeout = 30
skip-slave-start
#read_only
#log-slave-update
replicate-ignore-db = mysql
replicate-wild-ignore-table=%.TB_TEMP_%
replicate-wild-ignore-table=%.RP_%
#replicate-wild-ignore-table=mysql.%
# ---- relay-log
relay-log = /mysqldata/data/binlog_instance1/instance1-relay-bin
relay-log-index = /mysqldata/data/binlog_instance1/instance1-relay-bin.index
max-relay-log-size = 100M
relay-log-space-limit = 100M
relay-log-purge = 1
##-------------------- slave end -----------------------------------
innodb_data_home_dir = /mysqldata/data/data_instance1/
innodb_data_file_path = ibdata1:100M:autoextend
innodb_buffer_pool_size = 512M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
event_scheduler = 1
binlog_format = mixed
transaction-isolation = READ-COMMITTED
innodb_flush_method=O_DIRECT
log-bin-trust-function-creators = 1
sql_mode = STRICT_TRANS_TABLES
#slave-skip-errors=1022,1062
tmpdir=/tmp
#read-only
*/