Hi,
I am thinking of adding JMX bean for taking hot backup of lucene index.
LuceneMBean mbean = new LuceneMBeanImpl(); ObjectName name = new ObjectName("indexing.index:type=lucene"); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(mbean, name);
LuceneMBean will have method called backupIndex(String directory).
I have gone through lucene docs and I found out copy() method of Directory. If I have Writer Open on directory will this method will work? Basically my code snippet is like follows :
public class LuceneMBeanImpl implements LuceneMBean{
public void backupIndex(String directory){
Directory fileDirectory = FSDirectory.getDirectory(directory);
Directory.copy(masterDirectory, fileDirectory,false);
}
}