-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Rollover api for main indices #1309
Rollover api for main indices #1309
Conversation
print('ACTION ... one of:') | ||
print('\tinit - creates archive index and aliases') | ||
print('\trollover - rollover to new write index') | ||
print('\tlookback - removes old indices from read alias') | ||
print('HOSTNAME ... specifies which ElasticSearch hosts to search and delete indices from.') | ||
print('INDEX_PREFIX ... specifies index prefix.') | ||
print('init configuration:') | ||
print('\tSHARDS ... the number of shards per index in ElasticSearch (default 5)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should remove this, defaults are in the first line
plugin/storage/es/esRollover.py
Outdated
if action == 'init': | ||
index = prefix + ARCHIVE_INDEX + '-000001' | ||
if create_template: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the create_template
parameter necessary, couldn't you just check for init
action and create the index template for the supplied index_to_rollover
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See how the func is called, it would create templates two times in some cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can only see the three calls to the function - each with different index - so each call could pass the mapping file name. However the first call, for span-archive
doesn't seem to create the index template - is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The template should be created for all indices. I forgot to add the param to archive branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to be done? Still think it would be better to just pass the mapping file name instead of the boolean, so each call to perform_action
would just create the one index.
go get -u github.com/jteeuwen/go-bindata/... | ||
go get -u github.com/elazarl/go-bindata-assetfs/... | ||
|
||
.PHONE: statik-elasticsearch-mappings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be changed to remove statik
from the task?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be changed in a follow pr with the unification of statik and go-bindata
plugin/storage/es/esRollover.py
Outdated
if action == 'init': | ||
index = prefix + ARCHIVE_INDEX + '-000001' | ||
if create_template: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to be done? Still think it would be better to just pass the mapping file name instead of the boolean, so each call to perform_action
would just create the one index.
702541f
to
66fbd65
Compare
@pavolloffay Tried using the following with a fresh Elasticsearch db:
and got:
The usage message says |
localhost if fine but when using docker the localhost of the container is different than the one where ES runs. |
Still getting same error even using:
so looks like it is not to do with localhost, but schema? |
The command that worked is:
so looks like the usage message needs to be updated to change |
@pavolloffay Tested without index prefix and all worked great. When I then restarted ES and ran:
I got:
Shouldn't the indexes also have the prefix? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some usage text to update - also appears some failure on travis that needs to be investigated. But otherwise have tested the rollover commands and work great.
plugin/storage/es/esRollover.py
Outdated
|
||
def main(): | ||
if len(sys.argv) != 3: | ||
print('USAGE: [INDEX_PREFIX=(default "")] [ARCHIVE=(default false)] [CONDITIONS=(default {})] [UNIT=(default {})] [UNIT_COUNT=(default {})] {} ACTION HOSTNAME[:PORT]'.format(ROLLBACK_CONDITIONS, UNIT, UNIT_COUNT, sys.argv[0])) | ||
print('USAGE: [INDEX_PREFIX=(default "")] [ARCHIVE=(default false)] [SHARDS=(default {})] [REPLICAS=(default {})] [CONDITIONS=(default {})] [UNIT=(default {})] [UNIT_COUNT=(default {})] {} ACTION HOSTNAME[:PORT]'.format(SHARDS, REPLICAS, ROLLBACK_CONDITIONS, UNIT, UNIT_COUNT, sys.argv[0])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update HOSTNAME[:PORT]
to be URL, as only seems to work when specifying http://<host>:9200
.
plugin/storage/es/esRollover.py
Outdated
|
||
def main(): | ||
if len(sys.argv) != 3: | ||
print('USAGE: [INDEX_PREFIX=(default "")] [ARCHIVE=(default false)] [CONDITIONS=(default {})] [UNIT=(default {})] [UNIT_COUNT=(default {})] {} ACTION HOSTNAME[:PORT]'.format(ROLLBACK_CONDITIONS, UNIT, UNIT_COUNT, sys.argv[0])) | ||
print('USAGE: [INDEX_PREFIX=(default "")] [ARCHIVE=(default false)] [SHARDS=(default {})] [REPLICAS=(default {})] [CONDITIONS=(default {})] [UNIT=(default {})] [UNIT_COUNT=(default {})] {} ACTION HOSTNAME[:PORT]'.format(SHARDS, REPLICAS, ROLLBACK_CONDITIONS, UNIT, UNIT_COUNT, sys.argv[0])) | ||
print('ACTION ... one of:') | ||
print('\tinit - creates archive index and aliases') | ||
print('\trollover - rollover to new write index') | ||
print('\tlookback - removes old indices from read alias') | ||
print('HOSTNAME ... specifies which ElasticSearch hosts to search and delete indices from.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above - needs to be URL.
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
9810b7b
to
f6e7c58
Compare
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Codecov Report
@@ Coverage Diff @@
## master #1309 +/- ##
======================================
Coverage 100% 100%
======================================
Files 162 162
Lines 7282 7295 +13
======================================
+ Hits 7282 7295 +13
Continue to review full report at Codecov.
|
* Add support for rollover to main indices Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix mapping Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Add prefix Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix test-ci Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix mapping in ES itest Signed-off-by: Pavol Loffay <ploffay@redhat.com> Signed-off-by: Iori Yoneji <fivo.11235813@gmail.com>
* Add support for rollover to main indices Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix mapping Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Add prefix Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix test-ci Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix mapping in ES itest Signed-off-by: Pavol Loffay <ploffay@redhat.com>
* Add support for rollover to main indices Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix mapping Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Add prefix Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix test-ci Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix mapping in ES itest Signed-off-by: Pavol Loffay <ploffay@redhat.com>
* Add support for rollover to main indices Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix mapping Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Add prefix Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix test-ci Signed-off-by: Pavol Loffay <ploffay@redhat.com> * Fix mapping in ES itest Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Resolves #1242 #1308
Other significant changes:
--es.use-aliases
as experimentalcc @jaegertracing/elasticsearch