[Resolved]Impossible to change liferay 7.2 elastic search

Teddy Kossoko, modified 5 Years ago. Junior Member Posts: 42 Join Date: 3/5/18 Recent Posts
Hi,
I use the docker version of Liferay and Elasticsearch.
Liferay is 7.2 GA2 and elastic search 7.4.2
I follow the tutorial explaining how to set up elastic search and change the embedded :https://portal.liferay.dev/docs/7-2/deploy/-/knowledge_base/d/installing-elasticsearch
After installing elasticsearch, I can access it here : http://51.178.28.179:9200/
I put in osgi/conf/com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config this configuration :
operationMode=REMOTE
 # If running Elasticsearch from a different computer:
 transportAddresses="51.178.28.179:9300"
 indexNamePrefix="liferay-"
 clusterName=LiferayElasticsearchCluster
 # Highly recommended for all non-prodcution usage (e.g., practice, tests, diagnostics):
 #logExceptionsOnly="false"
But when I restart Liferay, Liferay restart with the embedded elastic.
I changed with
operationMode=REMOTE
 # If running Elasticsearch from a different computer:
 transportAddresses="127.0.0.1:9300"
 indexNamePrefix="liferay-"
 clusterName=LiferayElasticsearchCluster
 # Highly recommended for all non-prodcution usage (e.g., practice, tests, diagnostics):
 #logExceptionsOnly="false"

I got the same result
When I remove remove double ""
operationMode=REMOTE
 # If running Elasticsearch from a different computer:
 transportAddresses=127.0.0.1:9300
 indexNamePrefix="liferay-"
 clusterName=LiferayElasticsearchCluster
 # Highly recommended for all non-prodcution usage (e.g., practice, tests, diagnostics):
 #logExceptionsOnly="false"


I got the error
liferay_container | 2020-01-03 21:07:37.437 INFO  [main][ModuleFrameworkImpl:408] Navigate to Control Panel > Configuration > Gogo Shell and enter "lb" to see all bundles
liferay_container | 2020-01-03 21:07:44.291 ERROR [Framework Event Dispatcher: Equinox Container: 175dbb18-e729-4c1f-a32f-1563f713c6dc][Framework:93] FrameworkEvent ERROR
liferay_container | java.lang.RuntimeException: org.elasticsearch.client.transport.NoNodeAvailableException: NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{MOuJupFJT1e92B8CcFPNNw}{127.0.0.1}{127.0.0.1:9300}]]
liferay_container |     at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:352)
liferay_container |     at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:248)
liferay_container |     at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:57)
liferay_container |     at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:394)
liferay_container |     at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:392)
liferay_container |     at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:381)
liferay_container |     at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:45)
liferay_container |     at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:52)

How could I do ?
Thanks in advance
thumbnail
David H Nebinger, modified 5 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
When I'm having issues getting the syntax right, I often like to go into the UI, make the changes I want, and then Export the configuration as a file. This is often a great help towards figuring out how to get the format right.
Teddy Kossoko, modified 5 Years ago. Junior Member Posts: 42 Join Date: 3/5/18 Recent Posts
Thanks for your reply @David. I followed your advice, I go into the ui and make changes. I export the config file. But Liferay still start without connecting to the elasticsearch.
The content of my config is the following :
additionalConfigurations=""
additionalIndexConfigurations=""
additionalTypeMappings=""
bootstrapMlockAll="false"
clientTransportIgnoreClusterName="false"
clientTransportNodesSamplerInterval=""
clientTransportPingTimeout=""
clientTransportSniff="true"
clusterName="LiferayElasticsearchCluster"
discoveryZenPingUnicastHostsPort="9300-9400"
httpCORSAllowOrigin="/https?://localhost(:[0-9]+)?/"
httpCORSConfigurations=""
httpCORSEnabled="true"
httpEnabled="true"
indexNamePrefix="\"liferay-\""
indexNumberOfReplicas=""
indexNumberOfShards=""
logExceptionsOnly="true"
networkBindHost=""
networkHost=""
networkPublishHost=""
operationMode="REMOTE"
overrideTypeMappings=""
retryOnConflict="5"
transportAddresses=[ \
  "127.0.0.1:9300", \
  ]
transportTcpPort=""
thumbnail
David H Nebinger, modified 5 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Ah, so the syntax it expected was the array format for transportAddresses I guess...

So a couple of things I would do here... First I'd shut down the node(s) and delete the osgi/state directory (it will rebuild when the nodes restart). If you have a cluster, be sure to copy the configuration file to all nodes to be safe. Also I'd "touch" the file to update the timestamp before restarting the node(s) so they see the file has been changed and try to process it again.
Teddy Kossoko, modified 5 Years ago. Junior Member Posts: 42 Join Date: 3/5/18 Recent Posts
After deleting osgi/state and restarting everything with the correct config file, I got this error :
liferay_container | 2020-01-04 21:18:01.430 ERROR [Framework Event Dispatcher: Equinox Container: 101fb48b-327d-4fa8-b1a1-5afe12b9e267][Framework:93] FrameworkEvent ERROR
liferay_container | java.lang.RuntimeException: org.elasticsearch.client.transport.NoNodeAvailableException: NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{LvWkcNs_RZipMejb3xWj5g}{127.0.0.1}{127.0.0.1:9300}]]
liferay_container |     at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:352)

I then run the command docker inspect on the eslactic search and got this in network :
"Networks": {
                "liferay-portal_postgres": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "c8580b602370",
                        "elasticsearch"
                    ],
                    "NetworkID": "4f974695b5527c0ba74da6a8d0e4e7b969a41487be18938d645bace26eee507b",
                    "EndpointID": "b8656d4a3681fb38fe905247875970e982edc07674b40b832ed6220b0f654487",
                    "Gateway": "192.168.112.1",
                    "IPAddress": "192.168.112.2",
                    "IPPrefixLen": 20,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:c0:a8:70:02",
                    "DriverOpts": null
                }

I change my ip in the configuration file with the IPAddress :
transportAddresses=[ \
  "192.168.112.2:9300", \
  ]
I restart Liferay. In the console, Liferay still continue to show this message but it is not relevant :
liferay_container | 2020-01-04 21:36:47.168 WARN  [Elasticsearch initialization thread][EmbeddedElasticsearchConnection:288] Liferay is configured to use embedded Elasticsearch as its search engine. Do NOT use embedded Elasticsearch in production. Embedded Elasticsearch is useful for development and demonstration purposes. Refer to the documentation for details on the limitations of embedded Elasticsearch. Remote Elasticsearch connections can be configured in the Control Panel.
Go to Control Panel > Configuration > Search, you will see elastic search, the version you installed instead of embedded.
Thanks.