0

我尝试准备大型工件文件(约 1 GB)。但我遇到了下一个错误:

...
Stopping my_mysql ... done
$ docker run --rm --volumes-from my_mysql carinamarina/backup backup --source /var/lib/mysql/ --stdout --zip > data/db-data-volume.tar.gz
Unable to find image 'carinamarina/backup:latest' locally
latest: Pulling from carinamarina/backup
ee54741ab35b: Pulling fs layer
a548ccba3eed: Pulling fs layer
f9a81fa3bb17: Pulling fs layer
00d43d18903a: Pulling fs layer
bee2159ca4d3: Pulling fs layer
3a4a2afad82b: Pulling fs layer
bee2159ca4d3: Waiting
3a4a2afad82b: Waiting
00d43d18903a: Waiting
a548ccba3eed: Verifying Checksum
a548ccba3eed: Download complete
f9a81fa3bb17: Verifying Checksum
f9a81fa3bb17: Download complete
ee54741ab35b: Verifying Checksum
ee54741ab35b: Download complete
ee54741ab35b: Pull complete
00d43d18903a: Verifying Checksum
00d43d18903a: Download complete
bee2159ca4d3: Verifying Checksum
bee2159ca4d3: Download complete
3a4a2afad82b: Verifying Checksum
3a4a2afad82b: Download complete
a548ccba3eed: Pull complete
f9a81fa3bb17: Pull complete
00d43d18903a: Pull complete
bee2159ca4d3: Pull complete
3a4a2afad82b: Pull complete
Digest: sha256:aa7de94eb992c54024c3b5a181e8ba0fc61986f26310b723774f01ebcae6788a
Status: Downloaded newer image for carinamarina/backup:latest
Uploading artifacts...
data/db-data-volume.tar.gz: found 1 matching files 
ERROR: Uploading artifacts to coordinator... error  error=couldn't execute POST against https://gitlab.my.ru/api/v4/jobs/3764/artifacts?expire_in=1+week: Post https://gitlab.my.ru/api/v4/jobs/3764/artifacts?expire_in=1+week: net/http: timeout awaiting response headers id=3764 token=M9Xe65yo
WARNING: Retrying...                               
WARNING: Uploading artifacts to coordinator... failed  id=3764 responseStatus=504 Gateway Time-out status=504 Gateway Time-out token=M9Xe65yo
WARNING: Retrying...    

错误:将工件上传到协调器...错误错误=无法针对https://gitlab.my.ru/api/v4/jobs/3764/artifacts?expire_in=1+week执行 POST :发布https://gitlab .my.ru/api/v4/jobs/3764/artifacts?expire_in=1+week:net/http:超时等待响应标头 id=3764 token=M9Xe65yo

我的.gitlab-ci.yml

.backup: &backup_definition
  before_script:
    - apk add --no-cache py-pip
    - pip install docker-compose
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - chmod 644 ~/.ssh/known_hosts
    - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
    - chmod 600 ~/.ssh/id_rsa
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.my.ru
  script:
    - cp env/${ENV_NAME}.env .env
    - docker-compose up -d mysql
    - docker-compose exec -T mysql /download.sh
    - docker-compose exec -T mysql /wait-for-it.sh mysql:3306 -- echo "MySql started"
    - docker-compose exec -T mysql /restore.sh
    - docker-compose stop mysql
    - docker run --rm --volumes-from my_mysql carinamarina/backup backup --source /var/lib/mysql/ --stdout --zip > data/db-data-volume.tar.gz
  artifacts:
    paths:
      - data/db-data-volume.tar.gz
    expire_in: 1 week
  tags:
    - tests-runner
  image: docker:latest
  services:
    - name: docker:dind
  when: manual

backup-my2:
  <<: *backup_definition
  variables:
    ENV_NAME: "my2"

backup-my2-repo:
  <<: *backup_definition
  variables:
    ENV_NAME: "my2_repo"

小工件处理得很好。我对大型工件有疑问。如何增加超时?

4

1 回答 1

1

如果您使用 golang net/http 类库并且 http.client 使用传输,请检查您的传输是否设置了 ResponseHeaderTimeout 参数。如果设置了,可能是这个参数引起的。http调用的请求执行时间超过了ResponseHeaderTimeout设置的时间

解决方案一、http.Client.Transport.ResponseHeaderTimeout参数二、优化后端服务处理能力

于 2018-10-08T10:49:29.850 回答