Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to allow future deployment of multiple instances #7337

Merged
merged 23 commits into from
Sep 28, 2023
Merged

Conversation

fxprunayre
Copy link
Member

@fxprunayre fxprunayre commented Sep 13, 2023

Various experiments were done in GeoNetwork 3 to try to deploy multiple instances and the main issue was the Lucene index. Moving to Elasticsearch in version 4 allows to easily share the index and setup a cluster of Elasticsearch nodes if needed.

With https://metadata.vlaanderen.be/ team, we analyzed other limitations related to a multiple instances setup and fixed the main issue. Without altering a single instance mode, we describe below the changes made, provide a docker configuration for testing it and list remaining known limitations that we can improve in the future.

This PR combine the work done in the following PR for easier testing:

For testing the easiest is to use the docker configuration https://github.com/geonetwork/docker-geonetwork/tree/update-gn-4.4.0/4.4.0#clustering-experimental to easily start the main node and replicas.

Docker configuration is done in geonetwork/docker-geonetwork#107

Changes

HTML cache for formatter and WRO4J

This allows to have multiple instances starting up but having their own separate HTML cache. If not, H2 database are locked.

Caused by: org.h2.mvstore.MVStoreException: The file is locked: /.../WEB-INF/data/data/resources/htmlcache/wro4j-cache.mv.db [2.1.212/7]
	at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004) ~[h2-2.1.212.jar:2.1.212]

geonetwork.htmlcache.dir can be used to customize the location. Another workaround is to use LRU cache instead

cacheStrategy=disk-memory

replaced by

cacheStrategy=lru

to have in memory cache (but you can't benefit from the pre-built cache).

Schema initialization

On startup, GeoNetwork publish each schema plugin XSDs to /data/resources/xml/schemas folder. If more that one
instance starts at the same time, they can fails to copy the XSD. Adding a new data directory variables for the schemas -Dgeonetwork.schemapublication.dir=.

Admin / Site info

Admin console information panel provides relevant information to check node configuration (hostname, harvester configuration):

image

Pasted image

Harvester

Add configuration to only run scheduled harvesting tasks in one instance which will reload harvester configuration on a regular basis.

Java 11 fixes

  • Fix error on sending mail under Jetty
{"message":"NestedServletException","code":"runtime_exception",
"description":"Handler dispatch failed; nested exception is
 java.lang.NoClassDefFoundError: javax/activation/DataSource"}

Remaining known limitations

  • Harvester / Scheduler needs to be refreshed when the database harvester configuration is modified (the harvesting node refresh the schedule every 2 minutes as a stopgap solution)
  • Settings / When saving application settings, some modules need to be updated (not really blocker because those settings usually don't change often - restart or save settings on each node as a workaround)
    • log file,
    • DOI configuration,
    • proxy configuration (use Java environment variable instead of database configuration)
  • Thesaurus / Local thesaurus modified in one node are not updated on others.

Future improvements

fxprunayre and others added 16 commits June 23, 2023 14:24
This allows to have multiple instances starting up but having their own separate HTML cache. If not H2 database are locked.
On startup, GeoNetwork publish each schema plugin XSDs to /data/resources/xml/schemas folder. If more that one
instance starts at the same time, they can fails to copy the XSD. Adding a new data directory variables for the schemas -Dgeonetwork.schemapublication.dir=.

Co-authored-by: Joachim Nielandt <[email protected]>
* Sort by insertion order
* Showing data directory html cache directory setting in admin page

Co-authored-by: Joachim Nielandt <[email protected]>
…vester scheduler. Add some more precise doc links.
Added hostname to the system information panel. As we discussed previously, more HA-related information is helpful to determine correct behaviour of multiple instances. Knowing which instance is running surely needs to be there.

Co-authored-by: Joachim Nielandt <[email protected]>
When using multiple nodes, one is in charge of harvesting tasks.
Use the following configuration for this node:
```
      HARVESTER_SCHEDULER_ENABLED: "true"
      HARVESTER_REFRESH_INTERVAL_MINUTES: 2
```
The node will then check every 2 minutes for any harvesting
configuration changes and updates its schedule.

This is a stopgap solution until we define a better messaging system to
deal with those cases.

Keep the default config if running only one node.

Co-authored-by: Joachim Nielandt <[email protected]>
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20.1) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants