2018-03-20 14:06:30 +00:00
|
|
|
###
|
|
|
|
### Odyssey configuration file.
|
|
|
|
###
|
2016-11-07 12:06:49 +00:00
|
|
|
|
2018-03-16 14:07:32 +00:00
|
|
|
#
|
|
|
|
# Include files.
|
|
|
|
#
|
|
|
|
# Include one or more configuration files. Include files can
|
|
|
|
# include other files.
|
|
|
|
#
|
2017-08-02 10:41:37 +00:00
|
|
|
# include "path"
|
2018-03-16 14:07:32 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
###
|
|
|
|
### SERVICE
|
|
|
|
###
|
|
|
|
|
|
|
|
#
|
|
|
|
# Start as a daemon.
|
|
|
|
#
|
|
|
|
# By default Odyssey does not run as a daemon. Set to 'yes' to enable.
|
|
|
|
#
|
|
|
|
daemonize no
|
2017-08-02 10:41:37 +00:00
|
|
|
|
2017-09-21 13:44:19 +00:00
|
|
|
#
|
2018-03-16 14:07:32 +00:00
|
|
|
# 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"
|
|
|
|
#
|
|
|
|
|
|
|
|
###
|
|
|
|
### 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:
|
2017-09-21 13:44:19 +00:00
|
|
|
#
|
2017-09-21 14:17:33 +00:00
|
|
|
# %n = unixtime
|
|
|
|
# %t = timestamp with date
|
2017-09-21 13:44:19 +00:00
|
|
|
# %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
|
2017-09-21 14:17:33 +00:00
|
|
|
# %r = client port
|
|
|
|
# %h = client host
|
2018-03-16 14:07:32 +00:00
|
|
|
#
|
|
|
|
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
|
2018-03-19 14:12:13 +00:00
|
|
|
# detailed information useful for development or testing.
|
2018-03-16 14:07:32 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2018-03-20 14:24:48 +00:00
|
|
|
# Write client connect and disconnect events to the log.
|
2018-03-16 14:07:32 +00:00
|
|
|
#
|
|
|
|
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 3
|
|
|
|
|
|
|
|
###
|
|
|
|
### 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
|
2018-03-20 14:24:48 +00:00
|
|
|
# your server experience a big number of connecting clients.
|
2018-03-16 14:07:32 +00:00
|
|
|
#
|
|
|
|
resolvers 1
|
|
|
|
|
|
|
|
#
|
|
|
|
# IO Readahead.
|
|
|
|
#
|
|
|
|
# Set size of per-connection buffer used for io readahead operations.
|
|
|
|
#
|
|
|
|
readahead 8192
|
|
|
|
|
|
|
|
#
|
|
|
|
# Pipelining.
|
|
|
|
#
|
|
|
|
# Set size of buffer used for pipelining io operations between client
|
|
|
|
# and server. Odyssey will try to read as much as 'pipeline' data before sending
|
|
|
|
# data to a peer.
|
|
|
|
#
|
|
|
|
# This option differs from 'readahead' since it works with full PostgreSQL
|
|
|
|
# packets. Incoming packet can be larger than pipeline size, in that case buffer
|
|
|
|
# will be enlarged.
|
|
|
|
#
|
|
|
|
# It is a good idea to set this value to a approximate max size of
|
|
|
|
# data packet to reduce performance influence of a system memory allocator
|
|
|
|
# (like fragmentation, increased memory usage, etc).
|
|
|
|
#
|
|
|
|
pipeline 32768
|
|
|
|
|
|
|
|
#
|
|
|
|
# Pipeline pool cache size.
|
|
|
|
#
|
|
|
|
# Set size of pipeline cache pool (numbers). Approximate cache size could be
|
|
|
|
# calculated as 'cache' * 'pipeline'.
|
|
|
|
#
|
|
|
|
# Set to zero, to disable pipeline caching at all.
|
|
|
|
#
|
|
|
|
cache 100
|
|
|
|
|
|
|
|
#
|
|
|
|
# Pipeline buffer free watermark value.
|
|
|
|
#
|
|
|
|
# If pipeline buffer becomes bigger than `cache_chunk` free it, instead of
|
|
|
|
# putting back to cache.
|
|
|
|
#
|
|
|
|
# Set to zero, to disable the check.
|
|
|
|
#
|
|
|
|
cache_chunk 0
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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 16KB of memory.
|
|
|
|
#
|
|
|
|
# Set to zero, to disable coroutine cache.
|
|
|
|
#
|
|
|
|
cache_coroutine 128
|
|
|
|
|
|
|
|
#
|
|
|
|
# TCP nodelay.
|
|
|
|
#
|
|
|
|
# Set to 'yes', to enable nodelay.
|
|
|
|
#
|
|
|
|
nodelay yes
|
|
|
|
|
|
|
|
#
|
|
|
|
# TCP keepalive time.
|
|
|
|
#
|
|
|
|
# Set to zero, to disable keepalive.
|
|
|
|
#
|
|
|
|
keepalive 7200
|
|
|
|
|
|
|
|
###
|
2018-03-20 13:38:31 +00:00
|
|
|
### GLOBAL LIMITS
|
2018-03-16 14:07:32 +00:00
|
|
|
###
|
|
|
|
|
|
|
|
#
|
|
|
|
# Global limit of client connections.
|
|
|
|
#
|
2018-03-19 14:12:13 +00:00
|
|
|
# Comment 'client_max' to disable the limit. On client limit reach, Odyssey will
|
|
|
|
# reply with 'too many connections'.
|
2018-03-16 14:07:32 +00:00
|
|
|
#
|
2018-03-20 13:38:31 +00:00
|
|
|
# client_max 100
|
2018-03-16 14:07:32 +00:00
|
|
|
|
2018-03-19 14:12:13 +00:00
|
|
|
###
|
|
|
|
### LISTEN
|
|
|
|
###
|
2017-06-02 13:49:20 +00:00
|
|
|
|
2018-03-19 14:12:13 +00:00
|
|
|
#
|
|
|
|
# Listen section defines listening servers used for accepting
|
|
|
|
# incoming client connections.
|
|
|
|
#
|
|
|
|
# It is possible to define several Listen sections. Odyssey will listen on
|
2018-03-20 13:10:08 +00:00
|
|
|
# every specified address.
|
2018-03-19 14:12:13 +00:00
|
|
|
#
|
|
|
|
# Odyssey will fail in case it could not bind on any resolved address.
|
|
|
|
#
|
2018-03-20 14:24:48 +00:00
|
|
|
|
2017-07-13 12:58:32 +00:00
|
|
|
listen {
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
2018-03-19 14:12:13 +00:00
|
|
|
# Bind address.
|
2017-06-21 12:23:11 +00:00
|
|
|
host "*"
|
2018-03-19 14:27:28 +00:00
|
|
|
#
|
2018-03-19 14:12:13 +00:00
|
|
|
# Listen port.
|
2017-06-21 12:23:11 +00:00
|
|
|
port 6432
|
2018-03-19 14:27:28 +00:00
|
|
|
#
|
2018-03-19 14:12:13 +00:00
|
|
|
# TCP listen backlog.
|
2018-03-16 14:07:32 +00:00
|
|
|
backlog 128
|
2018-03-19 14:27:28 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
2018-03-16 14:07:32 +00:00
|
|
|
# tls "disable"
|
2017-06-21 12:23:11 +00:00
|
|
|
# tls_cert_file ""
|
|
|
|
# tls_key_file ""
|
|
|
|
# tls_ca_file ""
|
|
|
|
# tls_protocols ""
|
|
|
|
}
|
2016-11-07 12:06:49 +00:00
|
|
|
|
2018-03-19 14:12:13 +00:00
|
|
|
###
|
|
|
|
### ROUTING
|
|
|
|
###
|
|
|
|
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2017-06-24 14:59:28 +00:00
|
|
|
|
2018-03-16 14:07:32 +00:00
|
|
|
storage "postgres_server" {
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
|
|
|
# Storage type.
|
|
|
|
#
|
|
|
|
# "remote" - PostgreSQL server
|
|
|
|
# "local" - Odyssey (admin console)
|
|
|
|
#
|
2017-06-22 12:29:39 +00:00
|
|
|
type "remote"
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
|
|
|
# Remote server address.
|
2017-06-21 12:23:11 +00:00
|
|
|
host "127.0.0.1"
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
|
|
|
# Remote server port.
|
2017-06-21 12:23:11 +00:00
|
|
|
port 5432
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
|
|
|
# Remote server TLS settings.
|
|
|
|
#
|
2018-03-16 14:07:32 +00:00
|
|
|
# tls "disable"
|
2017-06-21 12:23:11 +00:00
|
|
|
# tls_ca_file ""
|
|
|
|
# tls_key_file ""
|
|
|
|
# tls_cert_file ""
|
|
|
|
# tls_protocols ""
|
|
|
|
}
|
2016-11-07 12:06:49 +00:00
|
|
|
|
2017-11-23 14:26:11 +00:00
|
|
|
database default {
|
2017-07-03 14:32:48 +00:00
|
|
|
user default {
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
2018-03-20 13:38:31 +00:00
|
|
|
# Authentication method.
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
|
|
|
# "none" - authentication turned off
|
2018-03-20 14:24:48 +00:00
|
|
|
# "block" - block this user
|
2018-03-20 13:10:08 +00:00
|
|
|
# "clear_text" - PostgreSQL clear text authentication
|
|
|
|
# "md5" - PostgreSQL MD5 authentication
|
|
|
|
#
|
2017-10-04 15:29:39 +00:00
|
|
|
authentication "none"
|
2017-10-04 15:07:54 +00:00
|
|
|
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
|
|
|
# Authentication method password.
|
|
|
|
#
|
2018-03-20 14:24:48 +00:00
|
|
|
# Depending on selected method, password can be in plain text or md5 hash.
|
|
|
|
#
|
2018-03-20 13:10:08 +00:00
|
|
|
# password ""
|
|
|
|
|
|
|
|
#
|
|
|
|
# Authentication query.
|
|
|
|
#
|
|
|
|
# Use selected 'auth_query_db' and 'auth_query_user' to match a route.
|
2018-03-20 13:38:31 +00:00
|
|
|
# Use matched route server to send 'auth_query' to get username and password needed
|
|
|
|
# to authenticate a client.
|
2018-03-20 13:10:08 +00:00
|
|
|
#
|
|
|
|
# auth_query "select username, pass from auth where username='%u'"
|
|
|
|
# auth_query_db ""
|
|
|
|
# auth_query_user ""
|
|
|
|
|
2018-03-20 13:38:31 +00:00
|
|
|
#
|
|
|
|
# Client connections limit.
|
|
|
|
#
|
|
|
|
# Comment 'client_max' to disable the limit. On client limit reach, Odyssey will
|
|
|
|
# reply with 'too many connections'.
|
|
|
|
#
|
|
|
|
# client_max 100
|
2017-07-03 10:56:47 +00:00
|
|
|
|
2018-03-20 13:38:31 +00:00
|
|
|
#
|
2018-03-20 13:10:08 +00:00
|
|
|
# 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.
|
|
|
|
#
|
2018-03-16 14:07:32 +00:00
|
|
|
storage "postgres_server"
|
2018-03-20 13:10:08 +00:00
|
|
|
# storage_db "database"
|
|
|
|
# storage_user "test"
|
|
|
|
# storage_password "test"
|
2017-07-03 11:33:03 +00:00
|
|
|
|
2018-03-20 13:38:31 +00:00
|
|
|
#
|
2018-03-20 14:24:48 +00:00
|
|
|
# Server pool mode.
|
2018-03-20 13:38:31 +00:00
|
|
|
#
|
|
|
|
# "session" - assign server connection to a client until it disconnects
|
|
|
|
# "transaction" - assign server connection to a client for a transaction processing
|
|
|
|
#
|
2017-07-03 14:32:48 +00:00
|
|
|
pool "transaction"
|
2018-03-20 13:38:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2017-11-23 13:27:16 +00:00
|
|
|
pool_size 0
|
2018-03-20 13:38:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Server pool wait timeout.
|
|
|
|
#
|
|
|
|
# Time to wait in milliseconds for an available server.
|
|
|
|
# Disconnect client on timeout reach.
|
|
|
|
#
|
|
|
|
# Set to zero to disable.
|
|
|
|
#
|
2017-11-21 12:10:28 +00:00
|
|
|
pool_timeout 0
|
2018-03-20 13:38:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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 auto-cancel.
|
|
|
|
#
|
|
|
|
# Start additional Cancel connection in case if server left with
|
|
|
|
# executing query. Close connection otherwise.
|
|
|
|
#
|
2017-07-03 14:32:48 +00:00
|
|
|
pool_cancel yes
|
2018-03-20 13:38:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Server pool auto-rollback.
|
|
|
|
#
|
|
|
|
# Execute 'ROLLBACK' if server left in active transaction.
|
|
|
|
# Close connection otherwise.
|
|
|
|
#
|
2017-07-03 14:32:48 +00:00
|
|
|
pool_rollback yes
|
2017-07-03 11:33:03 +00:00
|
|
|
|
2018-03-20 13:38:31 +00:00
|
|
|
#
|
|
|
|
# Forward PostgreSQL errors during remote server connection.
|
|
|
|
#
|
2017-12-05 12:32:08 +00:00
|
|
|
client_fwd_error no
|
2018-03-20 13:38:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Enable verbose mode for a specific route only.
|
|
|
|
#
|
2017-12-05 12:32:08 +00:00
|
|
|
log_debug no
|
2017-07-03 14:32:48 +00:00
|
|
|
}
|
2016-11-07 12:06:49 +00:00
|
|
|
}
|
2018-03-20 13:38:31 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
### ADMIN CONSOLE (example)
|
|
|
|
###
|
|
|
|
|
|
|
|
#storage "local" {
|
|
|
|
# type "local"
|
|
|
|
#}
|
|
|
|
|
|
|
|
#database "console" {
|
|
|
|
# user default {
|
|
|
|
# authentication "none"
|
|
|
|
# pool "session"
|
|
|
|
# storage "local"
|
|
|
|
# }
|
|
|
|
#}
|