Requires(pre): /bin/sh
Requires(post): /bin/sh
Requires(preun): /bin/sh
Checking for unpackaged file(s):/usr/lib/rpm/check-files /var/tmp/mysql-rpm-5.6.21-renfengjun-root
warning: Could not canonicalize hostname:CentOS511
Wrote:/usr/src/RedHat/RPMS/x86_64/mysql-rpm-5.6.21-renfengjun.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.62530
+ umask 022
+ cd /usr/src/redhat/BUILD
+ rm -rf/var/tmp/mysql-rpm-5.6.21-renfengjun-root
+ exit 0
生成的rpm包在这里:
/usr/src/redhat/RPMS/x86_64/mysql-rpm-5.6.21-renfengjun.x86_64.rpm
打包数据模板
打包的时候记得关闭mysql。这里写了一点测试数据:
mysql> select * from dexdb.t ;
+------+------------+
| id |name |
+------+------------+
| 1 |renfengjun |
+------+------------+
1 row in set (0.00 sec)
数据模板打包,记得ibdata1打包上
cd /u01/mysql/data
tar cf data.tar ibdata1 mysql/ dexdb/performance_schema/ test/
修改my.cnf
my.cnf文件内容:
[mysqld_safe]
pid-file=/u01/mysql/run/mysqld.pid
#malloc-lib=/u01/mysql/lib/libjemalloc.so
[mysql]
port=3306
prompt=\\u@\\d \\r:\\m:\\s>
default-character-set=gbk
no-auto-rehash
[client]
port=3306
socket=/u01/mysql/run/mysql.sock
[mysqld]
#dir
basedir=/u01/mysql
datadir=/u01/mysql/data
tmpdir=/tmp
lc_messages_dir=/u01/mysql/share
log-error=/u01/mysql/log/alert.log
slow_query_log_file=/u01/mysql/log/slow.log
general_log_file=/u01/mysql/log/general.log
socket=/u01/mysql/run/mysql.sock
#innodb
innodb_data_home_dir=/u01/mysql/data
innodb_log_group_home_dir=/u01/mysql/data
innodb_data_file_path=ibdata1:12M
innodb_buffer_pool_size=10G
innodb_buffer_pool_instances=4
innodb_log_files_in_group=2
innodb_log_file_size=1G
innodb_log_buffer_size=200M
innodb_flush_log_at_trx_commit=1
innodb_additional_mem_pool_size=20M
innodb_max_dirty_pages_pct=60
innodb_io_capacity=1000
innodb_thread_concurrency=16
innodb_read_io_threads=8
innodb_write_io_threads=8
innodb_open_files=60000
innodb_file_format=Barracuda
innodb_file_per_table=1
innodb_flush_method=O_DIRECT
innodb_change_buffering=inserts
innodb_adaptive_flushing=1
innodb_old_blocks_time=1000
innodb_stats_on_metadata=0
innodb_read_ahead=0
innodb_use_native_aio=0
innodb_lock_wait_timeout=5
innodb_rollback_on_timeout=0
innodb_purge_threads=1
innodb_strict_mode=1
transaction-isolation=READ-COMMITTED
#myisam
key_buffer=64M
myisam_sort_buffer_size=64M
concurrent_insert=2
delayed_insert_timeout=300
#replication
master-info-file=/u01/mysql/log/master.info
relay-log=/u01/mysql/log/relaylog
relay_log_info_file=/u01/mysql/log/relay-log.info
relay-log-index=/u01/mysql/log/mysqld-relay-bin.index
slave_load_tmpdir=/u01/mysql/tmp
slave_type_conversions="ALL_NON_LOSSY"
slave_net_timeout=4
skip-slave-start
sync_master_info=1000
sync_relay_log_info=1000
#binlog
log-bin=/u01/mysql/log/mysql-bin
#server_id=2552763370
binlog_cache_size=32K
max_binlog_cache_size=2G
max_binlog_size=500M
binlog-format=ROW
sync_binlog=1000
log-slave-updates=1
expire_logs_days=0
#server
default-storage-engine=INNODB
character-set-server=gbk
lower_case_table_names=1
skip-external-locking
open_files_limit=65536
safe-user-create
local-infile=1
#sqlmod="STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE"
performance_schema=0
log_slow_admin_statements=1
log_warnings=1
long_query_time=1
slow_query_log=1
general_log=0
query_cache_type=0
query_cache_limit=1M
query_cache_min_res_unit=1K
table_definition_cache=65536
#table_cache=65536
thread_stack=512K
thread_cache_size=256
read_rnd_buffer_size=128K
sort_buffer_size=256K
join_buffer_size=128K
read_buffer_size=128K
port=3306
skip-name-resolve
skip-ssl
max_connections=4500
max_user_connections=4000
max_connect_errors=65536
max_allowed_packet=128M
connect_timeout=8
net_read_timeout=30
net_write_timeout=60
back_log=1024
serverid在自动化安装脚本中自动生成。
将上面的data.tar 、my.cnf、生成的rpm包copy到ftp的pub目录下
/var/ftp/pub/
自动化安装脚本
auto_install_mysql.sh: