AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 667118
Accepted
ZioByte
ZioByte
Asked: 2015-02-13 07:09:48 +0800 CST2015-02-13 07:09:48 +0800 CST 2015-02-13 07:09:48 +0800 CST

Redmine 数据迁移中断安装(错误 500)

  • 772

我正在尝试迁移旧的安装:

Environment:
  Redmine version                          2.2.3.stable
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.12
  Environment                              production
  Database adapter                         Mysql2
Redmine plugins:
  no plugin installed

到新机器:

Environment:
  Redmine version                2.6.1.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  3.2.21
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.17
  Mercurial                      2.2.2
  Bazaar                         2.6.0
  Git                            1.7.10.4
  Filesystem                     
Redmine plugins:
  redmine_dmsf                   1.4.9 stable

我在旧服务器上做了一个简单的备份:

root@redmine www/redmine# /usr/bin/mysqldump -u root -p"...redmine" redmine_production | gzip > redmine_`date +%y_%m_%d`.gz
root@redmine www/redmine# tar cjf files.tar.bz2 files

并试图在新的(工作的,但空的)机器中恢复它:

root@redmine ~# cd /var/www/redmine/
root@redmine www/redmine# scp mcon@syno0:files.tar.bz2 .
files.tar.bz2                                         100% 4229     4.1KB/s   00:00
root@redmine www/redmine# scp mcon@syno0:redmine_15_02_12.gz .
redmine_15_02_12.gz                                   100%   11KB  11.2KB/s   00:00

*** here Redmine server is STILL working ***

root@redmine www/redmine# service apache2 stop
[ ok ] Stopping web server: apache2 ... waiting .
root@redmine www/redmine# tar xjf files.tar.bz2
root@redmine www/redmine# zcat redmine_15_02_12.gz | mysql --user=root --password=...redmine     redmine_production
root@redmine www/redmine# rake db:migrate
==  Setup: migrating ==========================================================
-- create_table("attachments", {:force=>true})
   -> 0.0082s
-- create_table("auth_sources", {:force=>true})
   -> 0.0043s
-- create_table("custom_fields", {:force=>true})
   -> 0.0041s
-- create_table("custom_fields_projects", {:id=>false, :force=>true})
   -> 0.0043s
-- create_table("custom_fields_trackers", {:id=>false, :force=>true})
   -> 0.0037s
-- create_table("custom_values", {:force=>true})
   -> 0.0049s
-- create_table("documents", {:force=>true})
   -> 0.0041s
-- add_index("documents", ["project_id"], {:name=>"documents_project_id"})
   -> 0.0127s
-- create_table("enumerations", {:force=>true})
   -> 0.0052s
-- create_table("issue_categories", {:force=>true})
   -> 0.0036s
-- add_index("issue_categories", ["project_id"], {:name=>"issue_categories_project_id"})
   -> 0.0158s
-- create_table("issue_histories", {:force=>true})
   -> 0.0191s
-- add_index("issue_histories", ["issue_id"], {:name=>"issue_histories_issue_id"})
   -> 0.0143s
-- create_table("issue_statuses", {:force=>true})
   -> 0.0046s
-- create_table("issues", {:force=>true})
   -> 0.0045s
-- add_index("issues", ["project_id"], {:name=>"issues_project_id"})
   -> 0.0149s
-- create_table("members", {:force=>true})
   -> 0.0062s
-- create_table("news", {:force=>true})
   -> 0.0052s
-- add_index("news", ["project_id"], {:name=>"news_project_id"})
   -> 0.0139s
-- create_table("permissions", {:force=>true})
   -> 0.0044s
-- create_table("permissions_roles", {:id=>false, :force=>true})
   -> 0.0059s
-- add_index("permissions_roles", ["role_id"], {:name=>"permissions_roles_role_id"})
   -> 0.0168s
-- create_table("projects", {:force=>true})
   -> 0.0582s
-- create_table("roles", {:force=>true})
   -> 0.0045s
-- create_table("tokens", {:force=>true})
   -> 0.0044s
-- create_table("trackers", {:force=>true})
   -> 0.0037s
-- create_table("users", {:force=>true})
   -> 0.0048s
-- create_table("versions", {:force=>true})
   -> 0.0112s
-- add_index("versions", ["project_id"], {:name=>"versions_project_id"})
   -> 0.0428s
-- create_table("workflows", {:force=>true})
   -> 0.0059s
==  Setup: migrated (0.4712s) =================================================

**** MANY LINES, APPARENTLY WITHOUT ERROR ****

==  ChangeChangesetsCommentsLimit: migrating ==================================
-- change_column(:changesets, :comments, :text, {:limit=>16777216})
   -> 0.0081s
==  ChangeChangesetsCommentsLimit: migrated (0.0085s) =========================

==  AddPasswordChangedAtToUser: migrating =====================================
-- add_column(:users, :passwd_changed_on, :datetime)
   -> 0.0104s
==  AddPasswordChangedAtToUser: migrated (0.0108s) ============================

==  InsertBuiltinGroups: migrating ============================================
==  InsertBuiltinGroups: migrated (0.1441s) ===================================

root@redmine www/redmine# service apache2 start
[ ok ] Starting web server: apache2.
root@redmine www/redmine#

在此之后 Redmine 不再工作。尝试连接会导致:

Internal error

An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.

Back

我得到以下日志:

...
Connecting to database specified by database.yml
Creating scope :system. Overwriting existing method Enumeration.system.
Creating scope :sorted. Overwriting existing method User.sorted.
Creating scope :sorted. Overwriting existing method Group.sorted.
Started GET "/" for 192.168.7.114 at 2015-02-12 14:41:57 +0000
Processing by WelcomeController#index as HTML
  Current user: admin (id=1)
Completed 500 Internal Server Error in 75.0ms

NoMethodError (undefined method `passwd_changed_on' for #<User:0x00000006696f80>):
  app/controllers/application_controller.rb:150:in `force_logout_if_password_changed'

我究竟做错了什么?

migration
  • 1 1 个回答
  • 1952 Views

1 个回答

  • Voted
  1. Best Answer
    ZioByte
    2015-02-13T07:25:34+08:002015-02-13T07:25:34+08:00

    对我感到羞耻:

    事实证明,我错误地期望rake db:migrate对 采取行动production ENV,但事实并非如此。

    正确的命令是:rake db:migrate RAILS_ENV="production".

    当您盲目地复制和粘贴时,就会发生这种情况。

    抱歉打扰了(版主可以删除此问答,如果他们认为它可能有用)。

    作为记录:您还需要在进行还原之前删除 redmine_production 中的所有表,否则rake ...命令将失败并出现错误:

    Mysql2::Error: Table 'queries_roles' already exists: CREATE TABLE `queries_roles` (`query_id` int(11) NOT NULL, `role_id` int(11) NOT NULL) ENGINE=InnoDB/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query'
    
    • 1

相关问题

  • Linux 主机到主机迁移

  • 移至新的 Exchange 组织

  • 如何在 Windows 2003 Server 中获取激活密钥

  • 如何从 SQL Server 2005 迁移到 2008

  • 将 Bugzilla 迁移到 Team Foundation Server (TFS) 的方法或工具

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve