Elastic search in docker

I just upgraded a solution from 7.3 to 7.4. Now I am tying to setup Elastic search using docker but when I run docker-compose up it successfuly starts all containers (redis, kibana) but when it comes to elastic search I get this exception:

elasticsearch    | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
elasticsearch    | @     WARNING: plugin requires additional permissions     @
elasticsearch    | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
elasticsearch    | * java.net.SocketPermission * connect,resolve
elasticsearch    | See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
elasticsearch    | for descriptions of what these permissions allow and the associated risks.
elasticsearch    | -> Installed analysis-dynamic-synonym
elasticsearch    | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
elasticsearch    | {"type": "server", "timestamp": "2020-02-06T14:29:30,049Z", "level": "WARN", "component": "o.e.b.ElasticsearchUncaughtExceptionHandler", "cluster.name": "docker-cluster", "node.name": "71971bf1dea4", "message": "uncaught exception in thread [main]",
elasticsearch    | "stacktrace": ["org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: cannot downgrade a node from version [7.5.2] to version [7.5.1]",
elasticsearch    | "at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "Caused by: java.lang.IllegalStateException: cannot downgrade a node from version [7.5.2] to version [7.5.1]",
elasticsearch    | "at org.elasticsearch.env.NodeMetaData.upgradeToCurrentVersion(NodeMetaData.java:94) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.env.NodeEnvironment.loadOrCreateNodeMetaData(NodeEnvironment.java:426) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:304) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.node.Node.<init>(Node.java:273) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.node.Node.<init>(Node.java:253) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:221) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:221) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.5.1.jar:7.5.1]",
elasticsearch    | "... 6 more"] }
elasticsearch exited with code 1

I don’t understand why it is trying to downgrade the elasticeSearch node:
java.lang.IllegalStateException: cannot downgrade a node from version [7.5.2] to version [7.5.1]"

I have tried to follow each step in: Error configuring elasticsearch Litium 7.4.0 but I still can’t figure it out.

EDIT:

I am using this docker-compose.yaml file: https://github.com/LitiumAB/Education/blob/master/Developer%20Education/Tasks/Docker/Resources/docker-compose.yaml. and according to it docker should fetch elasticsearch:7.5.1.

Thanks in advance!

Litium version: 7.4

There is no version dependency on 7.5.1 (it is there since it was the latest version at the time of writing that lab), does it work if you just adjust the yaml-file to 7.5.2?

Get:

elasticsearch    | -> Downloading https://github.com/Tasteful/elasticsearch-analysis-dynamic-synonym/releases/download/v7.5.1/elasticsearch-analysis-dynamic-synonym.zip
elasticsearch    | Exception in thread "main" java.lang.IllegalArgumentException: Plugin [analysis-dynamic-synonym] was built for Elasticsearch version 7.5.1 but version 7.5.2 is running
elasticsearch    |      at org.elasticsearch.plugins.PluginsService.verifyCompatibility(PluginsService.java:346)
elasticsearch    |      at org.elasticsearch.plugins.InstallPluginCommand.loadPluginInfo(InstallPluginCommand.java:728)
elasticsearch    |      at org.elasticsearch.plugins.InstallPluginCommand.installPlugin(InstallPluginCommand.java:803)
elasticsearch    |      at org.elasticsearch.plugins.InstallPluginCommand.install(InstallPluginCommand.java:786)
elasticsearch    |      at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:232)
elasticsearch    |      at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:217)
elasticsearch    |      at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
elasticsearch    |      at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125)
elasticsearch    |      at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:77)
elasticsearch    |      at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125)
elasticsearch    |      at org.elasticsearch.cli.Command.main(Command.java:90)
elasticsearch    |      at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47)

and 7.5.1 seems to be that latest version of elasticsearch-analysis-dynamic-synonym plugin. Is it possible to skip the plugin for now or is it a requierment for elastic search to work?

The plugin is a requirement so it seems you need to remove elastic 7.5.2 and install 7.5.1,

I haven’t tried this myself yet but I will test and update the task documentation when i can.

If you skip that plugin, you will lose the synonyms feature.

Elasticsearch plugin is version dependent so you need to have the plugin for the version of elasticsearch that you are running. If you run 7.5.1 or 7.5.2 or elasticsearch, you also need to have the plugin for the same version.

In the docker-compose file you have version number for both elasticsearch and in the url for the plugin, they need to match. If the elasticsearch version is 7.5.2 and the plugin is 7.5.1 the plugin probably trying to use the 7.5.1 version of the elasticsearch libraries that not are available and throw this exception.

The plugin you refer in my fork on github is now also exists in 7.5.2 version, if you want that in another version, I accept pull requests.

1 Like

It is totaly unclear where 7.5.2 comming from since the version of Kibana, Redis, ES and the plugin was 7.5.1 in the .yaml file. It is now solved by changing all the versions to 7.5.2 and all of them are up and running.

BUT the ES-node still does not appear in the settings in BO? :confused: what should I check?

Did you add all the settings from this task as well?

1- docker and all nodes are up and running
2- This connectionString is added: <add name="ElasticsearchConnectionString" connectionString="http://localhost:9200" />
3- Lucene indexing disabled for website and PIM
5- prefix added
6- <add key="Litium:Elasticsearch:Synonym:Host" value="http://host.docker.internal:8050" /> is added
7- Binding for port 8050 is added (without hostname, correct?)

Did I miss something?

Can you double check if the connection name is in correct case: ElasticSearchConnectionString

Since you upgraded, does your Litium.Accelerator.Mvc project have the package Litium.Web.Setup.ElasticSearch installed?

1 Like

Thank you @NilsN! that seems to be the problem.

Now the ES node appeard in BO but no indices are showing!

The Elasticsearch.Net package in the MVC project is 7.5.1 and that seems to be the latest version they have there. and the docker is running ES 7.5.2. Could that be the reason?

EDIT:

Nothing in the eventlog and in the ES log repeating:

2020-02-07 11:58:31.1985 [App:02] [afbc4b01-e44b-4963-bfbe-64eb00912ecd] [TRACE] [] Nest.IElasticClient - GET http://localhost:9200/ragnarsystem-index-queue/_count 
2020-02-07 11:58:31.1985 [App:02] [afbc4b01-e44b-4963-bfbe-64eb00912ecd] [TRACE] [] Nest.IElasticClient - Status: 

EDIT 2:
I got it work with ES 7.5.1 in the docker now, I needed to clear the docker volume.
So the versions are now same everywhere, 7.5.1. But still no indices are showing

If you are upgrading an older version of Litium Accelerator you don’t have the new project Litium.Accelerator.Elasticsearch (exists in the latest accelerator package) that contains the index definitions, without this or other index definitions you will not get any index in the admin view.

The Litium.Accelerator.Elasticsearch using decorators to replace the searches and for products, categories and pages and if the service they should override have been changed (or not exists) you also need to update that code from the latest accelerator package.

The Litium.Accelerator.Elasticsearch is already at place.

Ok, I guess that is a huge work to identify the changes and update all those files, or do you have a efficient way to do that? Or maybe a list over those files that are needed for getting ES to work? Since the accelerator is far away from the clean one from Litium.

I appreciate ur answers guys!

Is the Litium.Accelerator.Elasticsearch project referenced by the Mvc-project? Is everything compiling it should be compatible directly, otherwise it’s the files that are decorated in the Searching folder that has the files that are changed/updated to work with ES.

If you put a break-point in ProductSearchServiceDecorator.Search will that be hit during debugging?

That was the issue, the Litium.Accelerator.Elasticsearch project was not referenced by the Mvc-project.

Thanks a lot!

1 Like

Did you add all new files under Site folder in MVC project also?

No, should I do that?

Yes if you would like to administrate the Search in BO.

1 Like