Using Berkeley DB Server Configuration Files

Berkeley DB server uses two configuration files, one for log4j 2, and the other for the server itself. After a change to a configuration file, you must restart the server to pick up the change.

log4j 2 Configuration File

Berkeley DB server uses log4j 2, and thus requires a log4j 2 configuration file. Berkeley DB server accepts configuration files in XML only. By default, it looks for a log4j2.xml file under the current working directory. The -log-config command-line argument overrides this when you start the server.

Here’s an example of a log4j 2 configuration file for a Berkeley DB server:

<?xml version="1.0" encoding="UTF-8"?>

<Configuration status="INFO">
 <Properties>
  <Property name="filename">path-to-log-file/logs/db.log<Property/>
 </Properties> 

 <Appenders>
  <RollingFile name="RollingFile" fileName="${filename}"
                     filePattern="logs/$${date:yyyy-MM}/%d{yyyy-MM-dd}-%i.log.gz">
   <PatternLayout pattern="%d{yyyy-MM-dd 'at' HH:mm:ss z} %p %c{10} %class{36} %L %M - %msg%xEx%n"/>
   <SizeBasedTriggeringPolicy size="20MB"/>
   <DefaultRolloverStrategy max="20"/>
  </RollingFile>
 </Appenders>

 <Loggers>
  <Root>
   <AppenderRef ref="RollingFile"/>
  </Root>
 </Loggers>
</Configuration>

Server Configuration File

Berkeley DB server also uses a Java properties file to control its own behavior. By default, the server looks for a bdb.properties file under the current working directory. The -config-file command-line argument overrides this when you start the server.

Note:

Because this file may contain sensitive information, its permissions should be limited to the minimum. If the file is accessible globally (globally readable, writable or executable), the server would not start.

Here’s an example of a configuration file for a Berkeley DB server:

###################################
# Server configuration
###################################
# The server's listening port
port=8080
# If SSL is enabled, this indicates the maximum number of concurrent
# client connections.
#
# If SSL is disabled, there is no limit on the number of concurrent
# connections, and this parameter indicates the maximum number of
# requests that can be processed concurrently.
workers=10
# Configure the host name of this server. SSL is enabled if ssl.host
# is set.
#ssl.host=server-host-name
# Configure the keystore for SSL.
#ssl.keyStore=path-to-key-store
#ssl.keyStore.password=key-store-password
#ssl.keyStore.type=jks
#ssl.keyStore.manager=SunX509
# Configure the trust store for SSL.
#ssl.trustStore=path-to-trust-store
#ssl.trustStore.password=trust-store-password
#ssl.trustStore.type=jks
#ssl.trustStore.manager=PKIX

###################################
# Database service configurations
###################################
# The root directory for all environments, the home directory for an
# environment with name "<env>" is $root.home/
<env>
root.home=path-to-environment-root-directory
# The root directory for all data directories, the data directory
# for an environment with name "<env>" is $root.data/
<env>
root.data=path-to-data-root-directory
# The root directory for all blob directories, the blob directory
# for an environment with name "<env>" is $root.blob/
<env>
root.blob=path-to-blob-root-directory
# The root directory for all log directories, the log directory for
# an environment with name "<env>" is $root.log/<env>

root.log=path-to-db-log-root-directory
# Configure the timeout value for open handles. The timeout value
# is set in seconds.
#
# For example, if the timeout is set to 600 seconds (10 minutes),
# and a handle has not been accessed for longer than 600 seconds,
# then this handle will be closed automatically when the cleanup
# worker runs the next time.
handle.timeout=600
# The frequency the cleanup worker runs. The frequency is set in
# seconds.
#
# For example, if the frequency is set to 300 seconds, the
# cleanup worker runs every 300 seconds.
cleanup.interval=300

Related Topics