升级my.cnf注意

mkdir -p /ngbs/data/{logs,tmp}

vi  /etc/init.d/mysql
basedir=/usr/local/mysql
datadir=/ngbs/data/

cp ib_logfile* logs/

chown -R  mysql:mysql  /ngbs/data

要注意ibdata1大小要跟实际大小一样
不然报错
2017-04-14 18:14:13 16812 [ERROR] InnoDB: auto-extending data file /ngbs/data/ibdata1 is of a different size 25344 pages (rounded down to MB) than specified in the .cnf file: initial 64000 pages, max 0 (relevant if non-zero) pages!
2017-04-14 18:14:13 16812 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2017-04-14 18:14:13 16812 [ERROR] Plugin ‘InnoDB‘ init function returned error.
2017-04-14 18:14:13 16812 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed.
2017-04-14 18:14:13 16812 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable ‘binlog_gtid_simple_recovery=1‘
2017-04-14 18:14:13 16812 [ERROR] Aborting

---------------------------------------------------------------------------------------------

[client]
port            = 3306
socket            = /ngbs/data/tmp/mysql.sock

# The MySQL server
[mysqld]
#########Basic##################
explicit_defaults_for_timestamp=true

port            = 3306  
user            = mysql   
basedir         = /usr/local/mysql  
datadir         = /ngbs/data/   
tmpdir          = /ngbs/data/tmp/   
pid-file        = /ngbs/data/tmp/mysql.pid    
socket            = /ngbs/data/tmp/mysql.sock   
#skip-grant-tables

#character set
character_set_server = utf8

open_files_limit = 65535
back_log = 500
#event_scheduler = ON
#lower_case_table_names=1
skip-external-locking
skip_name_resolve = 1
default-storage-engine = InnoDB

#timeout
wait_timeout=100
interactive_timeout=100

server-id       =213306

#percona 的--recursion-method slavehost模式
#report_host = 10.105.9.115
#report_port = 3306

#plugin
plugin-load="semisync_master.so;semisync_slave.so"

#########error log#############
log-error = /ngbs/data/logs/error.log  
log-warnings = 2

#########general log#############
#general_log=1
#general_log_file=/ngbs/data/logs/mysql.log

#########slow log#############
slow_query_log = 1
long_query_time=1
slow_query_log_file = /ngbs/data/logs/mysql.slow

############# for replication###################

log-bin     = /ngbs/data/logs/mysql-bin   
binlog_format = row
max_binlog_size = 500M
binlog_cache_size = 2M
max_binlog_cache_size = 2M
expire-logs-days = 7
slave-net-timeout=30

log_bin_trust_function_creators = 1
log-slave-updates = 1   
skip-slave-start = 1
#read_only =1    #从上设置,5.7是super_read_only

#GTID
gtid-mode = on
binlog_gtid_simple_recovery=1
enforce_gtid_consistency=1

#relay log
relay-log = /ngbs/data/logs/mysql-relay  
relay-log-index=/ngbs/data/logs/relay-bin.index
max-relay-log-size = 500M

#replication crash safe
sync_master_info = 1
sync_relay_log_info = 1
sync_relay_log = 1
relay_log_recovery = 1
master_info_repository = TABLE
relay_log_info_repository = TABLE

#semisync   动态开启 主从切换的时候用
#rpl_semi_sync_master_enabled = 1
#rpl_semi_sync_master_wait_no_slave = 1
#rpl_semi_sync_master_timeout = 1000
#rpl_semi_sync_slave_enabled = 1
#rpl_semi_sync_master_timeout = 100000000 #不要超时,防止切异步,保证主从数据的完全一致性,默认是10000

#ignore
#replicate-ignore-db = ‘school‘,‘school2‘
#replicate-do-db = ‘school‘,‘school2‘

#Multi-threaded Slave
#slave_parallel_workers=16
#slave-parallel-type=LOGICAL_CLOCK
#slave-parallel-type=DATABASE

#replication error
#slave-skip-errors=1007,1051,1062

#######per_thread_buffers#####################
max_connections=1100
max_user_connections=1000
max_connect_errors=1000
connect_timeout = 20
#myisam_recover
key_buffer_size = 64M
max_allowed_packet = 16M
#table_cache = 3096
table_open_cache = 6144
table_definition_cache = 4096

read_buffer_size = 1M
join_buffer_size = 128K
read_rnd_buffer_size = 1M

#myisam
sort_buffer_size = 128K
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1

myisam_sort_buffer_size = 32M
tmp_table_size = 32M
max_heap_table_size = 64M
query_cache_type=0
query_cache_size = 0
bulk_insert_buffer_size = 32M

thread_cache_size = 64
#thread_concurrency = 32
thread_stack = 192K

###############InnoDB###########################
innodb_data_home_dir = /ngbs/data/      
innodb_log_group_home_dir = /ngbs/data/logs/    
innodb_data_file_path = ibdata1:1000M:autoextend

innodb_buffer_pool_size = 1G  #根据内存大小设置

innodb_buffer_pool_instances    = 4
#innodb_additional_mem_pool_size = 16M
innodb_log_file_size = 500M
innodb_log_buffer_size = 16M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
innodb_lock_wait_timeout = 10
innodb_sync_spin_loops = 40
innodb_max_dirty_pages_pct = 80
innodb_support_xa = 1
innodb_thread_concurrency = 0
innodb_thread_sleep_delay = 500
innodb_file_io_threads    = 4
innodb_concurrency_tickets = 1000
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_io_capacity = 800  #机械盘800 ssd 2000
innodb_flush_neighbors = 1
innodb_file_format = Barracuda
innodb_purge_threads=1   #5.6只能有一个,5.7可以设置多个
innodb_purge_batch_size = 32
innodb_old_blocks_pct=75
innodb_change_buffering=all
innodb_stats_on_metadata=OFF
innodb_print_all_deadlocks = 1
#innodb_status_output=1
#innodb_status_output_locks=1
performance_schema=0   #是否打开P_S库进行性能收集
transaction_isolation = READ-COMMITTED
#innodb_force_recovery=0
#innodb_fast_shutdown=1
#innodb_status_file = 1  #实时输出show engine innodb status到innodb_status文件

[mysqldump]
quick
max_allowed_packet = 128M

[mysql]
no-auto-rehash
max_allowed_packet = 128M
prompt                         = ‘(product)\[email protected]\h:\p [\d]> ‘
default_character_set          = utf8

[myisamchk]
key_buffer_size = 64M
sort_buffer_size = 512k
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
#malloc-lib= /usr/local/mysql/lib/mysql/libjemalloc.so

时间: 2024-10-06 00:13:00

升级my.cnf注意的相关文章

在CentOS上把MySQL从5.5升级到5.6(转)

http://www.th7.cn/db/mysql/201408/66064.shtml 在CentOS上把MySQL从5.5升级到5.6 摘要:本文记录了在CentOS 6.3上,把MySQL从5.5.28升级到5.6.19的过程. 1. 概述 在我做的一个项目中,最近我对生产服务器上的一系列系统软件进行了升级,包括git.nginx.MySQL和PHP.这篇文章讲的是升级MySQL的过程,其他软件的升级将在其他文章中介绍. 在我加入这个项目之前,网络服务器MySQL已经安装设置好了,我只是

mysql二进制安装,升级,多实例部署

目标 理解线上部署考虑的因素 学会编译安装以及二进制安装mysql 学会升级mysql 学会多实例部署mysql数据库 学会合理部署mysql线上库 考虑因素: 版本选择,5.1,5.5还是5.6? 分支选择,官方社区版?percona server?mariadb? 推荐官方版,简单易上手 安装方式,包安装?二进制包安装?源码安装? 线上推荐二进制包安装 路径配置,参数配置(尽量模板化,标准化) 一个实例多个库,or多个实例单个库? 二进制安装mysql 下载软件安装包 解压放到指定目录(比如

将MySQL 5.1升级到MySQL 5.5的步骤

mysql基本信息 1.安装目录/usr/local/mysql 2.数据目录 /home/mydb 3.配置目录 /etc/my.cnf 4.启动脚本/etc/init.d/mysql 升级前操作 1.停止线上业务,备份数据 备份:mysqldump -uroot -p –all-databases >/home/mysql/meng/databk_20150207.sql 停止:/etc/init.d/mysql stop #备份数据目录:mkdir /home/mydb5.1 #cp /h

Centos Mysql 升级

如何升级CentOS 6.5下的MySQL CentOS 6.5自带安装了MySQL 5.1,但5.1有诸多限制,而实际开发中,我们也已经使用MySQL 5.6,这导致部分脚本在MySQL 5.1中执行会出错.我们只能升级MySQL 方法/步骤 1 备份数据库,升级MySQL通常不会丢失数据,但保险起见,我们需要做这一步.输入命令: mysqldump -u xxx -h xxx -P 3306 -p --all-databases > databases.sql 2 停止MySQL服务,输入命

SonarQube升级

1.阅读SonarQube更新日志: http://docs.codehaus.org/display/SONAR/Upgrading#Upgrading-ReleaseUpgradeNotes 2.停止SonarQube服务: bin/<SYSTEM>/sonar stop 3.下载新版本号的SonarQube及SonarQube Runner,并解压至新的文件夹NEW_SONARQUBE_HOME http://www.sonarqube.org/downloads/ 4.更新NEW_SO

升级MariaDB ColumnStore 从 1.0.6 到1.0.7

我们这里采用2台um.4台pm跑一组集群,操作系统Centos6.8,原有MariaDB ColumnStore GA版本1.0.6. # cat /etc/hosts 192.168.75.33    um1 192.168.75.34    um2 192.168.75.35    pm1 192.168.75.36    pm2 192.168.75.37    pm3 192.168.75.38    pm4 用root用户分别登陆um1.um2.pm1 分别在这三台机器上建立文件/ro

mysql 升级和降级

1 官方推荐的两种升级方式: in-place upgrade logical upgrade 2 升级之前: 备份所有数据库,包括系统库mysql [[email protected] ~]# mysqldump -uroot -p147258 -A -B  -F --master-data=2 --events --single-transaction>/tmp/mysqlall.bak 下载5.7.16二进制包,上传解压到/opt/mysql/目录下 3升级演示:5.7.14升级到5.7.

MySQL升级

MySQL的升级相对来说还是比较简单的. 它支持两种方式的升级: 原地升级(In-place Upgrade) 关闭数据库,替换旧的二进制文件,重启数据库,执行mysql_upgrade 逻辑升级(Logical Upgrade) 用mysqldump导出数据,安装新的数据库版本,将数据导入到新的数据库中,执行mysql_upgrade 但是MySQL版本众多,不仅有各种大版本,譬如5.1,5.5,5.6,5.7,同一个大版本中也会有各种小版本. 那么官方支持怎么的升级路径呢? 1. 同一个大版

centos升级mysql至5.7

1.备份原数据库 [[email protected] ~] #mysqldump -u root –p -E –all-database > /home/db-backup.sql 加-E是因为mysqldump默认并不处理mysql的事件,需要自己指明是否导出事件. copy一份my.cnf,待安装mysql5.7的时候参照. [[email protected] ~]# cp /etc/my.cnf /home/my.cnf 停止mysql服务 [[email protected] ~]#