USER CONFERENCE 2011 SAN FRANCISCO APRIL 26 29 Running MarkLogic in the Cloud DEVELOPER LOUNGE LAB
Table of Contents UNIT 1: Lab description... 3 Pre-requisites:... 3 UNIT 2: Launching an instance on EC2... 3 Creating an Amazon EC2 Account... 3 Ordering a MarkLogic Server for EC2 AMI... 3 Accessing the AWS Management Console... 4 Creating a Security Group... 6 Creating a Key Pair... 9 Creating an Instance of MarkLogic Server from an AMI... 10 UNIT 3: Create an EBS volume and attach it to an instance... 15 UNIT 4: Startup MarkLogic and accessing MarkLogic Server Admin Interface... 17 UNIT 6: Application Builder Exercise... 23 UNIT 7: Resources... 25 Copyright 2011 MarkLogic Corporation. MarkLogic is a registered trademark and MarkLogic Server is a trademark of MarkLogic Corporation, all rights reserved. All other product names mentioned herein are the property of their respective owners.
UNIT 1: Lab description Running MarkLogic Server on Amazon EC2 provides you with all of the MarkLogic Server functionality you love along with the benefits of cloud computing. This lab will walk you through setting up a MarkLogic Server instance on EC2 and then step through building an application using Application Builder. Pre-requisites: Laptop with wireless connectivity Activated Amazon Web Services account Some basic knowledge about MarkLogic Server UNIT 2: Launching an instance on EC2 Creating an Amazon EC2 Account Before you can order a MarkLogic Server for EC2 AMI, you must set up an Amazon EC2 account. To set up an Amazon EC2 account, go to http://aws.amazon.com/ec2 and click Sign Up for Amazon EC2: Then follow the directions to create a new account. You will need to provide email and mail addresses, create a password, and provide credit card information. Ordering a MarkLogic Server for EC2 AMI MarkLogic provides public AMIs that makes it easy to create a new MarkLogic Server instance running on EC2. You can place an order for a MarkLogic Server for EC2 AMIs from the cloud-computing page on the MarkLogic developer site: http://developer.marklogic.com/products/server-for-ec2 MarkLogic Corporation Running MarkLogic in the Cloud 3
Follow the link on the MarkLogic Cloud Computing page to access the Amazon Payments page. An Amazon EC2 account is required to access this page. Here you will find detailed information on pricing and you will have the option to place an order to subscribe to a MarkLogic AMI service. Placing an order allows you to access the AMI from within Amazon's EC2 administration tools. You are not charged any up-front fees. You are only charged for hourly usage of the instances of MarkLogic Server you create. Once you have decided on your order, click Place Your Order: Next you will see a page containing your Activation Key. You will not need the Activation Key, so there is no need to save a copy of the key. Accessing the AWS Management Console This section describes how to access the Amazon AWS Management Console. 1. Visit the link below and click on Sign in to the AWS Management Console http://aws.amazon.com/console/ 2. Select Amazon EC2 from the drop down bog and click Sign into the AWS Console and enter your email address and password for your EC2 account: MarkLogic Corporation Running MarkLogic in the Cloud 4
3. The AWS Management Console appears: MarkLogic Corporation Running MarkLogic in the Cloud 5
Creating a Security Group A Security group is a named collection of firewall access rules for your EC2 instance. These access rules control the incoming network traffic delivered to your instance. Any incoming network traffic that does not pass the rules established in your security group is discarded. This section describes how to create a security group. 1. From the AWS Management Console, select Security Groups from the left-hand navigation section: 2. In the Security Groups page, click Create Security Group: MarkLogic Corporation Running MarkLogic in the Cloud 6
3. You will be prompted for a name and description for this new security group. Enter the name and description and click Create: 4. Select the newly created security group in the Security Groups page. Click on Inbound and create new rules. Use Custom TCP Rule the connection method protocol (TCP), port range, and source IP or group. Specify a port range that includes 8001 for the MarkLogic Server Admin interface, as well as any other ports required for your MarkLogic Server applications. Example: 7999-8003 MarkLogic Corporation Running MarkLogic in the Cloud 7
In order to secure your internal ports from attack, you can specify a source IP subnet or group for port 8001, as well as any other ports not intended for access by the general public. You might also want to specify port 22 for SSH access. Click Add Rule for each port configuration you specify for this security group and then once all are added, click Apply Rule Changes. MarkLogic Corporation Running MarkLogic in the Cloud 8
Creating a Key Pair A key pair ensures that only you have access to your instances. You can create one or more Amazon EC2 key pairs. You can use a key pair to SSH to your instance. 1. From the AWS Management Console, select Key Pairs from the lefthand navigation section and click Create Key Pair in the Key Pairs page: 2. Enter a name for your key pair and click Create: 3. Your key pair will be downloaded to your local system. When the download of the key pair completes, click Save File Note: The key pair is used incase you create an SSH connection to your MarkLogic Server instance. This lab does not require it. MarkLogic Corporation Running MarkLogic in the Cloud 9
Creating an Instance of MarkLogic Server from an AMI This section describes how to create an instance of MarkLogic Server from a MarkLogic Server AMI. 1. From the AWS Management Console, select Instances from the lefthand navigation section and click Launch Instance in the My Instances page: 2. Select the Community AMIs tab and enter marklogic in the search box. 3. From the list of MarkLogic Server AMIs, locate the MarkLogic Community AMI highlighted below and click Select: MarkLogic Corporation Running MarkLogic in the Cloud 10
4. In the Launch Instance Wizard page, enter the number of instances, the availability zone, and the instance type (the memory and CPU resources to be used to host the instance). Select Launch Instances to pay for the Amazon resources used by your instance by the hour. Click Continue. 5. Click the defaults on this page. Click Continue. MarkLogic Corporation Running MarkLogic in the Cloud 11
6. Enter a Key and Value in the Instance Details section 7. Select the key pair you created, as described in the Creating a Key Pair section, or create a new key pair. Click Continue. 8. Select the security group you created, as described in Creating a Security Group, or create a new security group. Click Continue. MarkLogic Corporation Running MarkLogic in the Cloud 12
9. Click Launch to create the instance. MarkLogic Corporation Running MarkLogic in the Cloud 13
Note: It may take up to several minutes before your MarkLogic Server instance changes from pending to running status. Click Refresh to view the current status of your instance. 10. Select your EC2 instance and, in the Description section of the screen, note the Zone in which the instance was created. This will be needed when attaching your EBS volume to this instance. MarkLogic Corporation Running MarkLogic in the Cloud 14
UNIT 3: Create an EBS volume and attach it to an instance This section describes how to create an EBS volume and attach it to your MarkLogic Server instance. 1. From the AWS Management Console, select Volumes from the lefthand navigation section. In the EBS Volumes page, select Create Volume: 2. In the Create Volume window, specify a volume size large enough for your needs and the same availability zone associated with your instance. Specify the same zone as the instance to which you intend to attach the volume. Warning: The zones for your instance and EBS volume may not be the same by default. When finished, click Create. Locate the reference to this new volume in the right-hand section of the management console and verify that the status is available. MarkLogic Corporation Running MarkLogic in the Cloud 15
3. From the AWS Management Console, Amazon EC2 tab, select Volumes from the left-hand navigation section and then click Attach Volume. 4. In the Attach Volume window, specify the instance you launched from the MarkLogic Server AMI. For the Device selection, use /dev/sdf. Click Attach when you are finished. Locate the reference to this volume in the right-hand section of the management console and verify that the status is "in-use". If the status is not 'in-use,' continue to click Refresh until the status changes to 'in-use.' MarkLogic Corporation Running MarkLogic in the Cloud 16
UNIT 4: Startup MarkLogic and accessing MarkLogic Server Admin Interface This section describes how to access the Admin interface for your instance of MarkLogic Server. 1. From the AWS Management Console, select Instances from the lefthand navigation section. Locate your MarkLogic Server instance and copy the Public DNS value: MarkLogic Corporation Running MarkLogic in the Cloud 17
You use the Public DNS to formulate part of the URL to access the MarkLogic Server administration console. For example, if the Public DNS is ec2-75-101-210-0.compute-1.amazonaws.com, then the URL you enter into the browser would be: http://ec2-75-101-210-0.compute-1.amazonaws.com:8001 2. After entering the URL in your browser, you will be presented with a License Key Entry screen. Click on Free MarkLogic Corporation Running MarkLogic in the Cloud 18
3. Next, fill out the form displayed with your details and click the select community license button. MarkLogic Corporation Running MarkLogic in the Cloud 19
4. You will then be presented with License Information. Click OK. MarkLogic Corporation Running MarkLogic in the Cloud 20
5. You will now be presented with the MarkLogic End User License Agreement. Once you accept the terms of the agreement, click Accept. 6. In the Server Install page, click OK: 7. In the Security Setup page, enter the name and password for the administrator: MarkLogic Corporation Running MarkLogic in the Cloud 21
8. You now have access to the MarkLogic Server Admin interface: MarkLogic Corporation Running MarkLogic in the Cloud 22
UNIT 6: Application Builder Exercise 1. Bring up Application Builder in a browser window at Port 8002. Example: http://ec2-75-101-210-0.compute-1.amazonaws.com:8002 2. Click New Sample Application 3. Name the application and database 'Oscars' and click Create Application. MarkLogic Corporation Running MarkLogic in the Cloud 23
4. Click the Deploy tab. The Compile and Launch Application page appears. 5. Select New App Server button and click the Deploy button and confirm. 6. When the new application is complete, log in as admin. The Oscars sample application is created with a few sample documents. You can enter search terms or click on the browse links to narrow the results displayed. MarkLogic Corporation Running MarkLogic in the Cloud 24
7. If you want to load the full content set, click the Load Full Sample Dataset link toward the bottom of the page. The full dataset is around 20 MB to download. After clicking the link, the data will download and load automatically (internet connection is required). A spinning icon will appear until the load is complete. When it is done, you will notice that the counts have changed and additional facet values are visible. UNIT 7: Resources You can find additional information at the following locations: Download MarkLogic Server at http://developer.marklogic.com/products Find documentation, tutorials and more at http://developer.marklogic.com/ MarkLogic Corporation Running MarkLogic in the Cloud 25