conductor-community icon indicating copy to clipboard operation
conductor-community copied to clipboard

ElasticSearch7 create unlimited amount of indices

Open astelmashenko opened this issue 2 years ago • 5 comments

Describe the bug After certain amount of time shards problem raised. We checked ES and found out around 2300 shards, we names like conductor_task_log_20221004.

Details Conductor version: 3.12.2 Persistence implementation: Postgres Queue implementation: Postgres Lock: Redis

To Reproduce Steps to reproduce the behavior:

  1. Just use elastic for a while

Expected behavior Data is cleaned up periodically.

astelmashenko avatar Jan 19 '23 08:01 astelmashenko

Investigating code I see

    private void createIndexesTemplates() {
        try {
            initIndexesTemplates();
            updateIndexesNames();
            Executors.newScheduledThreadPool(1).scheduleAtFixedRate(this::updateIndexesNames, 0, 1, TimeUnit.HOURS);
        } catch (Exception e) {
            logger.error("Error creating index templates!", e);
        }
    }

See this line Executors.newScheduledThreadPool(1).scheduleAtFixedRate(this::updateIndexesNames, 0, 1, TimeUnit.HOURS);

Where updateIndexesNames creates new index every week. Can someone explain why does it change names for indices?

I'd like to change this behavior, because we reaching limits on shards.

astelmashenko avatar Jan 19 '23 11:01 astelmashenko

I also checked below methods are not used anywhere:

IndexDAO.getEventExecutions
IndexDAO.getMessages

so it is probably safe to stop indexing them:

conductor.app.eventMessageIndexingEnabled=false
conductor.app.eventExecutionIndexingEnabled=false

However to stop creating new indices we need to change this config: conductor.elasticsearch.autoIndexManagementEnabled=false And provision indices for conductor manually.

Can anybody comment on this?

astelmashenko avatar Jan 19 '23 14:01 astelmashenko

Hi @astelmashenko , Thanks for reporting this. We will add support for archival from ES also. Let me know if this works, or we can chat here for more realtime collaboration.

manan164 avatar Feb 01 '23 04:02 manan164

@manan164 ,

We will add support for archival from ES

Yes, it will help. Additionally, I'd add reaction to indexing flag, e.g. if conductor.app.eventMessageIndexingEnabled=false is set then do not create new indices once a week. Maybe think also about changing period of creating new indices, e.g. WEEK, MONTH, YEAR Thanks

astelmashenko avatar Feb 13 '23 11:02 astelmashenko

@manan164 , are there any work done on archival of indicies?

astelmashenko avatar Aug 29 '23 08:08 astelmashenko