Package org.apache.solr.cloud
Class ChaosMonkey
java.lang.Object
org.apache.solr.cloud.ChaosMonkey
The monkey can stop random or specific jetties used with SolrCloud.
It can also run in a background thread and start and stop jetties randomly.
TODO: expire multiple sessions / connectionloss at once
TODO: kill multiple jetties at once
TODO: ? add random headhunter mode that always kills the leader
TODO: chaosmonkey should be able to do cluster stop/start tests
-
Constructor Summary
ConstructorsConstructorDescriptionChaosMonkey(ZkTestServer zkServer, org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, Map<String, List<AbstractFullDistribZkTestBase.CloudJettyRunner>> shardToJetty, Map<String, AbstractFullDistribZkTestBase.CloudJettyRunner> shardToLeaderJetty) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidvoidcauses some randomly selected chaosvoidvoidexpireSession(JettySolrRunner jetty) static voidexpireSession(JettySolrRunner jetty, ZkTestServer zkServer) getRandomJetty(String slice, boolean aggressivelyKillLeaders) intkillRandomShard(String slice) static voidstatic voidvoidstatic voidstart(List<JettySolrRunner> jettys) voidstartAll()voidstartTheMonkey(boolean killLeaders, int roundPauseUpperLimit) static voidstop(List<JettySolrRunner> jettys) voidstopAll(int pauseBetweenMs) voidstopRandomShard(String slice) voidvoidstopShardExcept(String slice, String shardName) voidstatic voidwait(long runLength, String collectionName, org.apache.solr.common.cloud.ZkStateReader zkStateReader) You can call this method to wait while the ChaosMonkey is running, it waits approximately the specified time, and periodically logs the status of the collection
-
Constructor Details
-
ChaosMonkey
public ChaosMonkey(ZkTestServer zkServer, org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, Map<String, List<AbstractFullDistribZkTestBase.CloudJettyRunner>> shardToJetty, Map<String, AbstractFullDistribZkTestBase.CloudJettyRunner> shardToLeaderJetty)
-
-
Method Details
-
expireSession
-
expireSession
-
expireRandomSession
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
randomConnectionLoss
public void randomConnectionLoss() throws org.apache.zookeeper.KeeperException, InterruptedException- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
causeConnectionLoss
-
stopShard
public AbstractFullDistribZkTestBase.CloudJettyRunner stopShard(String slice, int index) throws Exception - Throws:
Exception
-
stopJetty
- Throws:
Exception
-
stopAll
- Throws:
Exception
-
startAll
- Throws:
Exception
-
stopShard
- Throws:
Exception
-
stopShardExcept
- Throws:
Exception
-
getShard
- Throws:
Exception
-
stopRandomShard
- Throws:
Exception
-
stopRandomShard
public AbstractFullDistribZkTestBase.CloudJettyRunner stopRandomShard(String slice) throws Exception - Throws:
Exception
-
killRandomShard
- Throws:
Exception
-
killRandomShard
public AbstractFullDistribZkTestBase.CloudJettyRunner killRandomShard(String slice) throws Exception - Throws:
Exception
-
getRandomJetty
public AbstractFullDistribZkTestBase.CloudJettyRunner getRandomJetty(String slice, boolean aggressivelyKillLeaders) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
startTheMonkey
public void startTheMonkey(boolean killLeaders, int roundPauseUpperLimit) -
monkeyLog
-
monkeyLog
-
stopTheMonkey
public void stopTheMonkey() -
causeSomeChaos
causes some randomly selected chaos- Throws:
Exception
-
getStarts
public int getStarts() -
stop
- Throws:
Exception
-
start
- Throws:
Exception
-
wait
public static void wait(long runLength, String collectionName, org.apache.solr.common.cloud.ZkStateReader zkStateReader) throws InterruptedException You can call this method to wait while the ChaosMonkey is running, it waits approximately the specified time, and periodically logs the status of the collection- Parameters:
runLength- The time in ms to waitcollectionName- The main collection being used for the ChaosMonkeyzkStateReader- current state reader- Throws:
InterruptedException
-