Technically this is possible. You can copy the index files from the CM server and deploy that out to the CD servers.
But, there are concerns with doing that. I am making the assumption that you have this question because you want to have a zero downtime deployment:
- The CD servers will still want to re-index as part of any publish operation, so you may need to stop index operations during the deployment and enable once the deployment is complete.
- You have the potential to be in a situation where an item is present in the index, but it is not in the web database yet. If this is the case, depending on your code, you may create a link that will 404, or worse cause a run-time error.
I would look at approaching this differently. The first and best option, would be to move your site over to Solr. This means that all CD's use the same index, it can be rebuilt during the CM deployment and then once the CDs are deployed and moved over to the Solr index, it will all be setup. Solr will give you many other benefits too, such as all CD's being sync'd, CD servers no longer have to build and maintain their own index etc... (There are more benefits to Solr that you can look up)
But, the move to Solr would be a big project, so if you must stick with Lucene, I would recommend this workflow:
- Setup a new Web database (as you would have in a green/blue deployment)
- Deploy to the CM and update the connection string for the
web database to the new db
- Publish to the new web db
- Take the CD's off line one at a time so that the Site does not go down at all
- Deploy to the CD that is off line
- Rebuild the local index, do this on the CD server, you may need to enable access to the
/sitecore folder locally to do this.
- Warm up the site on the CD and test it
- Add it back into the load balancer
- Move on to the next CD server
That way, you give the CD time to rebuild the index without having that server "live", once the index is ready and the site works, it takes over the traffic and you move on until all the CD's are done. This is how I did it in the pre-solr days.