gitlab数据迁移问题记录 |
您所在的位置:网站首页 › gitlab迁移到gitea › gitlab数据迁移问题记录 |
背景: git默认的repo目录满了,需要迁移到更大的目录上 机器:centos7.9 gitlab-ce版本:8.13.1 迁移前目录:/var/opt/gitlab/git-data 迁移后的目录:/data/gitlab/git-data 操作步骤: 1、创建/data/gitlab/git-data 2、将/var/opt/gitlab/git-data/repositories目录上的数据拷贝到/data/gitlab/git-data目录 3、停止服务 #gitlab-ctl stop #systemctl stop gitlab-runsvdir 如果是在ubuntu13上应该是: service gitlab-runsvdir stop,查看状态是 service gitlab-runsvdir status。 一定要记得停止gitlab-runsvdir服务,否则在reconfigure的时候,可能会失败。 4、再次增量拷贝预防漏掉数据 rsync -av 192.xx.xx.xx:/var/opt/gitlab/git-data/repositories /data/gitlab/git-data 5、执行gitlab-ctl reconfigure,让新的配置文件生效 在执行reconfigure前,做好先确认一下还有没有git相关的进程,有残留的进程应该先kill掉。 #ps -ef | grep git 6、启动服务 #systemctl restart gitlab-runsvdir #gitlab-ctl restart #systemctl status gitlab-runsvdir #gitlab-ctl status 7、验证在浏览器上是否可以正常访问git,git push,查看数据是否存储到更改后的目录上。 报错集合 1、gitlab-ctl reconfigure执行到gitlab_shell.rb相关的时候,报错 “Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb TypeError no implicit conversion of Mash into String” 问题:系统上安装过两个版本的gitlab-ce,目前使用的是比较老的版本的gitlab-ce,他们的配置文件稍微有点不一样。 解决: 修改/etc/gitlab/gitlab.rb,将git_data_dirs的格式改一下: 修改前: git_data_dirs({ "default" => { "path" => "/data/gitlab/git-data" } }) 修改后: git_data_dirs({"default" => "/data/gitlab/git-data"}) 2、gitlab-ctl reconfigure的时候clear the gitlab-rails cache失败,报错 “[execute] psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?” “Error executing action `run` on resource 'execute[create gitlab database user]'” Error executing action `run` on resource 'execute[clear the gitlab-rails cache]'“” 问题:runsvdir这个组件在监控/opt/gitlab/service,当发现异常的时候会自动把gitlab相关的服务启动起来。 解决: 先停止gitlab-runsvdir服务,再重新reconfigure。 #systemctl stop gitlab-runsvdir #gitlab-ctl reconfigure 3、svlogd sidekiq进程异常,导致runsvdir重启的时候出问题。 #ps -ef | grep runsvdir,看到进程异常 “runsvdir -P /opt/gitlab/service log: : unable to lock directory: /var/log/gitlab/gitlab-workhorse: temporary failure svlogd: fatal: no functional log directories . svlogd: warning: unable to lock directory: /var/log/gitlab/logrotate: ” 问题: svlogd 进程异常,ps 查找svlogd sidekiq进程的时候,发现它的父进程是1,已经被系统纳管。正常它的父进程是runsv sidekiq的进程。 gitlab-ctl status的时候看到,进程的log是异常的‘sidekiq: (pid 18733) 159s; down: log: 0s, normally up, want up’ 解决: #systemctl stop gitlab-runsvdir kill掉svlogd相关的进程 #ps -ef | grep -i git |grep svlogd |awk '{print $2}' |xargs kill -9 #systemctl start gitlab-runsvdir #ps -ef | grep -i git |grep svlogd ;查看进程,已经恢复正常。 #gitlab-ctl status;进程恢复正常 其他: git数据迁移之后git操作变慢,git占用的cpu和内存飙升。(目前问题未知,重新clone的数据git操作是正常的) |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |