Class MiniAccumuloConfigImpl
- java.lang.Object
-
- org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl
-
public class MiniAccumuloConfigImpl extends Object
Holds configuration forMiniAccumuloClusterImpl. Required configurations must be passed to constructor(s) and all other configurations are optional.- Since:
- 1.6.0
-
-
Constructor Summary
Constructors Constructor Description MiniAccumuloConfigImpl(File dir, String rootPassword)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccumuloConfigurationgetAccumuloConfiguration()FilegetAccumuloDir()FilegetAccumuloPropsFile()String[]getClasspathItems()Gets the classpath elements to use when spawning processes.FilegetClientConfFile()Map<String,String>getClientProps()FilegetClientPropsFile()FilegetConfDir()Map<String,String>getConfiguredSiteConfig()intgetConfiguredZooKeeperPort()longgetDefaultMemory()FilegetDir()StringgetExistingZooKeepers()FilegetHadoopConfDir()org.apache.hadoop.conf.ConfigurationgetHadoopConfiguration()StringgetInstanceName()FilegetLogDir()longgetMemory(ServerType serverType)String[]getNativeLibPaths()intgetNumTservers()StringgetRootPassword()StringgetRootUserName()Map<String,String>getSiteConfig()Map<String,String>getSystemProperties()intgetZooKeeperPort()StringgetZooKeepers()longgetZooKeeperStartupTime()booleanisJDWPEnabled()booleanisUseCredentialProvider()voidsetClasspathItems(String... classpathItems)Sets the classpath elements to use when spawning processes.voidsetClientProperty(String key, String value)voidsetClientProperty(ClientProperty property, String value)MiniAccumuloConfigImplsetClientProps(Map<String,String> clientProps)MiniAccumuloConfigImplsetDefaultMemory(long memory, MemoryUnit memoryUnit)Sets the default memory size to use.MiniAccumuloConfigImplsetExistingZooKeepers(String existingZooKeepers)Configure an existing ZooKeeper instance to use.MiniAccumuloConfigImplsetInstanceName(String instanceName)Calling this method is optional.MiniAccumuloConfigImplsetJDWPEnabled(boolean jdwpEnabled)MiniAccumuloConfigImplsetMemory(ServerType serverType, long memory, MemoryUnit memoryUnit)Sets the amount of memory to use in the master process.MiniAccumuloConfigImplsetNativeLibPaths(String... nativePathItems)Sets the path for processes to use for loading native librariesMiniAccumuloConfigImplsetNumTservers(int numTservers)Calling this method is optional.voidsetProperty(String p, String value)Sets arbitrary configuration properties.voidsetProperty(Property p, String value)Sets arbitrary configuration properties.voidsetRootUserName(String rootUserName)Sets the default Accumulo "superuser".MiniAccumuloConfigImplsetSiteConfig(Map<String,String> siteConfig)Calling this method is optional.voidsetSystemProperties(Map<String,String> systemProperties)sets system properties set for service processesvoidsetUseCredentialProvider(boolean useCredentialProvider)MiniAccumuloConfigImplsetZooKeeperPort(int zooKeeperPort)Calling this method is optional.MiniAccumuloConfigImplsetZooKeeperStartupTime(long zooKeeperStartupTime)Configure the time to wait for ZooKeeper to startup.booleanuseExistingInstance()MiniAccumuloConfigImpluseExistingInstance(File accumuloProps, File hadoopConfDir)Informs MAC that it's running against an existing accumulo instance.booleanuseExistingZooKeepers()booleanuseMiniDFS()voiduseMiniDFS(boolean useMiniDFS)Configures this cluster to use miniDFS instead of the localFileSystem.
-
-
-
Constructor Detail
-
MiniAccumuloConfigImpl
public MiniAccumuloConfigImpl(File dir, String rootPassword)
- Parameters:
dir- An empty or nonexistent directory that Accumulo and Zookeeper can store data in. Creating the directory is left to the user. Java 7, Guava, and Junit provide methods for creating temporary directories.rootPassword- The initial password for the Accumulo root user
-
-
Method Detail
-
setNumTservers
public MiniAccumuloConfigImpl setNumTservers(int numTservers)
Calling this method is optional. If not set, it defaults to two.- Parameters:
numTservers- the number of tablet servers that mini accumulo cluster should start
-
setInstanceName
public MiniAccumuloConfigImpl setInstanceName(String instanceName)
Calling this method is optional. If not set, defaults to 'miniInstance'- Since:
- 1.6.0
-
setSiteConfig
public MiniAccumuloConfigImpl setSiteConfig(Map<String,String> siteConfig)
Calling this method is optional. If not set, it defaults to an empty map.- Parameters:
siteConfig- key/values that you normally put in accumulo.properties can be put here.
-
setClientProps
public MiniAccumuloConfigImpl setClientProps(Map<String,String> clientProps)
-
setZooKeeperPort
public MiniAccumuloConfigImpl setZooKeeperPort(int zooKeeperPort)
Calling this method is optional. A random port is generated by default- Parameters:
zooKeeperPort- A valid (and unused) port to use for the zookeeper- Since:
- 1.6.0
-
setZooKeeperStartupTime
public MiniAccumuloConfigImpl setZooKeeperStartupTime(long zooKeeperStartupTime)
Configure the time to wait for ZooKeeper to startup. Calling this method is optional. The default is 20000 milliseconds- Parameters:
zooKeeperStartupTime- Time to wait for ZooKeeper to startup, in milliseconds- Since:
- 1.6.1
-
setExistingZooKeepers
public MiniAccumuloConfigImpl setExistingZooKeepers(String existingZooKeepers)
Configure an existing ZooKeeper instance to use. Calling this method is optional. If not set, a new ZooKeeper instance is created.- Parameters:
existingZooKeepers- Connection string for a already-running ZooKeeper instance. A null value will turn off this feature.- Since:
- 1.8.0
-
setMemory
public MiniAccumuloConfigImpl setMemory(ServerType serverType, long memory, MemoryUnit memoryUnit)
Sets the amount of memory to use in the master process. Calling this method is optional. Default memory is 128M- Parameters:
serverType- the type of server to apply the memory settingsmemory- amount of memory to setmemoryUnit- the units for which to apply with the memory size- Since:
- 1.6.0
-
setDefaultMemory
public MiniAccumuloConfigImpl setDefaultMemory(long memory, MemoryUnit memoryUnit)
Sets the default memory size to use. This value is also used when a ServerType has not been configured explicitly. Calling this method is optional. Default memory is 128M- Parameters:
memory- amount of memory to setmemoryUnit- the units for which to apply with the memory size- Since:
- 1.6.0
-
getInstanceName
public String getInstanceName()
- Returns:
- name of configured instance
- Since:
- 1.6.0
-
getZooKeeperPort
public int getZooKeeperPort()
- Returns:
- The configured zookeeper port
- Since:
- 1.6.0
-
getConfiguredZooKeeperPort
public int getConfiguredZooKeeperPort()
-
getZooKeeperStartupTime
public long getZooKeeperStartupTime()
-
getExistingZooKeepers
public String getExistingZooKeepers()
-
useExistingZooKeepers
public boolean useExistingZooKeepers()
-
getConfDir
public File getConfDir()
-
getAccumuloDir
public File getAccumuloDir()
-
getLogDir
public File getLogDir()
-
getMemory
public long getMemory(ServerType serverType)
- Parameters:
serverType- get configuration for this server type- Returns:
- memory configured in bytes, returns default if this server type is not configured
- Since:
- 1.6.0
-
getDefaultMemory
public long getDefaultMemory()
- Returns:
- memory configured in bytes
- Since:
- 1.6.0
-
getZooKeepers
public String getZooKeepers()
- Returns:
- zookeeper connection string
- Since:
- 1.6.0
-
getDir
public File getDir()
- Returns:
- the base directory of the cluster configuration
-
getRootPassword
public String getRootPassword()
- Returns:
- the root password of this cluster configuration
-
getNumTservers
public int getNumTservers()
- Returns:
- the number of tservers configured for this cluster
-
isJDWPEnabled
public boolean isJDWPEnabled()
- Returns:
- is the current configuration in jdwpEnabled mode?
- Since:
- 1.6.0
-
setJDWPEnabled
public MiniAccumuloConfigImpl setJDWPEnabled(boolean jdwpEnabled)
- Parameters:
jdwpEnabled- should the processes run remote jdwpEnabled servers?- Returns:
- the current instance
- Since:
- 1.6.0
-
useMiniDFS
public boolean useMiniDFS()
-
useMiniDFS
public void useMiniDFS(boolean useMiniDFS)
Configures this cluster to use miniDFS instead of the localFileSystem. Using this feature will not allow you to re-startMiniAccumuloClusterby callingMiniAccumuloCluster.start()afterMiniAccumuloCluster.stop(), because the underlying miniDFS cannot be restarted.
-
getClientConfFile
public File getClientConfFile()
- Returns:
- location of client conf file containing connection parameters for connecting to this minicluster
- Since:
- 1.6.0
-
getAccumuloPropsFile
public File getAccumuloPropsFile()
-
getClientPropsFile
public File getClientPropsFile()
- Returns:
- location of accumulo-client.properties file for connecting to this mini cluster
-
setSystemProperties
public void setSystemProperties(Map<String,String> systemProperties)
sets system properties set for service processes- Since:
- 1.6.0
-
getSystemProperties
public Map<String,String> getSystemProperties()
- Returns:
- a copy of the system properties for service processes
- Since:
- 1.6.0
-
getClasspathItems
public String[] getClasspathItems()
Gets the classpath elements to use when spawning processes.- Returns:
- the classpathItems, if set
- Since:
- 1.6.0
-
setClasspathItems
public void setClasspathItems(String... classpathItems)
Sets the classpath elements to use when spawning processes.- Parameters:
classpathItems- the classpathItems to set- Since:
- 1.6.0
-
getNativeLibPaths
public String[] getNativeLibPaths()
- Returns:
- the paths to use for loading native libraries
- Since:
- 1.6.0
-
setNativeLibPaths
public MiniAccumuloConfigImpl setNativeLibPaths(String... nativePathItems)
Sets the path for processes to use for loading native libraries- Parameters:
nativePathItems- the nativePathItems to set- Since:
- 1.6.0
-
setProperty
public void setProperty(Property p, String value)
Sets arbitrary configuration properties.- Since:
- 1.6.0
-
setClientProperty
public void setClientProperty(ClientProperty property, String value)
-
setProperty
public void setProperty(String p, String value)
Sets arbitrary configuration properties.- Since:
- 2.0.0
-
isUseCredentialProvider
public boolean isUseCredentialProvider()
- Returns:
- the useCredentialProvider
-
setUseCredentialProvider
public void setUseCredentialProvider(boolean useCredentialProvider)
- Parameters:
useCredentialProvider- the useCredentialProvider to set
-
useExistingInstance
public MiniAccumuloConfigImpl useExistingInstance(File accumuloProps, File hadoopConfDir) throws IOException
Informs MAC that it's running against an existing accumulo instance. It is assumed that it's already initialized and hdfs/zookeeper are already running.- Parameters:
accumuloProps- a File representation of the accumulo.properties file for the instance being runhadoopConfDir- a File representation of the hadoop configuration directory containing core-site.xml and hdfs-site.xml- Returns:
- MiniAccumuloConfigImpl which uses an existing accumulo configuration
- Throws:
IOException- when there are issues converting the provided Files to URLs- Since:
- 1.6.2
-
useExistingInstance
public boolean useExistingInstance()
- Returns:
- MAC should run assuming it's configured for an initialized accumulo instance
- Since:
- 1.6.2
-
getHadoopConfDir
public File getHadoopConfDir()
- Returns:
- hadoop configuration directory being used
- Since:
- 1.6.2
-
getAccumuloConfiguration
public AccumuloConfiguration getAccumuloConfiguration()
- Returns:
- accumulo Configuration being used
- Since:
- 1.6.2
-
getHadoopConfiguration
public org.apache.hadoop.conf.Configuration getHadoopConfiguration()
- Returns:
- hadoop Configuration being used
- Since:
- 1.6.2
-
getRootUserName
public String getRootUserName()
- Returns:
- the default Accumulo "superuser"
- Since:
- 1.7.0
-
setRootUserName
public void setRootUserName(String rootUserName)
Sets the default Accumulo "superuser".- Parameters:
rootUserName- The name of the user to create with administrative permissions during initialization- Since:
- 1.7.0
-
-