How can I run MarkLogic on AWS EC2 using my own license key?

戏子无情 提交于 2019-12-12 05:07:09

问题


I started an EC2 instance running linux, and installed the MarkLogic Server rpm. But when I try to start the MarkLogic service, I see messages like this:

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

There is no /dev/sdf. How can I get past this problem?


回答1:


When setting up your EC2 instance, suggest you also add an EBS block. You will get asked for a device name. At present, when using the RedHat AMI, regardless of the name you choose, your first device will be mounted as /dev/xvdl. The solution to your problem is, having done this, do ln /dev/xvdl /dev/sdf - a hard link.

As the above answer says, the startup script looks for this device when starting up, formats it if it is not formatted and mounts at /var/opt/MarkLogic.

This should sort things out.




回答2:


MarkLogic Server for linux has an assumption built into it. If it sees that it is running under a xen hypervisor and it can find an EC2 hostname using AWS APIs, it assumes it is an instance of the MarkLogic Server AMI. That AMI expects to use /dev/sdf for its default data directory. The documentation mostly talks about using the MarkLogic Server AMI, but there is a brief mention of the solution to this problem at http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/xml/ec2/instance.xml%2381403

It turns out that the startup script, /etc/init.d/MarkLogic, is looking at the environment variable MARKLOGIC_EBS to decide whether or not to wait for /dev/sdf to appear. That MARKLOGIC_EBS variable is set in /etc/sysconfig/MarkLogic, which is meant to be edited by administrators (that's also where you can set MARKLOGIC_USER to something other than daemon, for example).

So we can edit /etc/sysconfig/MarkLogic to ignore /dev/sdf. Here is the interesting part of that file:

# 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

The simplest solution is to comment out the line that sets 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

That will fix the problem, but MarkLogic will still get its public-hostname from the AWS API every time the service starts or restarts. That might cause a slight delay - probably unimportant. But you could stub that out too:

# 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

However you decide to bypass the EC2 test, you are now ready to start the MarkLogic service without being pestered about /dev/sdf. You will still need a MarkLogic Server license, of course. See http://developer.marklogic.com/licensing to learn more about the different license options.

Note that when you upgrade MarkLogic Server, the rpm may contan a new version of /etc/sysconfig/MarkLogic. Be prepared to merge any of your changes to this file with the new version.



来源:https://stackoverflow.com/questions/12290077/how-can-i-run-marklogic-on-aws-ec2-using-my-own-license-key

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!