如何使用自己的许可证密钥在AWS EC2上运行MarkLogic?

时间:2012-09-05 21:29:31

标签: marklogic

我启动了运行linux的EC2实例,并安装了MarkLogic Server rpm。但是当我尝试启动MarkLogic服务时,我看到这样的消息:

Waiting for block device on /dev/sdf
Waiting for block device on /dev/sdf
Waiting for block device on /dev/sdf

没有/dev/sdf。我怎样才能解决这个问题?

2 个答案:

答案 0 :(得分:6)

设置EC2实例时,建议您还添加EBS块。系统会要求您提供设备名称。目前,在使用RedHat AMI 时,无论您选择何种名称,您的第一台设备都将被装载为/dev/xvdl。解决问题的方法是,执行此操作后,执行ln /dev/xvdl /dev/sdf - 一个硬链接。

正如上面的答案所说,启动脚本在启动时会查找此设备,如果格式化并在/var/opt/MarkLogic安装,则会对其进行格式化。

这应该解决问题。

答案 1 :(得分:3)

MarkLogic Server for Linux内置了一个假设。如果它发现它在xen虚拟机管理程序下运行并且它可以使用AWS API找到EC2主机名,则它假定它是MarkLogic Server AMI的实例。 AMI希望将/dev/sdf用于其默认数据目录。文档主要讨论使用MarkLogic Server AMI,但在http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/xml/ec2/instance.xml%2381403

上简要提到了这个问题的解决方案。

事实证明,启动脚本/etc/init.d/MarkLogic正在查看环境变量MARKLOGIC_EBS,以决定是否等待/dev/sdf出现。该MARKLOGIC_EBS变量在/etc/sysconfig/MarkLogic中设置,由管理员编辑(例如,您也可以将MARKLOGIC_USER设置为daemon以外的其他内容)。

因此,我们可以修改/etc/sysconfig/MarkLogic以忽略/dev/sdf。以下是该文件的有趣部分:

# the initial hostname that MarkLogic should use on Amazon EC2
if [ -d /proc/xen ]; then
  if [ "`curl -s --connect-timeout 2 -o /tmp/public-hostname -w %{http_code} http://169.254.169.254/2007-03-01/meta-data/public-hostname`" = "200" ]; then
    MARKLOGIC_HOSTNAME=`cat /tmp/public-hostname`
    MARKLOGIC_EC2_HOST=1
    MARKLOGIC_EBS=/dev/sdf
  fi
fi

最简单的解决方案是注释掉设置MARKLOGIC_EBS的行。

 the initial hostname that MarkLogic should use on Amazon EC2
if [ -d /proc/xen ]; then
  if [ "`curl -s --connect-timeout 2 -o /tmp/public-hostname -w %{http_code} http://169.254.169.254/2007-03-01/meta-data/public-hostname`" = "200" ]; then
    MARKLOGIC_HOSTNAME=`cat /tmp/public-hostname`
    MARKLOGIC_EC2_HOST=1
    #MARKLOGIC_EBS=/dev/sdf
  fi
fi

这将解决问题,但每次服务启动或重新启动时,MarkLogic仍会从AWS API获取其公共主机名。这可能会导致轻微的延迟 - 可能不重要。但是你也可能存在这个问题:

# the initial hostname that MarkLogic should use on Amazon EC2
if [ "" -a -d /proc/Xxen ]; then
  if [ "`curl -s --connect-timeout 2 -o /tmp/public-hostname -w %{http_code} http://169.254.169.254/2007-03-01/meta-data/public-hostname`" = "200" ]; then
    MARKLOGIC_HOSTNAME=`cat /tmp/public-hostname`
    MARKLOGIC_EC2_HOST=1
    #MARKLOGIC_EBS=/dev/sdf
  fi
fi

但是,您决定绕过EC2测试,现在可以启动MarkLogic服务,而不必担心/dev/sdf。当然,您仍需要MarkLogic Server许可证。请参阅http://developer.marklogic.com/licensing以了解有关不同许可选项的更多信息。

请注意,升级MarkLogic Server时,rpm可能会使用新版本的/etc/sysconfig/MarkLogic。准备好将您对此文件的任何更改与新版本合并。