Hey guys,
It is possible to schedule a JIRA reindex or write a script to do this?
Thanks!
Mihai,
First of all perform reindex only when you have to. There is no need to do it regularly.
You can trigger reindex from REST API: https://docs.atlassian.com/jira/REST/server/#api/2/reindex-reindex
-Ravi
It's always worth questioning why you want to do this. There are some cases where it makes sense, but if you're doing it because your index is regularly going wrong, then this is absolutely the wrong thing to do.
There's a phrase "plastering over the cracks" - when your house is structurally unsound, cracks appear in the plaster as it gradually falls apart. If you "plaster over the cracks", your house might look ok to the eye, but you're hiding the fact that it's going to fall down soon.
So, if you're doing this because you're getting indexing errors a lot, you need to fix that, not pretend you don't have a massive problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ravi Sagar [Author - Mastering JIRA 7] Thanks for the answer!
@Nic Brough [Adaptavist] Yes, I agree with you, but I need to reindex after working hours because I make a lot of change during the day (fields, addons, etc) and I don't wanna manual reindex every time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, but that's just a case of clicking it when you know you've finished your changes, exactly as Ravi said. The REST call does that
You do not need or want to do it regularly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are undoubtedly in a position of having to do this weekly, and for performance and other organizational reasons it has to be hard reindexing each Saturday night at midnight. We are pushing our little VM to the limit and I lack the cash and authority to move to dedicated hardware at this time so...
I would rather not have to logon every Saturday night to start this hard reindex. We do have ScriptRunner if that helps, and I can schedule cron jobs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why? Are you really re-configuring your fields every week?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Because at least some of our over a thousand project admins need changes.
Our little group supports them, they in turn support over 600 teams. In any given week there will be at least a few tweaks that are not easily isolated to the project, notwithstanding scope control of custom fields in the default field contexts.
Anyhow, I found a crude approach, though would rather handle authentication otherwise. With this I may have to regularly change the password for some admin account, cron it up late each week. The account under which JIRA runs is pretty restricted, but storing plaintext passwords is not a good thing - I have the same concern re dbconfig.cfg, by the way. Here's what I tested last night in nonprod:
curl -u [acct]:[password-of-week] -X POST https://[JIRA instance]/rest/api/2/reindex?type=FOREGROUND
We may find a better way, using centrally-controlled automation, but this works. From https://confluence.atlassian.com/jirakb/how-to-trigger-re-indexing-using-rest-request-via-curl-command-663617587.html.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Caleb. FYI this also works for content reindexing in Confluence, with slightly different syntax. To do that nightly at 3 am put the following into a script, to run as the account that runs Confluence, with 750 perms (for security), and then call it via crontab.
#!/bin/bash
# This script can force content reindexing nightly.
# Call this via the service account's crontab:
# 00 03 * * * [path]/[script].sh > /dev/null 2>&1
export JAVA_HOME=[where is your Java]
export PATH=$PATH:$JAVA_HOME/bin
curl -u [acct]:[password] -X POST -H "X-Atlassian-Token: no-check" https://[Confluence instance]/rest/prototype/1/index/reindex
Got that from https://jira.atlassian.com/browse/CONFSERVER-44340.
Whoever has root on the box - assuming you run Confluence atop Linux - may first have to empower the service account to control its own crontab, lest they get roped into helping whenever this needs a tweak.
I really wish there were a way to do this that did not require storing a password in cleartext, but am not yet aware of a way to hash or otherwise obfuscate or encrypt. We do prevent users and most others from getting to that service account, but anyhow who sees the unredacted file has keys to the kingdom, so at the least great care is required regarding this script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Brad Taplin,
We are in a similar case, and after checking all atlassian recommendations, I got the conclusion that only there is this curl command. But I have a concern on having this password visible in the curl command. Have you found another way to scheduled re indexing?
Thanks and regards,
Oumaima.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Oumaima,
That is a fair concern. From my years of working as a Jira admin I do not recall a better way, but for the past year I have been in another role and not working with Jira beyond membership in a Kanban team, so I do not know of any changes since.
Brad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.