Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-121782

Liferay doesn't start correctly if remote Elasticsearch is not available or ES cluster is in red status

    Details

      Description

      Liferay doesn't start correctly if remote Elasticsearch is not available or ES cluster is in red status.

      The root cause of this problem is:

      1. During Liferay startup, the instances and its search engines are initialized in: CompanyLocalServiceImpl.checkCompany => CompanyLocalServiceImpl.preregisterCompany methods
      2. Them preregisterCompany method executes SearchEngineHelperUtil.initialize(companyId);
      3. If Remote Elasticsearch is not available, that method throws an exception that aborts all the startup process done in checkCompany

      This issue is very problematic for our customers because if your Elasticsearch data gets corrupted and you have to execute a reindex to solve the issue, you have to do it from Liferay interface, but you cannot access to the Liferay interface because Liferay cannot startup without the remote Elasticsearch server.

      This problem is documented in several HelpCenter articles:

      Workarounds:
      There are two workarounds:
      If your Elasticsearch server is working but it has corrupted data

      1. Manually delete all data from your Elasticsearch server
      2. Start Liferay
      3. Execute a full reindex

      If your Elasticsearch server is not available

      1. Activate Embedded Elasticsearch using a config file, see https://help.liferay.com/hc/en-us/articles/360029031691-Elasticsearch-Connector-Settings-Reference
      2. Start Liferay
      3. Go to System Settings => Elasticsearch configuration and configure the new Remote Elasticsearch
      4. Execute a full reindex

      Reproduction steps Liferay 7.3 or master:
      Due to some changes applied in LPS-108239, (see PortalInstances.java lines 281 to 287) this issue is only reproduced in master in case you are connecting to an empty Liferay database

      1. Install a clean Liferay and point it to an empty database
      2. Copy com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config file to LIFERAY_HOME/osgi/configs
      3. Start Liferay
      4. Several error traces will be displayed during startup
      5. Try opening Liferay home page:
        • You can open Liferay home page, even if search functionality is not available
        • You cannot open Liferay home page

      Reproduction steps Liferay 7.0, 7.1 and 7.2
      The problem is reproduced in any Liferay installation

      1. Start Liferay
      2. Configure Remote Elasticsearch to connect to a fake Elasticsearch server, for example "example.com:9200"
      3. Stop Liferay
      4. Start Liferay
      5. Several error traces will be displayed during startup
      6. Try opening Liferay home page:
        • You can open Liferay home page, even if search functionality is not available
        • You cannot open Liferay home page

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              summer.zhang Summer Zhang
              Reporter:
              jorge.diaz Jorge Diaz
              Participants of an Issue:
              Recent user:
              Yunlin "Steven" Sun
              Engineering Assignee:
              Jorge Diaz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                19 weeks, 1 day ago

                  Packages

                  Version Package
                  7.0.0 DXP FP97
                  7.0.X
                  7.1.10 DXP FP20
                  7.1.10.5 SP5
                  7.1.X
                  7.2.X
                  Master