Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Language specific forums Russian (Русский) Сервер баз данных
  • Search

Ошибки с базой при бекапе

Вопросы по работе Сервера баз данных
MySQL, PostgreSQL, MariaDB, Percona Server, phpMyAdmin, phpPgAdmin
Post Reply
  • Print view
Advanced search
3 posts • Page 1 of 1
DevilStar
Posts: 51
Joined: Tue Sep 09, 2014 8:10 am
Contact:
Contact DevilStar
Website

Os: Ubuntu 15x
Web: nginx + php-fpm
Ошибки с базой при бекапе
  • Quote

Post by DevilStar » Thu Apr 09, 2015 6:11 am

Добрый день!

Посоветуйте куда копать пожалуйста.

В последнее время (недели три) начались какие-то проблемы при создании бэкапов (вручную и по крону). Баз мало, 23 штуки, самая большая - 12мб, самая маленькая - 0.5мб. Сервер и клиент - mariadb 10.1.3

Вот список ошибок которые я встречал:

Code: Select all

Can't dump database admin_*
mysqldump: Couldn't execute 'show table status like 'lsltk\_contact\_details'': Lost connection to MySQL server during query (2013)

Code: Select all

Can't dump database admin_*
mysqldump: Got error: 2013: "Lost connection to MySQL server during query" when using LOCK TABLES
Такие ошибки возникают всегда в разных базах (похоже что рандомно). Бекап в итоге иногда создается, а иногда нет. Иногда удается вручную снять бекап без ошибок (примерно с 5-6 попытки).

Характеристики vps: 1 cpu 3ghz, 1gb ram, 20gb ssd, kvm.

Вот содержимое my.cnf:

Code: Select all

# MariaDB database server configuration file.
#
# You can copy this file to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port		= 3306
socket		= /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
#
# * Basic Settings
#
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
lc_messages_dir	= /usr/share/mysql
lc_messages	= en_US
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address		= 127.0.0.1
#
# * Fine Tuning
#
max_connections		= 100
connect_timeout		= 5
wait_timeout		= 600
max_allowed_packet	= 16M
thread_cache_size       = 128
sort_buffer_size	= 4M
bulk_insert_buffer_size	= 16M
tmp_table_size		= 32M
max_heap_table_size	= 32M
#
# * MyISAM
#
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched. On error, make copy and try a repair.
myisam_recover          = BACKUP
key_buffer_size		= 128M
#open-files-limit	= 2000
table_open_cache	= 400
myisam_sort_buffer_size	= 512M
concurrent_insert	= 2
read_buffer_size	= 2M
read_rnd_buffer_size	= 1M
#
# * Query Cache Configuration
#
# Cache only tiny result sets, so we can fit more in the query cache.
query_cache_limit		= 128K
query_cache_size		= 64M
# for more write intensive setups, set to DEMAND or OFF
#query_cache_type		= DEMAND
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# we do want to know about network errors and such
log_warnings		= 2
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log[={0|1}]
slow_query_log_file	= /var/log/mysql/mariadb-slow.log
long_query_time = 10
#log_slow_rate_limit	= 1000
log_slow_verbosity	= query_plan

#log-queries-not-using-indexes
#log_slow_admin_statements
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id		= 1
#report_host		= master1
#auto_increment_increment = 2
#auto_increment_offset	= 1
log_bin			= /var/log/mysql/mariadb-bin
log_bin_index		= /var/log/mysql/mariadb-bin.index
# not fab for performance, but safer
#sync_binlog		= 1
expire_logs_days	= 10
max_binlog_size         = 100M
# slaves
#relay_log		= /var/log/mysql/relay-bin
#relay_log_index	= /var/log/mysql/relay-bin.index
#relay_log_info_file	= /var/log/mysql/relay-bin.info
#log_slave_updates
#read_only
#
# If applications support it, this stricter sql_mode prevents some
# mistakes like inserting invalid dates etc.
#sql_mode		= NO_ENGINE_SUBSTITUTION,TRADITIONAL
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine	= InnoDB
# you can't just change log file size, requires special procedure
#innodb_log_file_size	= 50M
innodb_buffer_pool_size	= 256M
innodb_log_buffer_size	= 8M
innodb_file_per_table	= 1
innodb_open_files	= 400
innodb_io_capacity	= 400
innodb_flush_method	= O_DIRECT
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0

[mysqldump]
quick
quote-names
max_allowed_packet	= 16M

[mysql]
#no-auto-rehash	# faster start of mysql but no tab completition

[isamchk]
key_buffer		= 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
Буду благодарен за помощь!

ps: --single-transaction дела не меняет, ошибки всё равно есть
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Ошибки с базой при бекапе
  • Quote

Post by skurudo » Thu Apr 09, 2015 6:37 am

У вас, судя по всему, база данный падает во время дампа.
Здесь имеет посмотреть лог ошибок mysql.

А для фикса сначала попробовать сделать репейр таблиц. Проверить.

Если не помогает, то крутить настройки my.cnf - viewtopic.php?f=14&t=5049#p12743 - сначала по минимуму, по необходимости повышать.
Top

DevilStar
Posts: 51
Joined: Tue Sep 09, 2014 8:10 am
Contact:
Contact DevilStar
Website

Os: Ubuntu 15x
Web: nginx + php-fpm
Re: Ошибки с базой при бекапе
  • Quote

Post by DevilStar » Thu Apr 09, 2015 6:45 am

Да, все происходит во время дампа.

Репаир делал командой:

Code: Select all

mysqlcheck -u -p --auto-repair --optimize --all-databases
Во время этого процесса иногда так же выскакивает ошибка в рандомном месте и приходится запускать заново

Code: Select all

mysqlcheck: got error: 2013: lost connection to mysql server during query when executing 'optimize table ... '
/var/log/mysql.log - весит 0 байт, пустой

/var/log/mysql/error.log:

Code: Select all

150116 06:20:29 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150116  6:20:29 [Note] Plugin 'FEDERATED' is disabled.
150116  6:20:29 InnoDB: The InnoDB memory heap is disabled
150116  6:20:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150116  6:20:29 InnoDB: Compressed tables use zlib 1.2.7
150116  6:20:29 InnoDB: Using Linux native AIO
150116  6:20:29 InnoDB: Initializing buffer pool, size = 128.0M
150116  6:20:29 InnoDB: Completed initialization of buffer pool
150116  6:20:29 InnoDB: highest supported file format is Barracuda.
150116  6:20:29  InnoDB: Waiting for the background threads to start
150116  6:20:30 InnoDB: 5.5.40 started; log sequence number 1595675
150116  6:20:30 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
150116  6:20:30 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
150116  6:20:30 [Note] Server socket created on IP: '0.0.0.0'.
150116  6:20:30 [Note] Event Scheduler: Loaded 0 events
150116  6:20:30 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.40-0+wheezy1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Debian)
150116  6:27:32 [Note] /usr/sbin/mysqld: Normal shutdown

150116  6:27:32 [Note] Event Scheduler: Purging the queue. 0 events
150116  6:27:32  InnoDB: Starting shutdown...
150116  6:27:32  InnoDB: Shutdown completed; log sequence number 1671219
150116  6:27:32 [Note] /usr/sbin/mysqld: Shutdown complete

150116 06:27:32 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Top


Post Reply
  • Print view

3 posts • Page 1 of 1

Return to “Сервер баз данных”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

cron

Login  •  Register

I forgot my password