Restarting Elasticsearch when running along with logstash

I started using Elastic Search very recently. So my questions might seen really idiotic. I have 2 es nodes and I am using logstash to send logs to them. The problem comes when I do a restart.
After I do a restart either both the ES nodes become masters and the cluster becoes red and they dont seem to identify the other. Error I got

 org.elasticsearch.index.gateway.IndexShardGatewayRecoveryException: [logstash-2015.07.18][2] failed recovery
 at org.elasticsearch.index.gateway.IndexShardGatewayService$
 at java.util.concurrent.ThreadPoolExecutor.runWorker(
 at java.util.concurrent.ThreadPoolExecutor$
 Caused by: org.elasticsearch.index.engine.EngineCreationFailureException: [logstash-2015.07.18][2]     failed to upgrade 3x segments
 at org.elasticsearch.index.engine.InternalEngine.<init>(
 at org.elasticsearch.index.engine.InternalEngineFactory.newReadWriteEngine(
 at org.elasticsearch.index.shard.IndexShard.newEngine(
 at org.elasticsearch.index.shard.IndexShard.createNewEngine(
 at org.elasticsearch.index.shard.IndexShard.prepareForTranslogRecovery(
 at org.elasticsearch.index.gateway.local.LocalIndexShardGateway.recover(
 at org.elasticsearch.index.gateway.IndexShardGatewayService$

That's not related to your dual master issue, to fix that you should really read

@warkolm Thanks for the quick response. I changed the settings and did a quick restart. I dont get that error now and also the cluster status is not red. On a completely different note I get this error in Logstash and it cannot connect to Elasticsearch sometimes.

Jul 18, 2015 8:14:33 AM org.elasticsearch.discovery.zen.ZenDiscovery joinElectedMaster
 failed to send join request to master  connect_timeout[30s]]; nested: SocketException[Network is unreachable]; ]

That means you have a problem with your networking.
Can you telnet from the LS host to the ES host on 9200?

They are both running in the same machine. In my logstash I have

elasticsearch { 
  host => localhost
  cluster => MyCluster

You need to put those in quotes, check the docs for formatting requirements :slight_smile:

Sorry They are already in quotes in the conf file, I did not copy them I just typed them for reference. Thanks for the info though.