Recent Bloggers

Olaf Kock

Staff
79 帖子
2014年10月23日

Miguel Ángel Pastor Olivar

Staff
18 帖子
2014年10月22日

Fady Hakim

Staff
4 帖子
2014年10月22日

Bryan Cheung

Staff
31 帖子
2014年10月22日

Michael Williams

Staff
1 帖子
2014年10月22日

Jayaram pokuri

1 帖子
2014年10月21日

James Falkner

Staff
98 帖子
2014年10月21日

Eduardo P. Garcia

Staff
6 帖子
2014年10月20日

Meera Prince

17 帖子
2014年10月18日

Liferay Support Portal Admin

163 帖子
2014年10月17日

Liferay 6.1 simple cluster

Company Blogs 2012年8月22日 按 Ricardo Funke Staff

A Liferay cluster is simply a matter of put some properties in portal-ext.properties. First you'll put these two properties:

cluster.link.enabled=true

cluster.link.autodetect.address=<some-address>:<some-port>

lucene.replicate.write=true

The first will enable Liferay to replicate both database caches (ehcache) and search indexes (lucene) through the ClusterLink channel.

The second will tell Liferay what network interface to use for the multicast communication. You must specify an IP address and a port so that Liferay can make a "ping" in that socket (IP + port) to check if that will work.

The third will enable Lucene to replicate the indexes across the nodes.

This kind of IP+port verification may seem a bit awkward (I guess it's for both windows and unix system work the same way), but the idea is to set it to a proxy or gateway so that all nodes use the same pair IP+port. But if you, for some reason, can't give an IP+port to Liferay, due to firewall or else, you may use the IP+port of the database. I don't see any reason to block database's IP from Liferay ;)

In some cenarios, you may want to use an specific interface exclusivelly for the multicast communication. This is good, and you can always use the IP+port of that interface for each node individually. The only question is, what port to use? In Linux you can use port 22 for this is a commonly open port in many distributions. Use "netstat" to look what port can be use for that purpose in your system.

Documents and Images

Unlike some folks may think, documents and images aren't stored in the database, is in the filesystem so the performance can be much, much better.

Of course, documents and images must be accessible from all Liferay nodes. The good practice for that is to use a storage area. Then you can set Liferay to use the mounted storage directory. This is done in portal-ext.properties like this:

dl.store.file.system.root.dir=/my/storage/path/document_library

Or:

dl.store.file.system.root.dir=G:/document_library

For Windows Servers. Note that you have to use forward slashes instead of back slashes.

You will end with 3 simple properties in the portal-ext.properties of each node.

Deploy portlets, plugins, themes...

Since the very first version of Liferay, the replication of the portlets and plugins always was a task for the application server you're using for Liferay. 

Most of them have a feature called "farm" that do this job. So Liferay is aware of this.

But, to simplify things, you can make a script for that. I wrote one that do it using ssh connection with the rsync tool available in most Linux distributions.

This script can be downloaded from here: https://github.com/ricardofunke/ndeploy/blob/master/ndeploy.sh

To install, make a copy of this script to all your Liferay nodes. I recommend to create a folder inside your LIFERAY_HOME called "ndeploy" and copy the ndeploy.sh script inside it.

Next to the script, inside the same "ndeploy" folder, create another folder called "deploy" where the script will watch for .war files to be replicated to all Liferay nodes. 

Grant execute permission to the script with "chmod +x ndeploy.sh"

Edit the script and set the NODES variable with all your Liferay nodes IP except the local one. Don't forget to do this for all the nodes.

Change the variable APPSRV_HOME to the correct path to your application server. This is the path of your LIFERAY_HOME.

You must create ssh public keys and distribute between all nodes using liferay user. This is necessary to eliminate the need for password between the nodes. For example, suppose you're using liferay as the user to run the portal (the java process) in the "node1" server.

As root:

# su - liferay

$ ssh-keygen

Press enter without set any password

$ ssh-copy-id -i .ssh/id_rsa.pub liferay@node2

Do the same for all Liferay nodes you have.

Now you have to make sure that this script will run with liferay side-by-side as a deamon. Use the option -d to run the script as a deamon. You can put it in your Liferay startup script. Remember to use the same Liferay user to run this script.

Finally, Liferay must be set to deploy the application not to the application server but first to ndeploy.sh "deploy" folder, so that it can copy to all other nodes. The order of deploying will be like this:

  1. You'll copy your application to the Liferay deploy folder (or you will upload through Control Panel)
  2. Liferay will copy the application to ndeploy.sh folder
  3. ndeploy.sh will copy the application to the application server in all nodes locally and remotelly.

To do this, put this property into your portal-ext.properties:

auto.deploy.dest.dir=/path/to/ndeploy/deploy

Change the value to correspond to the path to the ndeploy.sh deploy folder. You can make this in the Control Panel instead in Control Panel -> Plugins Installation -> Install More Plugins -> Configuration in the "Destination directory" field.

It's all. Let me know if you have any trouble with this installation.

Liferay 6.1 on Jboss 5.1.0

Company Blogs 2012年7月6日 按 Ricardo Funke Staff

In order to proceed please download the following from your Customer Portal.

  • Liferay Portal 6.1 EE WAR
  • Liferay Portal 6.1 EE Dependencies

Preparing Jboss for Liferay

  • First, create a directory that will be the Liferay's home. We will call it $LIFERAY_HOME.
  • Download Jboss and extract it into de $LIFERAY_HOME. Jboss directory will be referred as $JBOSS_HOME.
  • In $JBOSS_HOME/bin/run.conf (or run.conf.bat for Windows) change the JAVA_OPTS variable to have the following options:
    • Change -Xmx512m to -Xmx1024m 
    • Add -Dfile.encoding=UTF-8 -Duser.timezone=GMT -Djava.net.preferIPv6Addresses=false -Djava.net.preferIPv4Stack=true
  • Open $JBOSS_HOME/server/default/conf/standardjbosscmp-jdbc.xml and search for the "Hypersonic SQL" type-mappping in the file. Change:

<type-mapping>

         <name>Hypersonic SQL</name>
         <row-locking-template/>
         ...
         <mapping>
            <java-type>java.lang.Object</java-type>
            <!-- hsqldb only supports directly serializable objects for sql type OBJECT -->
            <jdbc-type>VARBINARY</jdbc-type>
            <sql-type>VARBINARY</sql-type>
         </mapping>
         ...
      </type-mapping>
  • to
<type-mapping>
         <name>Hypersonic SQL</name>
         <row-locking-template/>
         ...
         <mapping>
            <java-type>java.lang.Object</java-type>
            <!-- hsqldb only supports directly serializable objects for sql type OBJECT -->
            <jdbc-type>VARBINARY</jdbc-type>
            <sql-type>VARBINARY(1024)</sql-type>
         </mapping>
          ...
      </type-mapping>
  • Remove hibernate-validator.jar from $JBOSS_HOME/common/lib/.
  • Edit $JBOSS_HOME/server/default/conf/login-config.xml and comment out the entire XML for policy "other" in lines 113-129. For example:
  <!--application-policy name="other"-->
  ...
    <!--authentication>
      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
        flag="required"/>
    </authentication>
  </application-policy-->

 

Database Configuration

  • Download the jdbc connector for your database and copy it into $JBOSS_HOME/server/default/lib/. We will use MySQL for this tutorial.
  • If you want Jboss to manage the data source, create the file $JBOSS_HOME/server/default/deploy/liferay-ds.xml with the following content:
<datasources>
<local-tx-datasource>
  <jndi-name>jdbc/LiferayPool</jndi-name>
  <connection-url>jdbc:mysql://localhost/lportal?useUnicode=true&amp;characterEncoding=UTF-8</connection-url>
  <driver-class>com.mysql.jdbc.Driver</driver-class>
  <user-name>root</user-name>
  <password>root</password>
  <min-pool-size>0</min-pool-size>
</local-tx-datasource>
</datasources>
  • Then create a file called portal-ext.properties in $LIFERAY_HOME and add the following line:

jdbc.default.jndi.name=jdbc/LiferayPool

  • If you wish to manage configuration through Liferay, you will add the following directives instead of adding the line above in portal-ext.properties.
    jdbc.default.driverClassName=com.mysql.jdbc.Driver
    jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
    jdbc.default.username=root
    jdbc.default.password=root
  • Don't forget to change the informations to correspond to your database settings.
  • Also, you may want to use the Liferay's startup wizard to set the database. In this case, don't do any of the configurations above, just install your jdbc driver, finish this tutorial and start Liferay. Then access http://localhost:8080 and set the database configurations. This way, Liferay will create a file called portal-setup-wizard.properties in $LIFERAY_HOME with your database settings.

Mail Configuration

  • If you want Jboss to manage the mail configuration, set mail properties by replacing the contents of $JBOSS_HOME/server/default/deploy/mail-service.xml with:
<?xml version="1.0"?>
<server>
  <mbean code="org.jboss.mail.MailService" name="jboss:service=MailSession">
    <attribut name="JNDIName">mail/MailSession</attribute>
    <attribute name="User">nobody</attribute>
    <attribute name="Password">password</attribute>
    <attribute name="Configuration">
      <configuration>
        <property name="mail.store.protocol" value="imap"/>
        <property name="mail.transport.protocol" value="smtp"/>
        <property name="mail.imap.host" value="localhost"/>
        <property name="mail.pop3.host" value="localhost"/>
        <property name="mail.smtp.host" value="localhost"/>
      </configuration>
    </attribute>
  </mbean>
</server>
  • Then, add the following line to the portal-ext.properties file:

mail.session.jndi.name=mail/MailSession

  • Again, if you want to use portal-ext.properties instead, set the following properties in this file:
mail.session.mail.pop3.host=localhost
mail.session.mail.pop3.password=
mail.session.mail.pop3.port=110
mail.session.mail.pop3.user=
mail.session.mail.smtp.auth=false
mail.session.mail.smtp.host=localhost
mail.session.mail.smtp.password=
mail.session.mail.smtp.port=25
mail.session.mail.smtp.user=
mail.session.mail.store.protocol=pop3
mail.session.mail.transport.protocol=smtp
  • Don't forget to change the settings according to your mail server.
  • Also, you may want to set this in the Liferay database, so instead of doing the settings above, make the Deploy Liferay section below, go to "Control Panel" -> "Server Administration" -> "Mail" and fill in the fields.

Deploy Liferay

  • Unzip the Liferay Portal 6.1 EE Dependencies file and copy the contents (the .jar files) to $JBOSS_HOME/server/default/lib/
  • Delete all the files and folders in $JBOSS_HOME/server/default/deploy/ROOT.war
  • Unzip the Liferay Portal 6.1 EE WAR file to the ROOT.war directory.
  • Remove jaxrpc.jar, stax.jar, xercesImpl.jar, xml-apis.jar from $JBOSS_HOME/server/default/deploy/ROOT.war/WEB-INF/lib/

Start Jboss

  • Go to $JBOSS_HOME/bin and type ./run.sh for Linux or run.bat for Windows
  • Open your browser and access http://localhost:8080
显示 2 结果。