Question

How do I install CQ5 in an Amazon EC2 server?

 

 

Overview

The following article is a step-by-step introduction how manage CQ5 instances on Amazon EC2 instances. The article includes a script that can be used to setup single instances - or new cluster nodes that automatically join an existing instance pool.

Note: The scripts are experimental and have no error handling implemented (they assume everything is prepared the way it was designed).

For Products + Version

  • CQ 5.3.0

For Host Operating System

  • Fedora 8 (32bit & 64bit)
  • CentOS 5.4 (32bit & 64bit)

What Does the Script Do?
The attached script will automate the installation of a CQ5 instance in an Amazon EC2 server.

  • Support for CentOS 5.4
  • Support for 64bit setups
  • CRX/CQ5 now starts as "crx" user with the ability to open more files
  • Configurable script makes it easy to customize to your needs

Answer

1. Learn how to use EC2 (with command line)

Following howto from Robert Sosinski is specifically written for Mac users:

2. Learn how to use EC2 (with web UI)

Although you can master the basic tasks with the AWS Management Console, advanced task such as monitoring and load-balancer are only available via the command line.

3. Deploy CRX/CQ5

  1. Make sure the Security Group has Port 22 and 8080/8081 open
  2. Start an EC2 instance with "Basic Fedora Core 8" or CentOS
  3. Download the shell script that stages the instance (install java, configure and start quickstart)
  4. If you do not have the CQ5 jar file then download it from daycare here
  5. Download Oracle Java JDK 6 RPM for Linux from here
  6. Upload the CQ5 jar file, Oracle RPM file, and your license.properties file to the root user's home directory:
    scp -i ~/.ssh/ec2-keypair cq-wcm-quickstart-5.3.0.20100127.jar root@ec2-______.compute-1.amazonaws.com:.
    scp -i ~/.ssh/ec2-keypair jdk-6u20-linux-amd64.rpm root@ec2-______.compute-1.amazonaws.com:.
    scp -i ~/.ssh/ec2-keypair cq-wcm-quickstart-5.3.0.20100127.jar root@ec2-______.compute-1.amazonaws.com:.
  7. Open the aws-deploy-cq530.sh shell script in an editor and customize the configuration section to your needs
  8. Run cat aws-deploy-cq530.sh | ssh -i ~/.ssh/yourec2key root@ec2-______.compute-1.amazonaws.com
  9. Wait until script is finish and CRX/CQ5 has created the repository and started all bundles - then browse to port 8080/8081 on the EC2 public DNS hostname

 

4. Customize Setup

Open the shell script and edit properties in the 1st section

  • install author or publish instance
  • change port
  • choose between TarPM and JournalPM

Create a Cluster

Edit CLUSTER_ACTION in the script. The repository data is shared with NFS from the 1st instance started on /mnt/cluster/author or publish/shared:

 

  1. use the script with CLUSTER_ACTION=master to start an instance
  2. use the script with CLUSTER_ACTION=fastjoin and add CLUSTER_MASTER. this connects to the master and creates a backup - restores the backup and starts the instance.

 

Alternative there is a CLUSTER_ACTION=join. That uses the official join method of CRX but it needs much more time as all bundels needs to be installed and search indexes created.

 

About the Deploy Script

  • installs Java 6 SDK
  • CQ5 is installed in /mnt/crx/author or publish/crx-quickstart/..
  • Master repository (shared) is installed in /mnt/cluster/author or publish/shared
  • creates an user crx to run the java process
  • the repository is created on the default disk - some EC2 instance use EBS harddisks - some volatile disks. verify that you have enough space

4. Operation

Shutdown/Startup CRX/CQ

use the serverctl located in /mnt/crx/author or publish/crx-quickstart/server to start and stop the server

  • start server: su -s /bin/bash crx ./start
  • stop server: ./stop

Appendix: useful unix commands

  • connect to instance using SSH: ssh -i ~/.ssh/ec2-keypair root@ec2-______.compute-1.amazonaws.com
  • show running processes: ps -efH
  • kill process (nice): kill <process id>
  • kill process (hard): kill -9 <process id>
  • free disk space: df -h
  • detailed directory list: ls -lah
  • watch a file change live: tail -f filename.log
  • find a string in a file: find filename.log -exec grep "string your are looking for" {} \; -print
  • recursive delete (without asking!): rm -Rf *
  • calculate folder size: du -sh /path/to/folder
  • use rsync to copy: rsync -a -r -W --delete --delete-after /mnt/crx/author /data/backup

Appendix: copy files from EC2 to your machine (and vice versa)

the simplest way is to use secure copy:

scp -i ~/.ssh/ec2-keypair root@ec2-______.compute-1.amazonaws.com:/path/file.ext file.ext

下載

此産品由 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 授權  Creative Commons 條款未涵蓋 Twitter™ 與 Facebook 文章。

法律說明   |   線上隱私權政策