如何创建DB2多实例?

时间:2014-12-15 08:40:22

标签: db2 chef

我有一个响应文件,它创建了一个DB2实例。

如何使用响应文件创建多个Db2实例以进行DB2的静默安装?

2 个答案:

答案 0 :(得分:0)

最好的猜测是创建模板。

然后在配方中,使用不同参数从模板创建文件,并通知资源中的执行。

像这样的东西(未经测试的代码,只是为了说明):

Attribute.rb

default['db2']['instances']['A']['port'] = 1234
default['db2']['instances']['A']['bind_adress'] = "*"
default['db2']['instances']['A']['password'] = "whatever"

default['db2']['instances']['B']['port'] = 1235
default['db2']['instances']['B']['bind_adress'] = "*"
default['db2']['instances']['B']['password'] = "whatever"

default.rb(食谱)

node['db2']['instances'].each do |id,properties|
  template "/path/to/db2_#{id}_answer" do
    source "answer_file.erb"
    notifies :run, "execute[install_db2_#{id}"
    variabes (
      vars => properties
    )
  end

  execute "install_db2_#{id}" do
    command "/path/to/script_to_init /path/to/db2_#{id}_answer"
    action :nothing
  end
end

答案 1 :(得分:0)

在响应文件中,您可以定义多个实例。你必须将它们定义为

INSTANCE                  = DB2_INS2        ** char(8)  no spaces

然后,为此实例定义每个元素

DB2_INS2.NAME             = db2inst1        ** char(8)  no spaces, no upper case letters
DB2_INS2.GROUP_NAME       = db2iadm1        ** char(30) no spaces

工作DB2_INS2只是响应文件中的名称,而不是实例的名称。

您可以提供任何名称。另一方面,它可能是

INSTANCE                  = PROD        ** char(8)  no spaces
PROD.NAME             = db2inst1        ** char(8)  no spaces, no upper case letters
PROD.GROUP_NAME       = db2iadm1        ** char(30) no spaces

响应文件的一节介绍了如何定义多个实例:

** 2nd (non-pureScale) Instance Creation Settings
** ----------------------------------------------
** Multiple (non-pureScale) DB2 instances can be created in the same
** installation. This section shows how to specify the 2nd instance in the rsp
** file. Note: Only a subset of the instance keywords are listed below. You can
** specify other instance related keywords similar as the 1st instance. All
** keywords in this section are commented out. By default, only one instance
** will be created during the install.