esxi迁移虚拟机


简介

原来的esxi进行淘汰处理,需要将里面数据迁移出来,等新的服务器到了迁移过去
esxi: 122t raid6
备份机器: 7t hdd
新esxi:8
2t raid6

虚拟机

先发现资源池和vm

ovftool vi://root:{password}@{ip}/{ResourcePool}

如果是虚拟机模版,就需要使用vsphere的来进行下载了

进行虚拟机备份

把ovftool添加到环境变量后,windows下后面的用\

ovftool vi://root:{password}@{ip}/{ResourcePool}/{name} .\{name}

进行部分应用备份

nextcloud

把两个目录打包就ok了
把端口和数据库密码改成自己的
docker-compose.yaml

version: '3'

services:
  db:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    #command: --innodb-force-recovery=2
    #--transaction-isolation=READ-COMMITTED --binlog-format=ROW --log-bin
    restart: always
    volumes:
      - /data/nextcloud_db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=password
    env_file:
      - db.env

  redis:
    image: redis:alpine
    restart: always

  app:
    image: nextcloud:apache
    restart: always
    ports:
      - 80:80
    volumes:
      - /data/nextcloud:/var/www/html

    environment:
      - MYSQL_HOST=db
      - REDIS_HOST=redis
      - TZ=Asia/Shanghai
      - UID=1000
      - GID=1000
      - UPLOAD_MAX_SIZE=10G
      - APC_SHM_SIZE=128M
      - OPCACHE_MEM_SIZE=128
      - CRON_PERIOD=15m

    env_file:
      - db.env
    depends_on:
      - db
      - redis

  cron:
    image: nextcloud:apache
    restart: always
    volumes:
      - /data/nextcloud:/var/www/html
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis

db.env

MYSQL_PASSWORD=password
MYSQL_DATABASE=nextcloud
MYSQL_USER=nextcloud

迁移后,记得用原来的版本的docker先运行起来,跨版本容易出问题,
然后

chown -R www-data:www-data ./nextcloud
chown -R systemd-coredump:systemd-coredump ./nextcloud_db

gitlab

删了容器后把config、logs、data三个文件夹打包就行
start.sh

docker run -d  -p 443:443 -p 80:80 -p 22:22 --name gitlab --restart always -v /home/gitlab/config:/etc/gitlab -v /home/gitlab/logs:/var/log/gitlab -v /home/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:rc

恢复文件时候chmod -R 777 ./
gitlab会自动修复文件权限

然而对于sshkey文件不会修复,手动一下

chmod 600 /etc/gitlab/ssh_host_*
docker restart gitlab

搞定

gogs

gogs因为制作的时候比优化性能,所以有点麻烦
其实可以打包这个目录,
对于下面的文件,修改mysql_password,domain_name,SECRET_KEY

version: '3.6'

services:

  app:
    image: ${DOCKER_GOGS_IMAGE}
    restart: always
    networks:
      - traefik
      - gogs
    expose:
      - 80
    ports:
      - "22:22"
      - "80:80"
    links:
      - db:${MYSQL_HOST}
      - cache:${REDIS_HOST}
    depends_on:
      - db
      - cache
    labels:
      - "traefik.enable=true"
      - "traefik.port=80"
      - "traefik.frontend.rule=Host:${GOGS_DOMIAN}"
      - "traefik.frontend.entryPoints=http,https"
      - "traefik.frontend.headers.SSLRedirect=true"
      - "traefik.frontend.headers.SSLProxyHeaders=X-Forwarded-Proto:https"
      - "traefik.frontend.headers.STSSeconds=315360000"
      - "traefik.frontend.headers.frameDeny=true"
      - "traefik.docker.network=traefik"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
    extra_hosts:
      - "${GOGS_DOMIAN}:127.0.0.1"
    volumes:
      # 标准 Linux 系统下使用
      # - /etc/localtime:/etc/localtime:ro
      # - /etc/timezone:/etc/timezone:ro
      - ./app.ini:/data/gogs/conf/app.ini:ro
      - ./logs:/data/gogs/data/log
      - ./data/avatars:/data/gogs/data/avatars
      - ./data/ssh:/data/ssh
      - ./data/git:/data/git
      # 根据自己需求使用
      # - ./data/custom/template/head.tmpl:/app/gogs/templates/inject/head.tmpl
      # - ./data/custom/template/footer.tmpl:/app/gogs/templates/inject/footer.tmpl
      # - ./data/custom/inject-assets/:/app/gogs/public/inject-assets/
    healthcheck:
      test: ["CMD-SHELL", "wget -q --spider --proxy off localhost:80 || exit 1"]
      interval: 5s


  db:
    image: ${DOCKE_MYSQL_IMAGE}
    restart: always
    networks:
      - gogs
    expose:
      - 3306
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: gogs
      MYSQL_DATABASE: gogs
      MYSQL_USER: gogs
      MYSQL_PASSWORD: {password}
      TZ: Asia/Shanghai
    volumes:
      # 标准 Linux 系统下使用
      # - /etc/localtime:/etc/localtime:ro
      # - /etc/timezone:/etc/timezone:ro
      - ./mysql:/var/lib/mysql
    healthcheck:
      test: ["CMD-SHELL", "/etc/init.d/mysql status"]
      interval: 30s


  cache:
    image: ${DOCKER_REDIS_IMAGE}
    restart: always
    networks:
      - gogs
    expose:
      - 6379
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
    environment:
      TZ: Asia/Shanghai
    # volumes:
      # 标准 Linux 系统下使用
      # - /etc/localtime:/etc/localtime:ro
      # - /etc/timezone:/etc/timezone:ro

networks:
  gogs:
    internal: true
  traefik:
    external: true

app.ini

APP_NAME = Private Repo
RUN_USER = git
RUN_MODE = prod

[database]
DB_TYPE  = mysql
HOST     = mysql.gogs.{domain_name}:3306
NAME     = gogs
USER     = gogs
PASSWD   = {password}
SSL_MODE = disable
PATH     = data/gogs.db

[cache]
ADAPTER=redis
INTERVAL=60
HOST=network=tcp,addr=cache.gogs.{domain_name}:6379,password=,db=0,pool_size=100,idle_timeout=180

[repository]
ROOT = /data/git/gogs-repositories
FORCE_PRIVATE=true
MAX_CREATION_LIMIT=-1
DISABLE_HTTP_GIT=true

[server]
DOMAIN           = gogs.{domain_name}
HTTP_PORT        = 80
ROOT_URL         = https://gogs.{domain_name}/
DISABLE_SSH      = false
SSH_PORT         = 22
SSH_LISTEN_HOST  = 0.0.0.0
SSH_LISTEN_PORT  = 22
START_SSH_SERVER = ture
OFFLINE_MODE     = true

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL     = false
DISABLE_REGISTRATION   = true
ENABLE_CAPTCHA         = false
REQUIRE_SIGNIN_VIEW    = true

[picture]
DISABLE_GRAVATAR        = true
ENABLE_FEDERATED_AVATAR = false

[session]
PROVIDER=redis
PROVIDER_CONFIG=network=tcp,addr=cache.gogs.{domain_name}:6379,password=,db=0,pool_size=100,idle_timeout=180

[log]
MODE      = console, file
LEVEL     = Info
ROOT_PATH = /app/gogs/log

[admin]
DISABLE_REGULAR_ORG_CREATION=true

[security]
INSTALL_LOCK = true
LOGIN_REMEMBER_DAYS=true
SECRET_KEY   = {SECRET_KEY}

[other]
SHOW_FOOTER_BRANDING=false

文章作者: xyzz
文章链接: http://www.xyzzpwn.top
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 xyzz !
 上一篇
树莓派自控风扇 树莓派自控风扇
简介树莓派4b的自控风扇 主要信息系统: Debian-Pi-Aarch64 2020-06-22-v2020-2.0-U4-Release BaseOS Plus++三极管:S8050 NPN连接线:杜邦线公对母,母对母 连接方式风扇正极
2020-09-29
下一篇 
linux kernel hook linux kernel hook
简介好久都没搞linux的kernel了,记录一下 MakefileCONFIG_MODULE_SIG=n obj-m += hook_test.o all: make -C /lib/modules/$(shell uname -
2020-09-14
  目录