odyssey/odyssey.conf

499 lines
9.6 KiB
Plaintext

###
### Odyssey configuration file.
###
#
# Include files.
#
# Include one or more configuration files. Include files can
# include other files.
#
# include "path"
#
###
### SERVICE
###
#
# Start as a daemon.
#
# By default Odyssey does not run as a daemon. Set to 'yes' to enable.
#
daemonize no
#
# Process priority.
#
# Set Odyssey parent process and threads priority.
#
# priority -10
#
# Pid file.
#
# If pid_file is specified, Odyssey will write its process id to
# the specified file at startup.
#
# pid_file "/var/run/odyssey.pid"
#
#
# UNIX socket directory.
#
# If unix_socket_dir is specified, Odyssey will enable UNIX socket
# communications. Specified directory path will be used for
# searching socket files.
#
unix_socket_dir "/tmp"
#
# UNIX socket file mode.
#
# Set `unix_socket_mode` file mode to any created unix files.
#
unix_socket_mode "0644"
###
### LOGGING
###
#
# Log file.
#
# If log_file is specified, Odyssey will additionally use it to write
# log events.
#
# log_file "/var/log/odyssey.log"
#
#
# Log text format.
#
# Odyssey allows to configure log text format. This could be useful to
# support external log parser format. Format string can contain plain
# text, escape symbols and format flags.
#
# Supported flags:
#
# %n = unixtime
# %t = timestamp with date
# %p = process ID
# %i = client ID
# %s = server ID
# %u = user name
# %d = database name
# %c = context
# %l = level (error, warning, debug)
# %m = message
# %M = message tskv
# %r = client port
# %h = client host
#
log_format "%p %t %l [%i %s] (%c) %m\n"
#
# Log to stdout.
#
# Set to 'yes' if you need to additionally display log output in stdout.
# Enabled by default.
#
log_to_stdout yes
#
# Log to system logger.
#
# To enable syslog(3) usage, set log_syslog to 'yes'. Additionally set
# log_syslog_ident and log_syslog_facility.
#
log_syslog no
log_syslog_ident "odyssey"
log_syslog_facility "daemon"
#
# Verbose logging.
#
# Enable verbose logging of all events, which will generate a log of
# detailed information useful for development or testing.
#
# It is also possible to enable verbose logging for specific users
# (see routes section).
#
log_debug no
#
# Log configuration.
#
# Write configuration to the log during start and config reload.
#
log_config yes
#
# Log session events.
#
# Write client connect and disconnect events to the log.
#
log_session yes
#
# Log client queries.
#
# Write client queries text to the log. Disabled by default.
#
log_query no
#
# Log client statistics.
#
# Periodically display information about active routes.
#
log_stats yes
#
# Statistics update inverval.
#
# Set interval in seconds for internal statistics update and log report.
#
stats_interval 60
###
### PERFORMANCE
###
#
# Worker threads.
#
# Set size of thread pool used for client processing.
#
# 1: By default, Odyssey runs with a single worker. This is a special
# mode optimized for general use. This mode also made to reduce multi-thread
# communication overhead.
#
# N: Add additional worker threads, if your server experience heavy load,
# especially using TLS setup.
#
workers 1
#
# Resolver threads.
#
# Number of threads used for DNS resolving. This value can be increased, if
# your server experience a big number of connecting clients.
#
resolvers 1
#
# IO Readahead.
#
# Set size of per-connection buffer used for io readahead operations.
#
readahead 8192
#
# Coroutine cache size.
#
# Set pool size of free coroutines cache. It is a good idea to set
# this value to a sum of max clients plus server connections. Please note, that
# each coroutine consumes around `coroutine_stack_size` of memory.
#
# Set to zero, to disable coroutine cache.
#
cache_coroutine 0
#
# Coroutine stack size.
#
# Set coroutine stack size in pages. In some rare cases
# it might be necessary to make stack size bigger. Actual stack will be
# allocated as (`coroutine_stack_size` + 1_guard_page) * page_size.
# Guard page is used to track stack overflows.
#
# 16KB by default.
#
coroutine_stack_size 4
#
# TCP nodelay.
#
# Set to 'yes', to enable nodelay.
#
nodelay yes
#
# TCP keepalive time.
#
# Set to zero, to disable keepalive.
#
keepalive 7200
###
### GLOBAL LIMITS
###
#
# Global limit of client connections.
#
# Comment 'client_max' to disable the limit. On client limit reach, Odyssey will
# reply with 'too many connections'.
#
# client_max 100
###
### LISTEN
###
#
# Listen section defines listening servers used for accepting
# incoming client connections.
#
# It is possible to define several Listen sections. Odyssey will listen on
# every specified address port and can use separate TLS settings.
#
# Odyssey will fail in case it could not bind on any resolved address.
#
listen {
#
# Bind address.
#
# If host is not set, Odyssey will try to listen using UNIX socket if
# unix_socket_dir is set.
#
host "*"
#
# Listen port.
port 6432
#
# TCP listen backlog.
backlog 128
#
# TLS support.
#
# Supported TLS modes:
#
# "disable" - disable TLS protocol
# "allow" - switch to TLS protocol on request
# "require" - TLS clients only
# "verify_ca" - require valid client certificate
# "verify_full" - require valid client ceritifcate
#
# tls "disable"
# tls_ca_file ""
# tls_key_file ""
# tls_cert_file ""
# tls_protocols ""
}
###
### ROUTING
###
#
# Odyssey allows to define client routing rules by specifying
# 'database', 'user' and 'storage' sections.
#
# On client accept appropriate route is assigned by matching 'database' and
# 'user' sections, all requests then forwarded to a 'storage'
# (which is referenced from the 'user' section).
#
# Database <name> | default.
#
# Defines database name requested by client. Each 'database' section structure
# consist of a 'user' subsections.
#
# A special 'database default' is used, in case when no database is matched.
#
# User <name> | default.
#
# Defines authentication, pooling and storage settings for
# requested route.
#
# A special 'user default' is used, in case when no user is matched.
#
# Storage <name>.
#
# Defines server used as a data storage or admin console operations.
#
storage "postgres_server" {
#
# Storage type.
#
# "remote" - PostgreSQL server
# "local" - Odyssey (admin console)
#
type "remote"
#
# Remote server address.
#
# If host is not set, Odyssey will try to connect using UNIX socket if
# unix_socket_dir is set.
#
host "localhost"
#
# Remote server port.
#
port 5432
#
# Remote server TLS settings.
#
# tls "disable"
# tls_ca_file ""
# tls_key_file ""
# tls_cert_file ""
# tls_protocols ""
}
database default {
user default {
#
# Authentication method.
#
# "none" - authentication turned off
# "block" - block this user
# "clear_text" - PostgreSQL clear text authentication
# "md5" - PostgreSQL MD5 authentication
# "cert" - Compare client certificate Common Name against auth_common_name's
#
authentication "none"
#
# Authentication certificate CN.
#
# Specify common names to check for "cert" authentification method.
# If there are more then one common name is defined, all of them
# will be checked until match.
#
# Set 'default' to check for current user.
#
# auth_common_name default
# auth_common_name "test"
#
# Authentication method password.
#
# Depending on selected method, password can be in plain text or md5 hash.
#
# password ""
#
# Authentication query.
#
# Use selected 'auth_query_db' and 'auth_query_user' to match a route.
# Use matched route server to send 'auth_query' to get username and password needed
# to authenticate a client.
#
# auth_query "select username, pass from auth where username='%u'"
# auth_query_db ""
# auth_query_user ""
#
# Client connections limit.
#
# Comment 'client_max' to disable the limit. On client limit reach, Odyssey will
# reply with 'too many connections'.
#
# client_max 100
#
# Remote server to use.
#
# By default route database and user names are used as connection
# parameters to remote server. It is possible to override this values
# by specifying 'storage_db' and 'storage_user'. Remote server password
# can be set using 'storage_password' field.
#
storage "postgres_server"
# storage_db "database"
# storage_user "test"
# storage_password "test"
#
# Server pool mode.
#
# "session" - assign server connection to a client until it disconnects
# "transaction" - assign server connection to a client during a transaction lifetime
#
pool "session"
#
# Server pool size.
#
# Keep the number of servers in the pool as much as 'pool_size'.
# Clients are put in a wait queue, when all servers are busy.
#
# Set to zero to disable the limit.
#
pool_size 0
#
# Server pool wait timeout.
#
# Time to wait in milliseconds for an available server.
# Disconnect client on timeout reach.
#
# Set to zero to disable.
#
pool_timeout 0
#
# Server pool idle timeout.
#
# Close an server connection when it becomes idle for 'pool_ttl' seconds.
#
# Set to zero to disable.
#
pool_ttl 60
#
# Server pool parameters discard.
#
# Execute 'DISCARD ALL' and reset client parameters before using server
# from the pool.
#
pool_discard no
#
# Server pool auto-cancel.
#
# Start additional Cancel connection in case if server left with
# executing query. Close connection otherwise.
#
pool_cancel yes
#
# Server pool auto-rollback.
#
# Execute 'ROLLBACK' if server left in active transaction.
# Close connection otherwise.
#
pool_rollback yes
#
# Forward PostgreSQL errors during remote server connection.
#
client_fwd_error yes
#
# Enable verbose mode for a specific route only.
#
log_debug no
}
}
###
### ADMIN CONSOLE (example)
###
#storage "local" {
# type "local"
#}
#database "console" {
# user default {
# authentication "none"
# pool "session"
# storage "local"
# }
#}