zoukankan      html  css  js  c++  java
  • gitlab迁移

    1.简介

    公司需要将Redhat7.4上部署gitlab迁移到另一台Redhat7.6电脑上,在此记录迁移步骤。真是折腾。。。

    2.安装gitlab

    在新服务器上安装gitlab,注意保证迁移的两台服务器gitlab版本一致。

    2.1.检查旧服务器上安装的gitlab版本

    2.2.下载对应版本并安装

    在这个网站上找到对应版本:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

    wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.1.1-ce.0.el7.x86_64.rpm
    yum localinstall gitlab-ce-12.1.1-ce.0.el7.x86_64.rpm

    2.3.redhat替换yum

    安装依赖前注意,如果新装redhat系统,yum源需要注册,花钱才能使用。需要替换为centos的yum。

    https://www.cnblogs.com/SmilingEye/p/11188228.html这个是安装svn时遇到替换yum问题。

    2.4.安装与配置必要依赖

    sudo yum install -y curl policycoreutils-python openssh-server
    sudo systemctl enable sshd
    sudo systemctl start sshd
    
    sudo firewall-cmd --permanent --add-service=http
    sudo firewall-cmd --permanent --add-service=https
    sudo systemctl reload firewalld
    sudo yum install postfix
    sudo systemctl enable postfix
    sudo systemctl start postfix

    3.备份

    使用以下命令进行备份。
    /usr/bin/gitlab-rake gitlab:backup:create
    
    默认备份完成的文件存放目录为:/var/opt/gitlab/backups。若该目录下不存在,则需要查看/etc/gitlab/gitlab.rb配置中对应的gitlab_rails['backup_path']选项所指定的目录。

    4.迁移数据

    在旧服务器上运行下面代码,root@172.16.1.245=username@新服务器ip。

    下面文件为设置的ip端口,邮件服务等(可选迁移,服务地址为172.16.1.144:9000改为172.16.1.245:9000,使用原来的地址此处就不用改)

    scp /etc/gitlab/gitlab.rb root@172.16.1.245:/etc/gitlab/gitlab.rb

    不知道这个文件有什么用?

    scp /etc/gitlab/gitlab-secrets.json root@172.16.1.245:/etc/gitlab/gitlab-secrets.json

    重新进行gitlab配置

    sudo gitlab-ctl reconfigure

    迁移

    scp /var/opt/gitlab/backups/1569307987_2019_09_24_12.1.1_gitlab_backup.tar root@172.16.1.245:/var/opt/gitlab/backups

    5.恢复备份

    5.1.赋予权限

    chmod 777 /var/opt/gitlab/backups/1569307987_2019_09_24_12.1.1_gitlab_backup.tar 

    5.2.恢复备份

    sudo gitlab-rake gitlab:backup:restore BACKUP=1569307987_2019_09_24_12.1.1

    6.重启

    gitlab-ctl reconfigure
    gitlab-ctl restart

    7.注意关闭防火墙

    启动一个服务:systemctl start firewalld.service
    关闭一个服务:systemctl stop firewalld.service(关闭防火墙)
    重启一个服务:systemctl restart firewalld.service
    显示一个服务的状态:systemctl status firewalld.service(查看状态)
    在开机时启用一个服务:systemctl enable firewalld.service
    在开机时禁用一个服务:systemctl disable firewalld.service(开机关闭不启动防火墙)
    查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?
    查看已启动的服务列表:systemctl list-unit-files|grep enabled

  • 相关阅读:
    字号、pt、px、em换算对照表
    回车自动提交 禁止回车自动提交
    working copy locked (svn)
    xUnit asp.net单元测试工具基本使用
    防御网站攻击 1
    Access restriction: The type HttpServlet is not accessible due to restriction on required library xxxx\servletapi.jar
    【转载】将sqlserver表中的数据导出sql语句或生成insert into语句
    动态切换数据源(spring+hibernate)
    MSSQL2005移植到MYSQL 5.0
    C++ Primer 4 CPP Note 2.1.1 整型和浮点型
  • 原文地址:https://www.cnblogs.com/SmilingEye/p/11583608.html
Copyright © 2011-2022 走看看