Postgres 配置组

Launchpad Blueprint: https://blueprints.launchpad.net/trove/+spec/postgres-configuration-groups

问题描述

Postgres guestagent 目前不支持配置组。

提议的变更

补丁集将为 Postgres 9.3 或更高版本实现配置组。

Postgres 将其配置 1 存储在 ‘postgresql.conf’ 文件中。配置指令具有键值格式:“keyword = value”

除了已经提到的 ‘postgresql.conf’ 文件之外,PostgreSQL 还使用另外两个配置文件(‘pg_hba.conf’ 和 ‘pg_ident.conf’),用于控制客户端身份验证。

这些文件将由 guest-agent 直接写入,不会通过配置组机制暴露。

可以通过特殊的 ‘pg_reload_conf’ 调用在不中断任何打开的连接的情况下动态加载配置更改 2。请注意,Postgres 还有一个 ‘SET’ 命令,但它仅影响当前会话的值。

大多数配置属性将通过配置组可用。然而,有些在 Trove 环境下没有意义。

这些包括(将在配置模板中记录)

  • guestagent 特定的(例如,文件路径、密码、文件访问规则)

  • Trove 需要控制的项目(复制/集群/日志属性)

请参阅 可用配置属性 以获取支持的选项的完整列表。

配置

数据库

公共 API

公共 API 安全

Python API

CLI (python-troveclient)

内部 API

CLI (python-troveclient)

这项工作将启用以下客户端命令

  • configuration-attach

  • configuration-create

  • configuration-default

  • configuration-delete

  • configuration-detach

  • configuration-instances

  • configuration-list

  • configuration-parameter-list

  • configuration-parameter-show

  • configuration-patch

  • configuration-show

  • configuration-update

Guest Agent

  • managerservice 模块中实现 update_overridesapply_overrides

  • 将提供一个配置模板和验证规则,并附带在 可用配置属性 中记录的更改。

现有的 ‘PropertiesCodec’ 实现将被重用以处理文本文件操作。配置覆盖将使用 guestagent 配置管理器的 ‘OneFileOverrideStrategy’ 实现。

备选方案

Dashboard 影响 (UX)

待定 (在批准后添加的部分)

实现

负责人

Petr Malik <pmalik@tesora.com>

里程碑

Mitaka

工作项

所有更改将在单个任务的上下文中完成。

  1. 实现与配置相关的 manager API 调用

    def update_overrides(self, context, overrides, remove=False)
    def apply_overrides(self, context, overrides)
    

升级影响

依赖项

测试

该更改主要涵盖在现有的配置测试中。将添加单元测试以验证任何 Postgres 特定的代码路径。将为场景测试贡献一个 ‘postgres_helper’,以便在此数据存储上进行配置覆盖。

文档影响

数据存储文档应更新以反映启用的功能。

参考资料

1

Postgres 配置文档:https://postgresql.ac.cn/docs/9.3/static/runtime-config.html

2

关于 Postgres 系统管理功能的说明:https://postgresql.ac.cn/docs/9.3/static/functions-admin.html

附录

可用配置属性

用户可以通过 Trove API 配置的属性

  • max_connections

  • superuser_reserved_connections

  • bonjour

  • bonjour_name

  • authentication_timeout

  • password_encryption

  • db_user_namespace

  • tcp_keepalives_idle

  • tcp_keepalives_interval

  • tcp_keepalives_count

  • shared_buffers

  • huge_pages

  • temp_buffers

  • max_prepared_transactions

  • work_mem

  • maintenance_work_mem

  • autovacuum_work_mem

  • max_stack_depth

  • dynamic_shared_memory_type

  • temp_file_limit

  • max_files_per_process

  • vacuum_cost_delay

  • vacuum_cost_page_hit

  • vacuum_cost_page_miss

  • vacuum_cost_page_dirty

  • vacuum_cost_limit

  • bgwriter_delay

  • bgwriter_lru_maxpages

  • bgwriter_lru_multiplier

  • effective_io_concurrency

  • max_worker_processes

  • fsync

  • synchronous_commit

  • wal_sync_method

  • full_page_writes

  • wal_log_hints

  • wal_buffers

  • wal_writer_delay

  • commit_delay

  • commit_siblings

  • checkpoint_segments

  • checkpoint_timeout

  • checkpoint_completion_target

  • checkpoint_warning

  • wal_keep_segments

  • wal_sender_timeout

  • synchronous_standby_names

  • vacuum_defer_cleanup_age

  • hot_standby

  • max_standby_archive_delay

  • max_standby_streaming_delay

  • wal_receiver_status_interval

  • hot_standby_feedback

  • wal_receiver_timeout

  • enable_bitmapscan

  • enable_hashagg

  • enable_hashjoin

  • enable_indexscan

  • enable_indexonlyscan

  • enable_material

  • enable_mergejoin

  • enable_nestloop

  • enable_seqscan

  • enable_sort

  • enable_tidscan

  • seq_page_cost

  • random_page_cost

  • cpu_tuple_cost

  • cpu_index_tuple_cost

  • cpu_operator_cost

  • effective_cache_size

  • geqo

  • geqo_threshold

  • geqo_effort

  • geqo_pool_size

  • geqo_generations

  • geqo_selection_bias

  • geqo_seed

  • default_statistics_target

  • constraint_exclusion

  • cursor_tuple_fraction

  • from_collapse_limit

  • join_collapse_limit

  • log_truncate_on_rotation

  • log_rotation_age

  • log_rotation_size

  • client_min_messages

  • log_min_messages

  • log_min_error_statement

  • log_min_duration_statement

  • debug_print_parse

  • debug_print_rewritten

  • debug_print_plan

  • debug_pretty_print

  • log_checkpoints

  • log_connections

  • log_disconnections

  • log_duration

  • log_error_verbosity

  • log_hostname

  • log_line_prefix

  • log_lock_waits

  • log_statement

  • log_temp_files

  • log_timezone

  • track_activities

  • track_counts

  • track_io_timing

  • track_functions

  • track_activity_query_size

  • log_parser_stats

  • log_planner_stats

  • log_executor_stats

  • log_statement_stats

  • autovacuum

  • log_autovacuum_min_duration

  • autovacuum_max_workers

  • autovacuum_naptime

  • autovacuum_vacuum_threshold

  • autovacuum_analyze_threshold

  • autovacuum_vacuum_scale_factor

  • autovacuum_analyze_scale_factor

  • autovacuum_freeze_max_age

  • autovacuum_multixact_freeze_max_age

  • autovacuum_vacuum_cost_delay

  • autovacuum_vacuum_cost_limit

  • search_path

  • default_tablespace

  • temp_tablespaces

  • check_function_bodies

  • default_transaction_isolation

  • default_transaction_read_only

  • default_transaction_deferrable

  • session_replication_role

  • statement_timeout

  • lock_timeout

  • vacuum_freeze_min_age

  • vacuum_freeze_table_age

  • vacuum_multixact_freeze_min_age

  • vacuum_multixact_freeze_table_age

  • bytea_output

  • xmlbinary

  • xmloption

  • datestyle

  • intervalstyle

  • timezone

  • timezone_abbreviations

  • extra_float_digits

  • client_encoding

  • lc_messages

  • lc_monetary

  • lc_numeric

  • lc_time

  • default_text_search_config

  • deadlock_timeout

  • max_locks_per_transaction

  • max_pred_locks_per_transaction

  • array_nulls

  • backslash_quote

  • default_with_oids

  • escape_string_warning

  • lo_compat_privileges

  • quote_all_identifiers

  • sql_inheritance

  • standard_conforming_strings

  • synchronize_seqscans

  • transform_null_equals

  • exit_on_error

  • restart_after_crash

Guestagent 控制的属性

  • data_directory

  • hba_file

  • ident_file

  • external_pid_file

  • listen_addresses

  • port

  • unix_socket_directories

  • unix_socket_group

  • unix_socket_permissions

  • wal_level

  • archive_mode

  • archive_command

  • archive_timeout

  • log_destination

  • logging_collector

  • log_directory

  • log_filename

  • log_file_mode

  • update_process_title