zoukankan      html  css  js  c++  java
  • mysqldbcompare-网站迁移神器

    一、代码
    1.本地重新建立站点,配置nginx和host,并导入新站代码;

    二、数据库
    2.导出旧站数据库结构和数据;
    3.本地旧站数据库;
    4.使用mysqldbcompare对比新旧站数据库结构。命令:
    mysqldbcompare --server1=root:123456@192.168.56.101 --server2=root:123456@192.168.56.101 --changes-for=server2 --difftype=sql --skip-table-options --skip-row-count --skip-checksum-table --skip-data-check --run-all-tests theme:otheme>diff_of_dbs.sql
    5.如果旧站包含比新站多的数据表,略过,在调试接口的时候在验证是否有影响。
    6.如果旧站有缺少了新站中的数据表,根据表结构差异创建这些表(发到正式站之前,要拿正式站对比测试站表)。
    7.如果表结构有更改,使用mysqldbcompare的结果alter这些数据表。
    注意:
    (1)mysqldbcompare生成的是用逗号隔开的多MySQL语句,这可能会有“Unknown column”错误,避免这个错误的方法就是去掉AFTER条件(这是MySQL的一个已知BUG):
    sAFTER (w+)([,;]{1})
    替换为:
    2
    (2)如果导入MySQL语句有error,那么这条语句会无法执行,修改正确后再单独导入这条语句。
    (3)MySQL执行之后再执行一次对比。
    8.对于mysqldbcompare中有DROP COLUMN的字段,需要在接口检查是否有引用。
    * theme_comment 删除theme_id
    * wallpaper_file_image 删除12个字段
    * wallpaper_subject 删除 14个字段
    * wallpaper_type 删除15个字段
    * wallpaperlive_file 删除2个字段
    * 删除theme_file_shows的索引:IX_resulution_status_sort

    三、配置
    8.修改数据库配置文件dbConfig.php,和原来的数据库匹配。
    9.修改站点配置文件application.ini,和新站点的域名匹配。


    四、配置nginx和域名

    *** <www> 代表网站源码根目录

    1.对比前后siteConfig.php,要做如下的目录调整:
    原目录 <www>/attachs/theme_theme/attachs/themefile/ 移动为 <www>/themefile/,在其下新建 file 目录,并把原themefile下面的所有目录移到 file 目录中。
    原目录 <www>/attachs/theme_theme/attachs/wallpaperlive/ 移动为 <www>/themefile/wallpaperlive/
    原目录 <www>/attachs/theme_theme/attachs/clock/ 移动为 <www>/themefile/clock
    原目录 <www>/attachs/theme_theme/attachs/Engin/ 移动为 <www>/themefile/Engin
    添加目录:<www>/themefile/font
    增加目录:<www>/themefile/themeEngine
    说明:<www>/themefile/ 和 <www>/attachs/ 目录归属于Nginx指定的用户。
    3.nginx配置添加如下代码:
    =============================
    a.开发站front.*域名
    正式站zassetsdl.*域名
    测试站90端口添加:
    location /down {
    alias <www>/themefile/;
    }
    b.开发站front.*、admin.*域名
    正式站assetsdl.*、themebackendadm.*域名
    测试站81、82端口,添加下面的代码
    location /statics {
    alias <www>/theme_theme/public/statics/;
    }

    c.测试站81、82端口添加:
    location /attachs/theme/ {
    alias <www>/attachs/theme_theme/attachs/;
    }

    d.开发站front.*域名
    正式站theme.*域名
    开发证82端口添加:
    location / {
    rewrite "^/detail/down/(.*)$" /detail/down?id=$1 last;
    rewrite (.*) /index.php last;
    }

  • 相关阅读:
    Elementary Methods in Number Theory Exercise 1.3.13
    Elementary Methods in Number Theory Exercise 1.3.17, 1.3.18, 1.3.19, 1.3.20, 1.3.21
    数论概论(Joseph H.Silverman) 习题 5.3,Elementary methods in number theory exercise 1.3.23
    Elementary Methods in Number Theory Exercise 1.2.31
    数论概论(Joseph H.Silverman) 习题 5.3,Elementary methods in number theory exercise 1.3.23
    Elementary Methods in Number Theory Exercise 1.3.13
    Elementary Methods in Number Theory Exercise 1.3.17, 1.3.18, 1.3.19, 1.3.20, 1.3.21
    Elementary Methods in Number Theory Exercise 1.2.31
    Elementary Methods in Number Theory Exercise 1.2.26 The Heisenberg group
    4__面向对象的PHP之作用域
  • 原文地址:https://www.cnblogs.com/ims2007/p/7521535.html
Copyright © 2011-2022 走看看