脚本整理
来源:互联网 发布:百度数据库在哪里 编辑:程序博客网 时间:2024/06/18 13:33
1 start.sh
#!/bin/sh
# author:wdlinux# url:http://www.wdlinux.cn
# description: mysql start
mip=1.1.1.215
vip=1.1.1.99
mysql_in=/mnt/data/mysql-arm
mysql_bin=${mysql_in}/bin/mysql
mysql_user=root
mysqld_start=/mnt/data/mysql-arm/etc/mysqld
slave_to_master()
{
echo "mysql to master from slave..."
#stop slave
# nothing to do
$mysql_bin -u"${mysql_user}" -e "stop slave;show master status\G"
#log_file=$(${mysql_bin} -u"${mysql_user}" -e "show master status\G" | grep "File:" | awk -F ': ' '{printf $2}')
#log_id=$(${mysql_bin} -u"${mysql_user}" -e "show master status\G" | grep "Position:" |awk -F ': ' '{printf $2}')
#$mysql_bin -u"${mysql_user}" -e "use ms_state;update ms_log set mlf='${log_file}',mlp='${log_id}'"
#$mysql_bin -u"${mysql_user}" -e "use ms_state;select * from ms_log;"
echo "mysql is master"
}
master_to_slave()
{
echo "mysql to slave from master..."
#if (${mysql_bin} -h"${vip}" -u"${mysql_user}" -e "show slave status" > /dev/null 2>&1)
#then
#delete all table
#reconnect to master and force a sync
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate admin_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate area_property_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate area_relay_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate auth_group_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate board_record_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate cascade_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate conf_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate dispatch_box_table"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate dispatch_client_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate dispatch_group_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate dispatch_radio_oper_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate dispatch_sub_phone_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate dispatch_user_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate dnset_switch"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate e1_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate frequency_total_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate in_code_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate in_out_area_dir_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate limit_phone_group_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate num_route_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate phone_group_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate phone_reocord_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate radio_detection_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate record_playback"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate role_func_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate role_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate role_phone_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate role_radio_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate route_area_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate route_property_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate seat_reocord_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate ss7_link_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate telephone_channel_info"
${mysql_bin} -u"${mysql_user}" -e "use dispatch_web;truncate user_info"
${mysql_bin} -u"${mysql_user}" -e "reset master"
log_file=$(${mysql_bin} -u"${mysql_user}" -e "show master status\G" | grep "File:" | awk -F ': ' '{printf $2}')
log_id=$(${mysql_bin} -u"${mysql_user}" -e "show master status\G" | grep "Position:" |awk -F ': ' '{printf $2}')
echo $log_file
echo $log_id
$mysql_bin -u"${mysql_user}" -e "stop slave;reset slave;CHANGE MASTER TO MASTER_HOST='1.1.1.99', MASTER_USER='sync0',MASTER_PASSWORD='12345',MASTER_LOG_FILE= '${log_file}',MASTER_LOG_POS = ${log_id};start slave;show slave status\G";
sleep 5
echo "mysql is slave"
#fi
}
###############################################################################
. /app/bin/setsql.sh
val=`netcfg -r 38004|grep 54`
if [ -n "$val" ]
then
slave_to_master
else
master_to_slave
fi
2 setsql.sh
#!/bin/sh
val=`netcfg -r 38004|grep 54`
echo $val
if [ -n "$val" ]
then
echo 1
mysql -uroot -e "set GLOBAL server_id=1"
cp /app/cfg/my1.cnf /mnt/data/mysql-arm/etc/my.cnf
else
echo 2
mysql -uroot -e "set GLOBAL server_id=2"
cp /app/cfg/my2.cnf /mnt/data/mysql-arm/etc/my.cnf
fi
mysql -uroot -e "show variables like '%id'"
3 app_init
#!/bin/sh
#change lan speed to 100M
#rtlcfg -f -p 1 -s 1 -d 8
#rtlcfg -f -p 2 -s 1 -d 8
netcfg -f /app/cfg/netconfig
udhcpd -f /app/cfg/udhcpd.conf &
#exit 0
netcfg -w 38018 1
insmod /app/bin/tdm.ko
export SIP_CORE_SVR_PATH=/app/bin/sipserver.ini
###############################################################
. /app/bin/setsql.sh
chmod 777 /tmp
##############################################################
/mnt/data/mysql-arm/etc/mysqld start &
sleep 5
###############################################################
. /app/bin/start.sh
sleep 2
###############################################################
ulimit -S -c unlimited > /dev/null 2>&1
/app/bin/sip_server &
/app/apache/bin/apachectl start
/app/bin/timeServer 4000 &
4 my.cnf
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 13306
socket = /mnt/data/mysql-arm/etc/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /mnt/data/mysql-arm/etc/mysql.sock
skip-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
binlog_do_db = dispatch_web
replicate-do-db = dispatch_web
log-slave-updates
# binary logging format - mixed recommended
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql-lhc/mysql-arm/var
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql-lhc/mysql-arm/var
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
- 脚本整理
- 脚本整理
- sh脚本使用整理
- 整理代码脚本
- 数据库脚本整理
- RFT 脚本整理
- Windows 批处理脚本整理
- cmd脚本语法整理
- bat脚本整理
- 数据库地域脚本整理
- 快速格式整理脚本
- Shell脚本知识整理
- 日常实用脚本整理
- Shell自动化脚本整理
- mongo 脚本整理
- SQL注入式脚本整理
- 在线整理索引碎片脚本
- LoadRunner脚本录制常见问题整理
- java中JOptionPane类的使用
- lower_bound() + upper_bound()
- Linux常用命令学习笔记
- codevs1047
- GRE写作必备句型
- 脚本整理
- 消除input倒三角
- 【西祠日志】【06】日志规范 :0、日期简述 1、当日计划 2、做了什么 3、反省 4 、【悟】5、明日打算
- 2012年5月SAT香港真题解析
- LeetCode|| Single Number II
- 高斯模糊效果实现方案及性能对比
- HIVE服务启动与HIVE命令冲突解决办法
- HDU 5288 OO’s Sequence (二分)2015多校训练一
- Android windowSoftInputMode属性详解