升级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)\u@\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

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

  1. 升级 mysql5.6 配置文件my.cnf sql_mode 解析与设置问题

    sql_mode是个很容易被忽视的变量,默认值是空值,在这种设置下是可以允许一些非法操作的,比如允许一些非法数据的插入.在生产环境必须将这个值设置为严格模式,所以开发.测试环境的数据库也必须要设置,这 ...

  2. MySQL升级

    MySQL的升级相对来说还是比较简单的. 它支持两种方式的升级: 原地升级(In-place Upgrade) 关闭数据库,替换旧的二进制文件,重启数据库,执行mysql_upgrade 逻辑升级(L ...

  3. mysql5.1升级到mysql5.6

    这么大跨度的升级,本身不推荐.升级应该是循序渐进的,以防止不兼容.如果确实要这么做,你先要确保你的客户端管理工具要能兼容,比如phpmyadmin,此次升级依然存在一个问题,mysql server和 ...

  4. MySQL 升级详细步骤 (包括 Percona)

    MySQL 升级步骤 MySQL 5.1.72 升级到 MySQL 5.5.36 鉴于我在升级的时候遇到的麻烦问题,我觉得有必要把一些细节说清楚,免得引起误解了.感觉官方文档上的升级步骤写的比较简单, ...

  5. centos升级mysql至5.7

    1.备份原数据库 [root@www ~] #mysqldump -u root –p -E –all-database > /home/db-backup.sql 加-E是因为mysqldum ...

  6. mysql5.5.x升级到mysql5.6.x

    大概步骤是: 把配置文件添加:skip-grant-tables参数,把basedir升级成新版本,启动mysql,执行命令:mysql_upgrade升级一下字典信息,然后flush privile ...

  7. MySQL 5.1.73升级为MySQL 5.5.35详解

    一.前言 二.概述 三.安装MySQL 5.1.73 四.升级为MySQL 5.5.35 五.总结 注,测试环境 CentOS 6.4 x86_64,MySQL 版本(5.1.73.5.5.35)目前 ...

  8. Centos Mysql 升级

    如何升级CentOS 6.5下的MySQL CentOS 6.5自带安装了MySQL 5.1,但5.1有诸多限制,而实际开发中,我们也已经使用MySQL 5.6,这导致部分脚本在MySQL 5.1中执 ...

  9. mysql升级小结和mysql_upgrade的用途

    http://blog.itpub.net/15480802/viewspace-1412259/ mysql升级 1 升级方式 分为In-place和out-of-place,前者直接覆盖当前版本, ...

随机推荐

  1. js操作DOM在父元素中的结尾添加子节点注意

    impressionHtml=`<img src=${value} alt=""/>`; document.getElementById("wrapper&q ...

  2. [IR] Graph Compression

    Ref: [IR] Compression Ref: [IR] Link Analysis Planar Graph From: http://www.csie.ntnu.edu.tw/~u91029 ...

  3. JS 对象的深拷贝和浅拷贝

    转载于原文:https://www.cnblogs.com/dabingqi/p/8502932.html 这篇文章是转载于上面的链接地址,觉得写的非常好,所以收藏了,感谢原创作者的分享. 浅拷贝和深 ...

  4. df

    hdu 1052 Tian Ji -- The Horse Racing (2011-08-26 08:32:51) 转载▼ 标签: 杂谈 分类: acm杂谈 Tian Ji -- The Horse ...

  5. 洛谷P1219 八皇后【dfs】

    题目描述 检查一个如下的6 x 6的跳棋棋盘,有六个棋子被放置在棋盘上,使得每行.每列有且只有一个,每条对角线(包括两条主对角线的所有平行线)上至多有一个棋子. 上面的布局可以用序列2 4 6 1 3 ...

  6. 试水Spring Cloud Hystrix

    Spring Cloud Hystrix是一个容错库,它实现了断路器模式,使得当服务发生异常时,会自动切断连接,并将请求引导至预设的回调方法. 服务端 在Spring Tool Suite的文件菜单中 ...

  7. update set from 语句用法

    关键字: update set from 下面是这样一个例子: 两个表a.b,想使b中的memo字段值等于a表中对应id的name值     表a:id, name               1   ...

  8. RMQ算法详解

    RMQ算法,是一个快速求区间最值的离线算法,预处理时间复杂度O(n*log(n)),查询O(1),所以是一个很快速的算法. 当然这个问题用线段树同样能够解决,算法复杂度为:O(N)~O(logN) . ...

  9. 简单的Git流程

    一.安装cygwin 略 二. 1.创建一个文件 $echo "中华人民共和国">>abc.txt 2.添加到文件追踪 $git add abc.txt 上一行是提交一 ...

  10. [No0000D3]bat当前路径currentPath.bat

    @echo off echo 当前盘符:%~d0 echo 当前盘符和路径:%~dp0 echo 当前批处理全路径:%~f0 echo 当前盘符和路径的短文件名格式:%~sdp0 echo 当前CMD ...