Announcement: Liferay Faces 3.1.3-ga4 Released

Company Blogs 2013/09/06 投稿者 Neil Griffin Staff

On September 5, 2013 Liferay released the 4th General Availability (GA) release of Liferay Faces:

  • Liferay Faces 3.1.3-ga4 (JSF 2.1 + Liferay 6.1.x -- including 6.1.2 CE and 6.1.30 EE)
  • Liferay Faces 3.0.3-ga4 (JSF 2.1 + Liferay 6.0.x)
  • Liferay Faces 3.0.3-legacy-ga4 (JSF 2.1 + Liferay 5.2.x)
  • Liferay Faces 2.1.3-ga4 (JSF 1.2 + Liferay 6.1.x)

Project Links

Version Scheme

Please refer to the Liferay Faces Version Scheme wiki article for a detailed explanation of the version numbering.

Release Highlights

This is a maintenance release that has 35+ bug fixes25+ improvements, and 5+ new features. For full details, please refer to the Release Notes. This is the first release of Liferay Faces that has been certified as being compatibile with the new Liferay Portal 6.1.2 CE GA3 and 6.1.30 EE GA3 releases.


The Facelet taglib documentation has been moved out of the PDF documentation directly into the taglib files and Facelet Composite Component files. We are now using the vdldoc project to generate View Description Language (VDL) documentation:

Updated Wiki Articles

Many of the Liferay Faces wiki articles have been updated with instructions for deploying JSF portlets on various servers ( GlassFish, Jetty, JBoss AS, Resin, Tomcat, WebLogic, and WebSphere) as well as upgrading Mojarra and Weld.

New Demo: jsf2-spring-portlet

In order to test the Spring Framework, we developed a new jsf2-spring-portlet demo that shows how to use annotations like javax.inject.Injectjavax.inject.Named, and org.springframework.context.annotation.Scope("request").

Critical Bug Fixes / Improvements

It is no longer necessary to specify the Mojarra ConfigureListener or the Liferay Faces BridgeSessionListener in the WEB-INF/web.xml descriptors of portlets. In addition, the following is a list if critical bug fixes / improvements:

  • [FACES-1706] - Upgrade 3.1.x and 2.1.x branches from Liferay Portal 6.1.1 to Liferay Portal 6.1.2 API
  • [FACES-1656] - Provide ability to discover Mojarra InjectionProvider during execution of the JSF lifecycle
  • [FACES-1655] - Enable zero-config of com.liferay.faces.bridge.servlet.BridgeSessionListener by registering it in liferay-faces-bridge-impl!META-INF/bridge.tld
  • [FACES-1664] - Develop shared library modules for WebLogic
  • [FACES-1675] - Add reference to jsf shared library to weblogic.xml descriptors
  • [FACES-1619] - UnsupportedOperationException when trying to add JSF portlets to a portal page dynamically
  • [FACES-1674] - Resource libraries/collections are not marked as being added to the <head>...</head> section of the portal page
  • [FACES-1713] - liferay-ui:input-editor does not store aui:script text in WebKeys.AUI_SCRIPT_DATA request attribute during ajax requests on versions of Liferay Portal prior to 6.1.2/6.1.30

Thank You

Thanks to everyone in the community that reported issues, contributed patches, and participated in the forums!

Maven Tip: Activating Profiles With Multiple Conditions

General Blogs 2013/08/10 投稿者 Neil Griffin Staff

When working with Maven profiles, sometimes you need to activate a profile when multiple conditions are true. Although the <activation> element in pom.xml lets you specify more than one condition, the conditions are evaluated with the OR operator rather than the AND operator.

When Maven executes profiles, it executes them in the following manner:

  • Profiles that were specified with the "-P" command line switch, according to their order of appearance in the pom
  • All other profiles that might conditionally activate, such as profiles that activate based on the existence of a file in the current module

Using this knowledge of profile execution, I came up with a way of activating profiles when multiple conditions are true, based on the presence of a temporary file whose name has one or more property values.

HOWEVER... this only works when Maven is executed in a directory that contains a parent pom. It does not work in a sub-module (like a war project), because the temporary file is created after all of the profiles have been activated.

Example: Only include Xerces as a dependency for portlet WAR projects that are to be deployed on WebLogic:

    <!-- The following profile must appear before other profiles -->
    <!-- and is activated only when WEB-INF/portlet.war is found -->
                                    <touch file="target/${app.server.type}-portlet-war-activation.tmp" />
    <!-- The following profile is activated with "-P weblogic" on the command line -->
    <!-- The following profile is activated only for weblogic portlet wars -->

This is an approach that can be used in Maven 2/3. Perhaps MNG-4565 will be implemented as a feature in some future version of Maven.

Running Windows XP Professional with VMWare Fusion and Multiple Processors

General Blogs 2013/08/02 投稿者 Neil Griffin Staff

I was recently installed a ".vmdk" image into VMware Fusion on a MacBook Pro with multiple processor cores. The operating system in the image was Windows XP Professional with Service Pack 3. After I installed the image, I assigned 4 processors to the VM using VMWare Settings. But after I started the VM, I noticed that the XP Task Manager was showing only 1 processor.

I did some searching on the web and found that XP Professional supports multiple processors, but the VMware Community forums had a lot of unanswered questions. Finally I found a VMware Knowledge Base article titled Modifying the Hardware Abstraction Layer (HAL) for a Windows virtual machine (1003978) that provided some guidance.

In the Device Manager, I double clicked on the "Computer" node in the tree and it expanded to show a "Single Processor PC" node. I then right clicked on that node and left clicked on "Update Driver" and after a reboot, it showed "Multiprocessor PC" and the Task Manager was showing multiple CPUs.

You can verify this further by following these steps:

  • Open Windows Explorer
  • Navigate down to C:\WINDOWS\system32
  • Right click on the hal.dll file and left click on "Properties"
  • Click on the Version tab
  • Click on the Internal Name list item

If the value is halmacpi.dll then the Windows HAL is setup for multiple processors.

Hope this helps somebody in the future so that they don't have to spend as much time on this as I did.

Announcement: Liferay Faces 3.1.2-ga3 Released

Company Blogs 2013/06/03 投稿者 Neil Griffin Staff

On June 1, 2013 Liferay released the 3rd General Availability (GA) release of Liferay Faces:

  • Liferay Faces 3.1.2-ga3 (JSF 2.1 + Liferay 6.1.x)
  • Liferay Faces 3.0.2-ga3 (JSF 2.1 + Liferay 6.0.x)
  • Liferay Faces 3.0.2-legacy-ga3 (JSF 2.1 + Liferay 5.2.x)
  • Liferay Faces 2.1.2-ga3 (JSF 1.2 + Liferay 6.1.x)

Project Links

Version Scheme

Please refer to the Liferay Faces Version Scheme wiki article for a detailed explanation of the version numbering.

Release Highlights

This is a maintenance release that has 50+ bug fixes20+ improvements, and 10+ new features. For full details, please refer to the Release Notes.

New Feature: CDI Support

One of the exciting new features in this release is support for Contexts and Dependency Injection (CDI), thanks to the new Liferay CDI Portlet Bridge. We developed a new jsf2-cdi-portlet demo that shows how to use annotations like javax.inject.Injectjavax.inject.Named, and javax.enterprise.context.RequestScoped. For more information, refer to the new Developing JSF Portlets with CDI wiki article.

Critical Bug Fixes

  • [FACES-224] JSF 2.x f:viewParam feature not working due to RenderRequestPhaseListener stopping lifecycle phase execution after RESTORE_VIEW phase
  • [FACES-257] Bridge generates URLs that can be incompatible with Liferay friendly URLs
  • [FACES-1463] References to BridgeRequestScope instances causing memory leak
  • [FACES-1470] Memory leak for RequestScoped, SessionScoped, and ViewScoped managed-beans when running under Mojarra + JBoss AS
  • [FACES-1496] Memory leak with Mojarra and JSF2 resources
  • [FACES-1591] ViewExpiredException when Ajax is used on WebLogic


We have strengthened our commitment to quality with a new suite of automated integration tests that utilize Selenium via Arquillian. The tests exercise the Liferay Faces demo portlets and also verify bug fixes with issue tester portlets. For example, the FACES-257 Selenium Test exercises the FACES-257-portlet in order to verify that f:viewParam is working in conjuntion with Liferay friendly URLs.

Thank You

Thanks to everyone in the community that reported issues, contributed patches, and participated in the forums!

JSFCentral Interview: Neil Griffin on Liferay Projects, Portlets, and JSF

Company Blogs 2013/01/16 投稿者 Neil Griffin Staff

I really enjoyed the JSFCentral Interview by Kito Mann. The podcast was posted on December 06, 2012.

Some of the topics we discussed:
  • Liferay Portal
  • Liferay Faces
  • JSR 329
  • CDI

Contributing to Liferay Faces

Company Blogs 2012/12/21 投稿者 Neil Griffin Staff

Note: This blog post has been moved to the Liferay Faces Wiki.

Announcement: Liferay Faces 3.1.1-ga2 Released

Company Blogs 2012/12/12 投稿者 Neil Griffin Staff

On December 11, 2012 Liferay released the 2nd General Availability (GA) release of Liferay Faces:

  • Liferay Faces 3.1.1-ga2 (JSF 2.0/2.1 + Liferay 6.1.x)
  • Liferay Faces 3.0.1-ga2 (JSF 2.0/2.1 + Liferay 6.0.x)
  • Liferay Faces 2.1.1-ga2 (JSF 1.2 + Liferay 6.1.x)

Project Links

Version Scheme

For information on the Liferay Faces Version Scheme, refer to the Liferay Faces Wiki article.

Release Highlights

This is a maintenance release that fixes several bugs including a memory leak (documented in FACES-1445). Liferay recommends that all JSF portlet projects be upgraded to this new version. Please refer to the Release Notes for more information.

Thanks to everyone in the community that reported issues, contributed patches, and participated in the forums!

Announcement: PrimeFaces Technology Partnership

Company Blogs 2012/10/31 投稿者 Neil Griffin Staff

Liferay has entered into a new technology partnership with PrimeTek Informatics, maker of PrimeFaces.

Customers who have purchased Liferay EE and PrimeFaces PRO now enjoy the benefit of a communication channel between our companies, so that technology issues can be resolved in accordance with corresponding Service Level Agreements (SLAs). In addition, this partnership will ensure that our mutual customers will be able to develop PrimeFaces portlets that can be used in conjunction with the Liferay Faces Alloy component suite.

Please vote for Liferay to serve on the JCP Executive Committee

Company Blogs 2012/10/28 投稿者 Neil Griffin Staff

UPDATE: 10/30: Congratulations to the London Java Community and to CloudBees! And thanks to everyone who voted for Liferay.

UPDATE 10/19: Liferay Sr. Software Architect Ray Augé spoke on behalf of Liferay on the "Meet the EC Candidates" call. You can listen to Ray on the MP3 recording from 19m 50s - 23m 35s.

This year Liferay is running for election to serve on the JCP Executive Committee. To my great surprise, Liferay nominated me to be the company's representative. I'm truly honored to be nominated, and if we are elected, we will endeavor to serve the Java community well.
Here is the company description that we submitted for the 2012 Executive Committee Nominations page:
Liferay is an open source software company that is dedicated to the success of the Java platform. As a privately held company, we are free from investor pressures which in turn makes us free to serve the best interests of our 70,000+ member community. We have benefitted greatly from the contributions and feedback of our community members and strongly believe in open/transparent processes. We will strive to contribute this experience if we are elected to serve on the JCP Executive Committee.
We also submitted a brief Position Statement.
If you are a member of the JCP, please cast your vote for Liferay! The voting period is from October 16, 2012 - October 29 2012. We would treasure your vote and would be honored to serve.
Thank you,

Announcement: Liferay Faces in Maven Central

Company Blogs 2012/08/31 投稿者 Neil Griffin Staff

The new location for downloading Liferay Faces artifacts (JARs, WARs, etc.) is Maven Central.

As part of the migration of Liferay Faces from to, the Nexus repository is being phased-out. Now that the artifacts are in Maven Central, developer should remove the following repository from project pom.xml files:


Announcement: Liferay Faces 3.1.0-ga1 Released

Company Blogs 2012/08/22 投稿者 Neil Griffin Staff

UPDATE: Liferay Faces in Maven Central

On August 22, 2012 Liferay issued a press release announcing the first General Availability (GA) release of Liferay Faces:

  • Liferay Faces 3.1.0-ga1 (JSF 2.0/2.1 + Liferay 6.1.x)
  • Liferay Faces 3.0.0-ga1 (JSF 2.0/2.1 + Liferay 6.0.x)
  • Liferay Faces 2.1.0-ga1 (JSF 1.2 + Liferay 6.1.x)

Project Links

Version Scheme

For information on the Liferay Faces Version Scheme, refer to the Liferay Faces Wiki article.

Release Highlights

We recently announced that Liferay Faces Bridge Certified was certified as JSR 329 Compliant. As a result of this certification, we released a JSF 1.2 compatible version that that developers can use to migrate legacy portlets to Liferay Faces.

Once again, thanks to everyone in the community that reported issues, contributed patches, and participated in the forums!

Notes no longer available in with Mountain Lion

Company Blogs 2012/08/15 投稿者 Neil Griffin Staff

If you have used the "New Note" feature in, then you may have noticed that the feature is gone in Mountain Lion. Although I was generally happy with the new Mountain Lion features, this completely disrupted my daily workflow process.

I used the Notes feature to create pseudo "Tasks" as part of a GTD type of workflow. This allowed me to keep tasks and email messages in different folders. Even though the feature is now gone, I found that I am still able to do the same type of thing with draft email messages. For example:

  • Create a new email message
  • Leave the recipient list blank
  • Give it a subject like "Task: Do this and that"
  • Type in some instructions in the email body
  • Save the email message as a Draft
  • Move the message from the Draft folder to some other folder, like "Today"

The only problem was that I wasn't able to edit the messages after I moved them out of drafts. As a workaround, it can still be edited by moving it temporarily back to drafts.


Announcement: Liferay Faces Bridge Certified as JSR 329 Compliant

Company Blogs 2012/08/09 投稿者 Neil Griffin Staff

On behalf of Liferay, I'm pleased to announce that as of August 8, 2012, Liferay Faces Bridge (a sub-project of Liferay Faces) has been certified by Oracle as compliant with JSR 329.

JSR 329 is the "Portlet 2.0 Bridge for JavaServer™ Faces 1.2" specification by the JCP. Liferay Faces Bridge 2.1.x has received the official certification (since it is designed for Portlet 2.0 and JSF 1.2). Although Liferay Faces Bridge 3.1.x is designed for Portlet 2.0 and JSF 2.0, it also passes all of the tests in the JSR 329 Technology Compatibility Kit (TCK).

I'd like to extend my personal thanks to Michael Freedman of Oracle -- as the Chairman of the JSR 329 Expert Group, he spent countless hours working on the specification and TCK. He is also a wonderful mentor and friend.

Announcement: Liferay Faces 3.1.0-RC2 Released

Company Blogs 2012/07/14 投稿者 Neil Griffin Staff

On behalf of Liferay, I'm pleased to announce the latest release of Liferay Faces:

  • Liferay Faces 3.1.0-RC2 (Compatible with Liferay 6.1.x)
  • Liferay Faces 3.0.0-RC2 (Compatible with Liferay 6.0.x)

Project Links

RC2 Status

The release has been designated RC2 (instead of GA1) because there have been significant changes since the release of RC1, and we wanted to be able to give the community time to kick the tires and provide feedback:

  1. FACES-1307: The new liferay-faces-bridge-api.jar artifact has replaced portlet-bridge-api.jar from Apache MyFaces
  2. FACES-1349: The new liferay-faces-util.jar artifact contains common classes/interfaces (see issue details for repackaging and renaming of classes)
  3. FACES-1286: The Public Render Parameters IPC feature has been modified in order to properly comply with the requirements of the JSR 329 Specification.
  4. FACES-1346: The new test/bridge-tck/bridge-tck-runner project provides run the JSR 329 TCK, and 100% of the TCK tests are passing in Liferay 6.1 and Pluto 2.0.3.

Release Highlights

We've been busy since the release of RC1 (about 45 days ago). The release notes provide summary of over 100 resolved issues, and as shown in the chart below, we've really gotten ahead of the curve.

Thanks to everyone in the community that reported issues, contributed patches, and participated in the forums!

Announcement: Liferay Faces 3.1.0-RC1 Released

Company Blogs 2012/06/01 投稿者 Neil Griffin Staff


On behalf of Liferay, I'm pleased to announce the latest release of Liferay Faces:

  • Liferay Faces 3.1.0-RC1 (Compatible with Liferay 6.1.x)
  • Liferay Faces 3.0.0-RC1 (Compatible with Liferay 6.0.x)

Project Links

Release Highlights

This release contains quite a few bug fixes in the bridge, and several improvements in the demo portlets:

  • The jsf2-portlet now demonstrates the ability to upload multiple documents with the HTML5 "multiple" attribute and a fileUploadEvent attribute.
  • The icefaces3-portlet has been enhanced to use ace:dataTable and ace:notificationPanel
  • The icefaces3-compat-portlet has been refactored to use ice:dataTable and ice:panelPopup
  • The primefaces3-portlet has benefited from better integration with p:fileUpload
  • The richfaces4-portlet has been enhanced to use rich:fileUpload, rich:dataTable, and rich:popupPanel

Many of the improvements are related to supporting file upload across the various component suites. Specifically, the fix for FACES-1241 provides enhancements to the bridge's UploadedFile interface and UploadedFileWrapper class. This in turn provided consistency across the demo portlets (each of them now has very similar code for handling file uploads).

Thank You

I wanted to extend my personal thanks to everyone in the community that reported issues and participated in the forums. Your help was invaluable!

JSF PhaseListener instances must be made thread-safe

Company Blogs 2012/05/30 投稿者 Neil Griffin Staff

I recently performed a Google Search for "phaselistener not thread safe" and realized that this issue is not widely published, so I'd like to take a moment to discuss it here.

Sooner or later, most JSF developers end up developing a PhaseListener implementation like found in Liferay Faces Bridge. One thing to remember though, is that PhaseListener instances are application-wide Singletons that are referenced by the JSF Lifecycle, which itself is an application-wide Singleton. Since these instances are not created within the PortletRequest thread, they need to be made thread-safe.

First, I recommend reading an external blog post section titled Immutable Objects.

Second, I think easiest way for me to explain what is OK and what is NOT OK is by showing some example code:

	package foo;

import javax.faces.event.PhaseId;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseListener;

public class MyPhaseListener implements PhaseListener {

    // Class-level immutable (final) variables are thread-safe since they are read-only
    // and are initialized at about the same time as the constructor. The Java compiler
    // will also permit you to initialize final variables within the body of the constructor.
    private final String classLevelImmutableVariable1 = "cannot-change-me-1";
    private final String classLevelImmutableVariable2; // initialized in constructor

    // Class-level mutable (non-final) variables are NOT thread-safe. Don't use these
    // without synchronization!
    private String classLevelMutableVariable = "can-change-me-but-dont-do-it!";

    // Static final constants (like loggers) are typically thread-safe.
    private static final Logger logger = LoggerFactory.getLogger(MyPhaseListener.class);

     * PhaseListener constructors execute when Mojarra/MyFaces initializes.
    public MyPhaseListener() {
        // It's OK to initialize final class-level variables here.
        this.classLevelImmutableVariable2 = "cannot-change-me-2";

    public void afterPhase(PhaseEvent phaseEvent) {

        // Accessing method parameters is thread-safe.
        PhaseId phaseId = phaseEvent.getPhaseId();

        // Accessing FacesContext is thread-safe since it is a ThreadLocal singleton.
        FacesContext facesContext = phaseEvent.getFacesContext();

    public void beforePhase(PhaseEvent phaseEvent) {

        // Creating local method variables is thread-safe, since the JVM will create an
        // instance (copy) on the stack for each Thread.
        String mutableLocalMethodVariable = "ok-to-change-me-in-the-scope-of-this-method";

        // Writing to a logger is thread-safe, providing the underlying logger
        // implementation is thread-safe!
        logger.debug("inside beforePhase method");

Finally, the bottom line is that the afterPhase(PhaseEvent) and beforePhase(PhaseEvent) methods must not modify class-level mutable (non-final) variables, or any type of memory that is shared by other threads, unless the methods are synchronized or access to the shared data is synchronized. Having said that, relying on synchronization can sometimes cause bottlenecks in an application because it causes other threads to block.



Internationalizing JSF Portlets

Company Blogs 2012/05/10 投稿者 Neil Griffin Staff

Note: This blog post has been moved to the Liferay Faces Wiki.

Migrating to Liferay Faces

Company Blogs 2012/04/10 投稿者 Neil Griffin Staff

The Liferay Faces Reference Documentation has a new chapter titled "Migration Guide" that discusses migration issues that you may encounter when migrating from projects to Liferay Faces. By way of preview, here are a list of topics discussed:

  • BridgeRequestAttributeListener
  • Configuration Option Names
  • File Upload
  • Facelet Tag Library Namespaces
  • GenericFacesPortlet
  • LiferayFacesContext
  • Logging
  • Portlet Preferences

For more information, you can download the latest version of the PDF from the following page:

If anyone encounters additional migration issues, please comment below and we'll try to get the documentation updated accordingly. Thanks everyone!

New Liferay Faces project at

Company Blogs 2012/04/03 投稿者 Neil Griffin Staff

Press Release

On April 3, 2012 a press release was issued announcing that Liferay will be assuming leadership for the community. I'm very excited about this development and wanted to take a moment to provide some additional details.


The community was formed by Liferay Platinum Partner Triton Services, Inc. and Silver Partner Mimacom AG in order to provide support for JSF 2 inside of Liferay Portal. Here at Liferay, we have seen strong demand for JSF portlets from Liferay’s community and customers. Triton and Mimacom recently contributed the projects from to and Liferay has committed to moving the technology forward.

Liferay Faces

Liferay FacesThe website is being transitioned to its new home at

The projects at have been repackaged under a new umbrella project called Liferay Faces along with some name changes:

Additionally, the java packaging namespace has been refactored: org.portletfaces -> com.liferay

Upcoming Release

The first release of Liferay Faces is version 3.0.0-BETA1 and is scheduled for Friday April 6, 2012. The 3.0.x branch is designed to be used with Liferay 6.0.x based portals. After the release, work will begin on the 3.1.x branch which will target Liferay 6.1.x based portals.

In this first release, the Liferay Faces Alloy and Liferay Facs Portal projects have received some minor bug fixes, but Liferay Faces Bridge has undergone significant development since the last release of PortletFaces Bridge 2.0.2. Specifically, we've focussed on developing the remaining features of JSR 329 and have made great progress towards getting the bridge to pass all of the tests in the JSR 329 Test Compatibility Kit (TCK).

Liferay IDE

Features and support for developing portlets with Liferay Faces will be included in upcoming releases of Liferay IDE and Liferay Developer Studio.


The forums at were migrated on April 3, 2012 to their new home at

If your account at was created prior to January 19, 2012 had the same email address as your account at then the posts you made at should still be authored with your name. Otherwise the author will appear as "PortletFaces Community Member." If you're waiting on an answer on a particular forum post, I recommend that you make a comment on that post in order to make sure you get email alerts. Also, I recommend subscribing to the Liferay Faces forum in general.


The issues at will be consolidated into a single JIRA project called FACES and will soon be migrated to their new home at

If your account at had the same username as your account at then issues you created (or commented on) should continue to be authored with your name. If you didn't have an account at then a new account will automatically be created once the migration is complete. If that's the case, then you will probably have to use the "forgot my password" feature in order to setup your password in the new system.


I renamed my @portletfaces account at twitter to @liferayfaces. If you were following @portletfaces then you will automatically be following @liferayfaces.

Enterprise Subscription & Support

As soon as Liferay Faces 3.0.0 and 3.1.0 reach their first production release, Liferay EE customers will enjoy support for Liferay Faces according to the Service Level Agreement (SLA) associated with Liferay Enterprise Subscription & Support (ESS).

License Change

The projects at were released under the Apache 2 license, but the Liferay Faces project will be released under the LGPL 2.1 license which is already used by Liferay on other projects.

Thank You

I wanted to extend my personal thanks to my dear friends at Triton and Mimacom for making this contribution, and to Liferay for taking the lead moving forward. I also want to thank the faithful members of the community for their support and kind words of encouragement.


Utilizing instance storage (ephemeral storage) with RHEL on Amazon EC2

Company Blogs 2011/09/02 投稿者 Neil Griffin Staff


I recently had the opportunity to launch an Amazon EC2 instance and setup Liferay & MySQL. There were a couple of hurdles that I had to overcome, so I thought I would share the solutions I came up with.


Storage: Ephemeral or EBS?

When you launch an RHEL instance on EC2, the disk storage that is provided is a VERY SMALL (7 GB or less) root partition that is contained within the instance itself. This type of storage is called ephemeral. The benefit of ephemeral storage is that it doesn't cost any extra money. The drawback is that it can't participate in the EBS backup solution provided by Amazon -- you'll need to backup files across the network instead. Depending on the size of the instance, you will be given additional ephemeral storage, which is where you can potentially store data or install an app server for Liferay. The Amazon documentation indicates that this will be mounted automatically on /ephemeral0 but I found that this wasn't the case. You will need to use the "fdisk -l" command to find out the device name of the additional ephemeral storage. In my case, I found that the device was named /dev/xvdj. However, there was no filesystem on it, and it wasn't mounted. So you'll need to execute commands like the following:
mkfs -t ext4 /dev/xvdj
mkdir /ephemeral0
echo "/dev/xvdj /ephemeral0 ext4 defaults 1 2" >> /etc/fstab
mount /ephemeral0
The alternative storage is called EBS. The benefit is that it can participate in the Amazon backup solution, but the drawback is that it costs extra money. If you want to use EBS instead of ephemeral, you can create EBS Volumes using the Amazon Management Console and then attach them to your instance. Bear in mind that you'll still need to discover the device with "fdisk -l", put a filesystem on it, mount it, etc.

Moving MySQL to the additional ephemeral storage

In order to utilize the larger ephemeral storage for database files, I needed to move the MySQL data files from /var/lib/mysql to a filesystem mounted on /ephemeral0. I tried to follow the instructions in section 10.4.1 of the HREL documentation titled "MySQL Changing Database Location" but when I restarted mysqld via "service mysqld start" it reported FAILED, and the following was found in /var/log/mysqld.log:
110902 11:35:42 mysqld_safe Starting mysqld daemon with databases from /opt/var/mysql
110902 11:35:42 [Warning] Can't create test file /opt/var/mysql/domU-12-31-39-09-AE-12.lower-test
110902 11:35:42 [Warning] Can't create test file /opt/var/mysql/domU-12-31-39-09-AE-12.lower-test
/usr/libexec/mysqld: Can't change dir to '/opt/var/mysql/' (Errcode: 13)
110902 11:35:42 [ERROR] Aborting
The irony here is that section 10.4.1 is meant to show you how to avoid this error.  So I had to find a different approach, and found inspiration in the following articles:
The strategy I used was to copy the MySQL files to /ephemeral0, and then mount the ephemeral storage directory back to /var/lib/mysql
Step 1: Stop the MySQL server and copy the data files over to /ephemeral0:
[root@server]# service mysqld stop
[root@server]# cd /var/lib
[root@server]# tar cf - mysql/ --selinux | (cd /ephemeral0/var/lib; tar xvfp -)
NOTE: It's really important to keep the --selinux switch so that the SELinux context for each file will be saved in the tarball. Also, it's really important to keep the "p" switch upon extraction, so that file permissions will be preserved.
Step 2: Determine the existing selinux settings and re-apply them on a similar var/lib folder structure on /ephemeral0:
[root@server]# ls -lZ / | grep var
drwxr-xr-x. root root system_u:object_r:var_t:s0       var
[root@server]# chcon -u system_u -r object_r -t var_t /ephemeral0/var
[root@server]# ls -lZ /var | grep lib
drwxr-xr-x. root   root   system_u:object_r:var_lib_t:s0   lib
[root@server]# chcon -u system_u -r object_r -t var_t /ephemeral0/var/lib
[root@server]# ls -lZ /var/lib | grep mysql
drwxr-xr-x. mysql     mysql    system_u:object_r:mysqld_db_t:s0 mysql
Step 3: Re-create the /var/lib/mysql mount point and preserve ownership/group/selinux settings:
[root@server]# cd /var/lib
[root@server]# mv mysql mysql.orig
[root@server]# mkdir mysql
[root@server]# chown mysql mysql
[root@server]# chgrp mysql mysql
[root@server]# chcon -u system_u -r object_r -t mysqld_db_t mysql
Step 4: Mount the directory that contains the MySQL data onto the /var/lib/mysql mount point and restart MySQL:
[root@server]# echo "/ephemeral0/var/lib/mysql /var/lib/mysql none bind bind" >> /etc/fstab
[root@server]# mount /var/lib/mysql
[root@server]# service mysqld start


The benefit of using this approach is that I didn't have to change any of the settings in the /etc/my.cnf configuration file. Also, I didn't have to fight the selinux security context problem. This approach can also be used for mounting other folders like /opt in order to utilize ephemeral storage.

該当件数: 57 件中 21 - 40
ページごとのアイテム数 20
/ 3