У меня есть ошибка в моих конвейерах gitlab ci/cd, она часто выдает ошибку SQLSTATE[HY000] [2002] Соединение отклонено несколько раз, на самом деле это может быть успешным, просто повторив попытку конвейера заданий, но я не хочу, чтобы это произошло случилось, что мне делать?
The Tests\Hr\HrInit\HrInitGetBeforeSelectCompanyTest::testGetBeforeSelectCompany test took 956.6 seconds!
Time: 16:17.855, Memory: 115.50 MB
There was 1 error:
1) Tests\Hr\HrInit\HrInitGetBeforeSelectCompanyTest::testGetBeforeSelectCompany
Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] Connection refused (SQL: alter table `hr_schedule_patterns` add `is_archive` tinyint unsigned not null default '0' after `is_flexible`)
Я пытался добавить --wait-timeout=28800, а также max_allowed_packet=64M, что мне делать?
файл gitlab-ci. yml :
workflow:
auto_cancel:
on_new_commit: interruptible
stages:
- preparation
- deploy
- testing-finance
- testing-framework-slow
- testing-hr
image: registry.gitlab.com/kledo/backend/php:7.4-cli-alpine-v3
services:
- name: registry.gitlab.com/kledo/backend/mysql:8.0.28
alias: mysql
command: ['mysqld', '--wait-timeout=28800', '--max-connections=10000']
- name: registry.gitlab.com/kledo/backend/redis:7.0.5-alpine
alias: redis
variables:
DB_HOST: mysql
LOG_CHANNEL: pipeline
MYSQL_ROOT_PASSWORD: secret
REDIS_HOST: redis
REDIS_PORT: 6379
before_script:
#- php --version
#- mysql --version
#- df -h
#- free -m
#- top -n1 -b
#- mysql --host="${DB_HOST}" --user="root" --password="${MYSQL_ROOT_PASSWORD}" -e "SELECT user, host FROM mysql.user;"
#- mysql --host="${DB_HOST}" --user="root" --password="${MYSQL_ROOT_PASSWORD}" -e "SHOW DATABASES;"
#- mysql --host="${DB_HOST}" --user="root" --password="${MYSQL_ROOT_PASSWORD}" -e "show variables like '%innodb_flush_log_at_trx_commit%';"
#- mysql --host="${DB_HOST}" --user="root" --password="${MYSQL_ROOT_PASSWORD}" -e "show variables like '%innodb_doublewrite%';"
#- mysql --host="${DB_HOST}" --user="root" --password="${MYSQL_ROOT_PASSWORD}" -e "SHOW VARIABLES;"
- sh time.sh
- rm -f .env.testing
- mv .env.testing.gitlab .env.testing
cache:
key: ${CI_COMMIT_REF_SLUG}
default:
interruptible: true
artifacts:
paths:
- ./storage
expire_in: 1 week
when: always
tags:
- backend
include:
- '.gitlab/composer.yml'
- '.gitlab/deploy.yml'
- '.gitlab/tests/**.yml'
файл my.cnf:
[mysql]
[mysqld]
authentication-policy=mysql_native_password
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
connect-timeout=7200
general-log=0
innodb-buffer-pool-size=3G
innodb-doublewrite=0
innodb-fast-shutdown=2
innodb-flush-log-at-trx-commit=0
innodb-flush-method=O_DIRECT
innodb-io-capacity=400
innodb-log-file-size=1048576
innodb-open-files=400
max-connections=4096
myisam-recover-options=BACKUP
net-read-timeout=7200
net-write-timeout=7200
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
thread-cache-size=128
max_allowed_packet=64M
Подробнее здесь: https://stackoverflow.com/questions/789 ... b-pipeline