Re-index mailboxes

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
wfweaver
Posts: 49
Joined: Fri Sep 12, 2014 10:14 pm

Re-index mailboxes

Post by wfweaver »

Is there a way to reindex ALL mailboxes on a server? I know you can reindex a single mailbox via the Admin interface, but we need to be able to reindex all of them on a server (several 100) and doing them one by one via the interface would be extremely painful!
dustys
Advanced member
Advanced member
Posts: 67
Joined: Fri Sep 12, 2014 10:25 pm

Re-index mailboxes

Post by dustys »

I am running into an issue after a migration to a new mailbox server where we have a mailboxes that 'looses' messages. The fix seems to be reindexing a problem mailbox (as pointed to in other posts).
Has anyone found a way to re-index all mailboxes without completely burying my server's IO or having to do it by hand?
wfweaver
Posts: 49
Joined: Fri Sep 12, 2014 10:14 pm

Re-index mailboxes

Post by wfweaver »

I just ended up creating a script called "reindex_mailboxes". Basically it is simply the following:
for i in `zmprov gaa -s `

do

echo "reindexing $i"

zmprov rim $i start

done
Whether that slams your I/O or not, I can't say that I've really noticed - though I only run it overnight.
Krishopper
Outstanding Member
Outstanding Member
Posts: 769
Joined: Fri Sep 12, 2014 10:23 pm

Re-index mailboxes

Post by Krishopper »

It can easily slam your disk and CPU i/o. I did the same, but I put a "sleep 120" between each one to space it out a bit. I didn't care how fast it got done, I just needed it to get done for all accounts, so I let that run in the background and it worked itself up without doing them all at the same time.
styelz
Posts: 8
Joined: Fri Sep 12, 2014 11:14 pm

Re-index mailboxes

Post by styelz »



#!/bin/bash

# Get list of mail accounts and reindex each one

for i in `zmprov -l gaa -s server.yourdomain.com`

do

echo -n "Reindexing $i"

# Start reindexing

zmprov rim $i start >/dev/null

# Check if the rendix is still running for this account

while [ `zmprov rim $i status|wc -l` != 1 ]

do

# Sleep for 2 seconds before checking status again

echo -n . && sleep 2

done

echo .

done

Post Reply