0

my company develop db crushed unexpectedly and it didn't restart or start now

I backup the file in /var/lib/mysql and clone them to my local to try recover it.

I lunched the same version of mariaDB by docker

the setting I used were here

docker-compose.yml

version: '3.1'

services:

  db:
    image: mariadb:10.3.25
    restart: always
    volumes:
     - ./mariadb/data/:/var/lib/mysql
     - ./mariadb/my.cnf:/etc/mysql/my.cnf
     - ./mariadb/logs:/logs
    environment:
      MYSQL_ROOT_PASSWORD: example

my.cnf

[client]                   
port  = 3306               
socket  = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
event_scheduler=ON
default-time_zone = '+8:00'
port  = 3306               
socket  = /tmp/mysql.sock
back_log = 50              
max_connections = 100      
max_connect_errors = 10    
table_open_cache = 2048    
max_allowed_packet = 16M   
binlog_cache_size = 1M     
max_heap_table_size = 64M  
read_buffer_size = 2M      
read_rnd_buffer_size = 16M 
sort_buffer_size = 8M      
join_buffer_size = 8M      
thread_cache_size = 8      
thread_concurrency = 2    
query_cache_size = 64M     
query_cache_limit = 2M     
ft_min_word_len = 4        
default-storage-engine = InnoDB        
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M                   
tmp_disk_table_size = 1G              
log-bin=mysql-bin                     
expire-logs-days=60            
binlog_format=mixed                     
slow_query_log                         
long_query_time = 5                   
log-error=/logs/error.log   
server-id = 1                          
key_buffer_size = 32M                 
bulk_insert_buffer_size = 64M          
myisam_sort_buffer_size = 128M          
myisam_max_sort_file_size = 10G        
myisam_repair_threads = 1             
myisam-recover-options                         
innodb_data_home_dir = /var/lib/mysql  
innodb_buffer_pool_size=1G          
innodb_data_file_path = ibdata1:12M;ibdata2:74M:autoextend  
innodb_log_group_home_dir = /var/lib/mysql
innodb_write_io_threads = 8        
innodb_read_io_threads = 8             
innodb_thread_concurrency=5         
innodb_flush_log_at_trx_commit = 1     
innodb_log_buffer_size=8M            
innodb_log_file_size=150M            
innodb_log_files_in_group=3          
innodb_max_dirty_pages_pct = 90        
innodb_lock_wait_timeout=50          
init_connect='SET clooation_connection = utf8_unicode_ci'
init_connect='SET NAMES uft8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
init_file=/opt/init.sql              
[mysqldump]
quick
max_allowed_packet = 16M  
[mysql]
no-auto-rehash
default-character-set = utf8
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192               

after install it I enter into the container and implement mysql command, which was the message i got

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

and the log of db container were

2022-05-27 11:51:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.3.25+maria~focal started.
2022-05-27 11:51:01+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-05-27 11:51:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.3.25+maria~focal started.
2022-05-27 11:51:01 0 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
2022-05-27 11:51:01 0 [Note] mysqld (mysqld 10.3.25-MariaDB-1:10.3.25+maria~focal-log) starting as process 1 ...
mysqld: Can't create file '/logs/error.log' (errno: 13 "Permission denied")
2022-05-27 11:51:01 0 [Note] InnoDB: Using Linux native AIO
2022-05-27 11:51:01 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-05-27 11:51:01 0 [Note] InnoDB: Uses event mutexes
2022-05-27 11:51:01 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-05-27 11:51:01 0 [Note] InnoDB: Number of pools: 1
2022-05-27 11:51:01 0 [Note] InnoDB: Using SSE2 crc32 instructions
2022-05-27 11:51:01 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 8, chunk size = 128M
2022-05-27 11:51:01 0 [Note] InnoDB: Completed initialization of buffer pool
2022-05-27 11:51:01 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-05-27 11:51:01 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=42671766726
2022-05-27 11:51:05 0 [Note] InnoDB: 1 transaction(s) which must be rolled back or cleaned up in total 4 row operations to undo
2022-05-27 11:51:05 0 [Note] InnoDB: Trx id counter is 59006964
2022-05-27 11:51:05 0 [Note] InnoDB: Starting final batch to recover 6297 pages from redo log.
2022-05-27 11:51:07 0 [Note] InnoDB: Last binlog file './mysql-bin.000230', position 168122090

I waited for a period of time and the program was freeze here Is it running recovery program? or just stuck here ? How can I do for recovery and let it work well ?

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
Champer Wu
  • 1,101
  • 3
  • 13
  • 32
  • 1
    did you find any solution ? i did restart my docker container and it freezed at this line 2022-08-04 0:28:28 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). and i did it a couple of time and the same is happening, any idea ? – Hanna Aug 03 '22 at 23:41
  • @Hanna Yeah ! I have found a solution, if you needed, I could answer myself – Champer Wu Aug 11 '22 at 09:44
  • 1
    it eventually worked i just had to wait for like 30 40 min because our database is 3T and it needs time to start – Hanna Aug 12 '22 at 10:13

0 Answers0