1

我在从 Opennebula 5.10 到 5.12 的数据库迁移过程中遇到了问题。onedb 升级命令后,我看到一个错误

尝试运行以其他版本编译的迁移器编译:2.0,安装:2.6

产生这个的函数:

def load_bytecode(file)
    file = File.open(file, 'rb')
    data = file.read

    file.close

    data = Zlib::Inflate.inflate(data)
    data = Marshal.load(data)

    c_ruby_version = Gem::Version.new(data.to_a[1..2].join('.'))
    i_ruby_version = Gem::Version.new(RUBY_VERSION.split('.')[0..1].join('.'))

    if c_ruby_version != i_ruby_version
        raise 'Attemp to run migrators compiled in other version' \
            "Compiled: #{c_ruby_version}, installed: #{i_ruby_version}"
    end

    new_iseq = RubyVM::InstructionSequence.load(data)
    new_iseq.eval
end

我认为那是因为我有不同版本的 ruby​​ 作为 root (2.0.0.) 和作为用户 (2.6.3)。更改后(更改为 2.6:root 有 2.6.6。而用户有 2.6.3。ruby 版本)我看到了同样的错误。

我也尝试以 root 身份运行onedb upgrade命令,但遇到了不同的问题:

/usr/lib/one/ruby/opennebula/xml_utils.rb:144:in `module:OpenNebula': nokogiri gem 未安装。(运行时错误)

安装尝试失败:

Building native extensions. This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

current directory: /opt/rh/rh-ruby26/root/usr/local/share/gems/gems/nokogiri-1.10.10/ext/nokogiri
/opt/rh/rh-ruby26/root/usr/bin/ruby -I /opt/rh/rh-ruby26/root/usr/share/rubygems -r ./siteconf20201103-67319-1vhrfa9.rb extconf.rb
mkmf.rb can't find header files for ruby at /opt/rh/rh-ruby26/root/usr/share/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /opt/rh/rh-ruby26/root/usr/local/share/gems/gems/nokogiri-1.10.10 for inspection.
Results logged to /opt/rh/rh-ruby26/root/usr/local/lib64/gems/ruby/nokogiri-1.10.10/gem_make.out

预先感谢您的帮助。

编辑我用 nokogiri 解决了这个问题 -rh-ruby26-ruby-devel.x86_64 0:2.6.2-118.el7包丢失了。之后,我尝试以onedb upgraderoot 身份运行,但仍然出现相同的错误:

Attemp to run migrators compiled in other versionCompiled: 2.0, installed: 2.6
4

0 回答 0