不要在 postgresql 中创建默认集群

Art*_*rek 3 postgresql

如何防止 postgresql-9.4 创建默认集群(主)?我有 Ubuntu 14.04,使用 aptitude 和 postresql 官方存储库。我正在使用 ansible 来控制多个服务器并希望创建自己的集群。

Art*_*rek 7

负责自动创建主集群的是 postgresql-commons 包。这个包的目的是允许多个集群在同一台机器上的多个版本的 PostgreSQL 上运行。您可以同时安装不同版本的 PostgreSQL。每个都可以管理多个集群。

Postgresql-commons 在/etc/postgresql-common/ 中有配置文件。特别有趣的是createcluster.conf。这是它的内容:

# Default values for pg_createcluster(8)
# Occurrences of '%v' are replaced by the major version number,
# and '%c' by the cluster name. Use '%%' for a literal '%'.

# Create a "main" cluster when a new postgresql-x.y server package is installed
#create_main_cluster = true

# Default start.conf value, must be one of "auto", "manual", and "disabled".
# See pg_createcluster(8) for more documentation.
#start_conf = 'auto'

# Default data directory.
#data_directory = '/var/lib/postgresql/%v/%c'

# Default directory for transaction logs
# Unset by default, i.e. pg_xlog remains in the data directory.
#xlogdir = '/var/lib/postgresql/xlog/%v/%c/pg_xlog'

# Options to pass to initdb.
#initdb_options = ''

# The following options are copied into the new cluster's postgresql.conf:

# Enable SSL by default (using the "snakeoil" certificates installed by the
# ssl-cert package, unless configured otherwise here)
ssl = on

# Put stats_temp_directory on tmpfs
stats_temp_directory = '/var/run/postgresql/%v-%c.pg_stat_tmp'

# Add prefix to log lines
log_line_prefix = '%%t [%%p-%%l] %%q%%u@%%d '
Run Code Online (Sandbox Code Playgroud)

为了防止它从创建主集群您必须安装PostgreSQL公地,与取消注释行create_main_cluster,将其设置为,然后在需要的版本安装PostgreSQL。