Package org.apache.solr.cloud
Class ZkTestServer
- java.lang.Object
-
- org.apache.solr.cloud.ZkTestServer
-
public class ZkTestServer extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ZkTestServer.HostPort
static class
ZkTestServer.LimitViolationAction
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.solr.common.cloud.SolrZkClient
chRootClient
protected org.apache.solr.common.cloud.SolrZkClient
rootClient
static Path
SOLRHOME
static int
TICK_TIME
static int
TIMEOUT
protected org.apache.solr.cloud.ZkTestServer.ZKServerMain
zkServer
-
Constructor Summary
Constructors Constructor Description ZkTestServer(Path zkDir)
ZkTestServer(Path zkDir, int port)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildZooKeeper(Path solrhome, String config, String schema)
void
ensurePathExists(String path)
Check that a path exists in this servervoid
expire(long sessionId)
org.apache.solr.cloud.ZkTestServer.ZKServerMain.WatchLimiter
getLimiter()
int
getMaxSessionTimeout()
int
getMinSessionTimeout()
int
getPort()
int
getTheTickTime()
String
getZkAddress()
String
getZkAddress(String chroot)
Get a connection string for this server with a given chrootorg.apache.solr.common.cloud.SolrZkClient
getZkClient()
org.apache.zookeeper.server.ZKDatabase
getZKDatabase()
Path
getZkDir()
String
getZkHost()
void
makeSolrZkNode()
static List<ZkTestServer.HostPort>
parseHostPortList(String hplist)
protected void
printLayout()
static void
putConfig(String confName, org.apache.solr.common.cloud.SolrZkClient zkClient, String zkChroot, Path solrhome, String srcName, String destName)
static void
putConfig(String confName, org.apache.solr.common.cloud.SolrZkClient zkClient, Path solrhome, String name)
static void
putConfig(String confName, org.apache.solr.common.cloud.SolrZkClient zkClient, Path solrhome, String srcName, String destName)
void
run()
void
run(boolean solrFormat)
static String
send4LetterWord(String host, int port, String cmd)
Send the 4letterwordvoid
setMaxSessionTimeout(int maxSessionTimeout)
void
setMinSessionTimeout(int minSessionTimeout)
void
setTheTickTime(int theTickTime)
void
setViolationReportAction(ZkTestServer.LimitViolationAction violationReportAction)
void
setZKDatabase(org.apache.zookeeper.server.ZKDatabase zkDb)
void
shutdown()
void
tryCleanSolrZkNode()
-
-
-
Field Detail
-
SOLRHOME
public static Path SOLRHOME
-
TIMEOUT
public static final int TIMEOUT
- See Also:
- Constant Field Values
-
TICK_TIME
public static final int TICK_TIME
- See Also:
- Constant Field Values
-
zkServer
protected final org.apache.solr.cloud.ZkTestServer.ZKServerMain zkServer
-
rootClient
protected volatile org.apache.solr.common.cloud.SolrZkClient rootClient
-
chRootClient
protected volatile org.apache.solr.common.cloud.SolrZkClient chRootClient
-
-
Constructor Detail
-
ZkTestServer
public ZkTestServer(Path zkDir, int port) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
-
Method Detail
-
getZkHost
public String getZkHost()
-
getZkAddress
public String getZkAddress()
-
getZkAddress
public String getZkAddress(String chroot)
Get a connection string for this server with a given chroot- Parameters:
chroot
- the chroot- Returns:
- the connection string
-
ensurePathExists
public void ensurePathExists(String path) throws IOException
Check that a path exists in this server- Parameters:
path
- the path to check- Throws:
IOException
- if an IO exception occurs
-
getPort
public int getPort()
-
expire
public void expire(long sessionId)
-
getZKDatabase
public org.apache.zookeeper.server.ZKDatabase getZKDatabase()
-
setZKDatabase
public void setZKDatabase(org.apache.zookeeper.server.ZKDatabase zkDb)
-
run
public void run() throws InterruptedException, IOException
- Throws:
InterruptedException
IOException
-
run
public void run(boolean solrFormat) throws InterruptedException, IOException
- Throws:
InterruptedException
IOException
-
shutdown
public void shutdown() throws IOException, InterruptedException
- Throws:
IOException
InterruptedException
-
send4LetterWord
public static String send4LetterWord(String host, int port, String cmd) throws IOException
Send the 4letterword- Parameters:
host
- the destination hostport
- the destination portcmd
- the 4letterword- Returns:
- server response
- Throws:
IOException
-
parseHostPortList
public static List<ZkTestServer.HostPort> parseHostPortList(String hplist)
-
getTheTickTime
public int getTheTickTime()
-
setTheTickTime
public void setTheTickTime(int theTickTime)
-
getZkDir
public Path getZkDir()
-
setViolationReportAction
public void setViolationReportAction(ZkTestServer.LimitViolationAction violationReportAction)
-
getLimiter
public org.apache.solr.cloud.ZkTestServer.ZKServerMain.WatchLimiter getLimiter()
-
getMaxSessionTimeout
public int getMaxSessionTimeout()
-
getMinSessionTimeout
public int getMinSessionTimeout()
-
setMaxSessionTimeout
public void setMaxSessionTimeout(int maxSessionTimeout)
-
setMinSessionTimeout
public void setMinSessionTimeout(int minSessionTimeout)
-
putConfig
public static void putConfig(String confName, org.apache.solr.common.cloud.SolrZkClient zkClient, Path solrhome, String name) throws Exception
- Throws:
Exception
-
putConfig
public static void putConfig(String confName, org.apache.solr.common.cloud.SolrZkClient zkClient, Path solrhome, String srcName, String destName) throws Exception
- Throws:
Exception
-
putConfig
public static void putConfig(String confName, org.apache.solr.common.cloud.SolrZkClient zkClient, String zkChroot, Path solrhome, String srcName, String destName) throws Exception
- Throws:
Exception
-
buildZooKeeper
public void buildZooKeeper(Path solrhome, String config, String schema) throws Exception
- Throws:
Exception
-
getZkClient
public org.apache.solr.common.cloud.SolrZkClient getZkClient()
-
-