问题发生背景
问题实例之前使用的是percona server,是安装pmm镜像自带的数据库,之后通过mysqldump迁移到了MySQL server,目前是只有有pmm server 访问pmm库,MySQL server就crash,并通过守护进程mysqld_safe 自动重启,crash 集尝试重启的一部分信息如下
11:24:49 UTC - mysqld got signal 11 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware. Attempting to collect some information that could help diagnose the problem. As this is a crash and something is definitely wrong, the information collection process might fail. key_buffer_size=8388608 read_buffer_size=131072 max_used_connections=2 max_threads=1000 thread_count=2 connection_count=2 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 405496 K bytes of memory Hope that's ok; if not, decrease some variables in the equation. Thread pointer: 0x7f7ac8000b30 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... stack_bottom = 7f7b20769e28 thread_stack 0x40000 /usr/local/mysql/bin/mysqld(my_print_stacktrace+0x35)[0xf32bd5] /usr/local/mysql/bin/mysqld(handle_fatal_signal+0x4a4)[0x77b844] /lib64/libpthread.so.0[0x3db380f710] /usr/local/mysql/bin/mysqld(_ZN10Field_blob15copy_blob_valueEP11st_mem_root+0x30)[0x7ab940] /usr/local/mysql/bin/mysqld(_Z25mysql_prepare_blob_valuesP3THDR4ListI4ItemEP11st_mem_root+0x35e)[0xe8309e] /usr/local/mysql/bin/mysqld(_Z12write_recordP3THDP5TABLEP9COPY_INFOS4_+0x251)[0xe835d1] /usr/local/mysql/bin/mysqld(_ZN14Sql_cmd_insert12mysql_insertEP3THDP10TABLE_LIST+0x8d2)[0xe84882] /usr/local/mysql/bin/mysqld(_ZN14Sql_cmd_insert7executeEP3THD+0xce)[0xe8500e] /usr/local/mysql/bin/mysqld(_Z21mysql_execute_commandP3THDb+0xd92)[0xd10fe2] /usr/local/mysql/bin/mysqld(_ZN18Prepared_statement7executeEP6Stringb+0x320)[0xd3ddd0] /usr/local/mysql/bin/mysqld(_ZN18Prepared_statement12execute_loopEP6StringbPhS2_+0xdb)[0xd3e04b] /usr/local/mysql/bin/mysqld(_Z19mysqld_stmt_executeP3THDmmPhm+0x11f)[0xd3e4cf] /usr/local/mysql/bin/mysqld(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0x74c)[0xd15c3c] /usr/local/mysql/bin/mysqld(_Z10do_commandP3THD+0x194)[0xd17114] /usr/local/mysql/bin/mysqld(handle_connection+0x294)[0xde1c34] /usr/local/mysql/bin/mysqld(pfs_spawn_thread+0x174)[0x11f96f4] /lib64/libpthread.so.0[0x3db38079d1] /lib64/libpthread.so.0[0x3db38079d1] /lib64/libc.so.6(clone+0x6d)[0x3db34e8b6d] Trying to get some variables. Some pointers may be invalid and cause the dump to abort. Query (7f7ac80054f0): Query (7f7ac80054f0): is an invalid pointer Connection ID (thread ID): 3 Status: NOT_KILLED The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains information that should help you find out what is causing the crash.180111 19:24:49 mysqld_safe Number of processes running now: 0180111 19:24:49 mysqld_safe mysqld restarted 2018-01-11T11:24:49.827511Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
原 percona server 版本:5.7.18-16;目前MySQL server 版本:5.7.10
尝试将MySQL server 版本升级到5.7.20,无法解决问题,后来变更为percona server 5.7的一个分支版本解决问题
通过rmp 安装percona server
# 安装yum 源 yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm # 安装percona server yum install Percona-Server-server-57
防止使用my.cnf启动,指定配置文件启动服务,使用现有的配置文件和数据文件
# 启动服务
/usr/bin/mysqld_multi --defaults-file=/etc/mysql/3306.cnf --mysqladmin=/usr/bin/mysqladmin --mysqld=/usr/bin/mysqld_safe --no-log start 3306
# 关闭服务
/usr/bin/mysqld_multi --defaults-file=/etc/mysql/3306.cnf --mysqladmin=/usr/bin/mysqladmin --mysqld=/usr/bin/mysqld_safe --no-log stop 3306
# 登陆
/usr/bin/mysql -S /tmp/mysql_3306.sock
关于MySQL server的pid-file 和mysqld_multi 的启动项
由于启动的选项是--defaults-extra-file 所以同时会读取全局变量文件/etc/my.cnf,可以设置为
[mysqld]
...
[mysqld_safe]
...
[mysqld_multi] mysqld=/usr/local/mysql/bin/mysqld_safe mysqladmin=/usr/local/mysql/bin/mysqladmin
对于--mysqld 的值可以是二进制文件mysqld的位置(会读取[mysqld]下的配置),守护进程mysqld_safe不会启动
也可以是mysqld_safe启动脚本的位置(会读取[mysqld_safe]下的配置),mysqld和守护进程mysqld_safe都会启动,如下可以看到两者的运行信息
ps -ef|grep 3309 root 27046 1 0 06:44 pts/3 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --server-id=1 --user=mysql --port=3309 --datadir=/data0/mysql/3309_test --socket=/tmp/mysql_3309.sock --innodb_data_home_dir=/data0/mysql/3309_test --innodb_log_group_home_dir=/data0/mysql/3309_test --transaction-isolation=READ-COMMITTED --explicit_defaults_for_timestamp=on --max_allowed_packet=100M --read_rnd_buffer_size=8M --tmp_table_size=128M --thread_cache_size=300 --max_connections=1000 --max_heap_table_size=128M --open-files-limit=10000 --max_connect_errors=999999999 --symbolic-links=0 --tmpdir=/data0/mysql/tmp --innodb_online_alter_log_max_size=1G --innodb_data_file_path=ibdata1:512M:autoextend --innodb_log_files_in_group=3 --innodb_buffer_pool_size=256M --innodb_log_file_size=100M --innodb_flush_log_at_trx_commit=1 --innodb_open_files=5000 --innodb_lock_wait_timeout=60 --log-error=log-error --slow_query_log_file=slow_query.log --slow_launch_time=2 --slow_query_log=1 --log-bin=mysql-bin --binlog_format=ROW --max_binlog_size=1G --expire_logs_days=15 --master-info-repository=TABLE --relay-log-info-repository=TABLE --gtid-mode=on --enforce-gtid-consistency=on --log-slave-updates=1 --relay-log=relay-log --sync-master-info=1 --skip-slave-start --slave_pending_jobs_size_max=104857600 --log_bin_trust_function_creators=1 --report-port=3309 --report-host=10.211.253.192 --slave-sql-verify-checksum=1 --master-verify-checksum=1 --slave_parallel_type=LOGICAL_CLOCK --slave-parallel-workers=4 --binlog_group_commit_sync_delay=100000 --skip-name-resolve --lower_case_table_names=1 --character-set-server=utf8 --sql_mode=NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION --slave_preserve_commit_order=1 --default_password_lifetime=0 --binlog_rows_query_log_events=1 mysql 30032 27046 1 08:54 pts/3 00:03:32 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data0/mysql/3309_test --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --server-id=1 --innodb-data-home-dir=/data0/mysql/3309_test --innodb-log-group-home-dir=/data0/mysql/3309_test --transaction-isolation=READ-COMMITTED --explicit-defaults-for-timestamp=on --max-allowed-packet=100M --read-rnd-buffer-size=8M --tmp-table-size=128M --thread-cache-size=300 --max-connections=1000 --max-heap-table-size=128M --max-connect-errors=999999999 --symbolic-links=0 --tmpdir=/data0/mysql/tmp --innodb-online-alter-log-max-size=1G --innodb-data-file-path=ibdata1:512M:autoextend --innodb-log-files-in-group=3 --innodb-buffer-pool-size=256M --innodb-log-file-size=100M --innodb-flush-log-at-trx-commit=1 --innodb-open-files=5000 --innodb-lock-wait-timeout=60 --slow-query-log-file=slow_query.log --slow-launch-time=2 --slow-query-log=1 --log-bin=mysql-bin --binlog-format=ROW --max-binlog-size=1G --expire-logs-days=15 --master-info-repository=TABLE --relay-log-info-repository=TABLE --gtid-mode=on --enforce-gtid-consistency=on --log-slave-updates=1 --relay-log=relay-log --sync-master-info=1 --skip-slave-start --slave-pending-jobs-size-max=104857600 --log-bin-trust-function-creators=1 --report-port=3309 --report-host=10.211.253.192 --slave-sql-verify-checksum=1 --master-verify-checksum=1 --slave-parallel-type=LOGICAL_CLOCK --slave-parallel-workers=4 --binlog-group-commit-sync-delay=100000 --skip-name-resolve --lower-case-table-names=1 --character-set-server=utf8 --sql-mode=NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION --slave-preserve-commit-order=1 --default-password-lifetime=0 --binlog-rows-query-log-events=1 --log-error=/data0/mysql/3309_test/log-error.err --open-files-limit=10000 --pid-file=/data0/mysql/3309_test/mysql-bcc03.dev.yz.pid --socket=/tmp/mysql_3309.sock --port=3309
如果pid-file在配置文件中没有指定,则默认为$datadir/`hostname`.pid