patroni package¶
Subpackages¶
- patroni.dcs package
- Submodules
- patroni.dcs.consul module
- patroni.dcs.etcd module
- patroni.dcs.etcd3 module
AuthFailed
AuthNotEnabled
DeadlineExceeded
Etcd3
Etcd3Client
Etcd3ClientError
Etcd3Error
Etcd3Exception
FailedPrecondition
GRPCCode
InvalidArgument
InvalidAuthToken
KVCache
LeaseNotFound
NotFound
PatroniEtcd3Client
PermissionDenied
Unavailable
Unknown
UnsupportedEtcdVersion
UserEmpty
base64_decode()
base64_encode()
build_range_request()
prefix_range_end()
to_bytes()
- patroni.dcs.exhibitor module
- patroni.dcs.kubernetes module
- patroni.dcs.raft module
- patroni.dcs.zookeeper module
- Module contents
AbstractDCS
AbstractDCS.attempt_to_acquire_leader()
AbstractDCS.cancel_initialization()
AbstractDCS.client_path()
AbstractDCS.cluster
AbstractDCS.config_path
AbstractDCS.delete_cluster()
AbstractDCS.delete_leader()
AbstractDCS.delete_sync_state()
AbstractDCS.failover_path
AbstractDCS.failsafe
AbstractDCS.failsafe_path
AbstractDCS.get_citus_coordinator()
AbstractDCS.get_cluster()
AbstractDCS.history_path
AbstractDCS.initialize()
AbstractDCS.initialize_path
AbstractDCS.is_citus_coordinator()
AbstractDCS.last_seen
AbstractDCS.leader_optime_path
AbstractDCS.leader_path
AbstractDCS.loop_wait
AbstractDCS.manual_failover()
AbstractDCS.member_path
AbstractDCS.members_path
AbstractDCS.reload_config()
AbstractDCS.reset_cluster()
AbstractDCS.set_config_value()
AbstractDCS.set_failover_value()
AbstractDCS.set_history_value()
AbstractDCS.set_retry_timeout()
AbstractDCS.set_sync_state_value()
AbstractDCS.set_ttl()
AbstractDCS.status_path
AbstractDCS.sync_path
AbstractDCS.sync_state()
AbstractDCS.take_leader()
AbstractDCS.touch_member()
AbstractDCS.ttl
AbstractDCS.update_leader()
AbstractDCS.watch()
AbstractDCS.write_failsafe()
AbstractDCS.write_leader_optime()
AbstractDCS.write_status()
AbstractDCS.write_sync_state()
Cluster
Cluster.empty()
Cluster.get_clone_member()
Cluster.get_member()
Cluster.get_my_slot_name_on_primary()
Cluster.get_replication_slots()
Cluster.has_member()
Cluster.has_permanent_logical_slots()
Cluster.is_empty()
Cluster.is_unlocked()
Cluster.leader_name
Cluster.min_version
Cluster.should_enforce_hot_standby_feedback()
Cluster.timeline
Cluster.use_slots
ClusterConfig
Failover
Leader
Member
RemoteMember
ReturnFalseException
SyncState
TimelineHistory
catch_return_false_exception()
dcs_modules()
find_dcs_class_in_module()
get_dcs()
iter_dcs_classes()
parse_connection_string()
slot_name_from_member_name()
- Submodules
- patroni.postgresql package
- Submodules
- patroni.postgresql.bootstrap module
- patroni.postgresql.callback_executor module
- patroni.postgresql.cancellable module
- patroni.postgresql.citus module
- patroni.postgresql.config module
- patroni.postgresql.connection module
- patroni.postgresql.misc module
- patroni.postgresql.postmaster module
- patroni.postgresql.rewind module
- patroni.postgresql.slots module
- patroni.postgresql.sync module
- patroni.postgresql.validator module
- Module contents
Postgresql
Postgresql.POSTMASTER_START_TIME
Postgresql.TL_LSN
Postgresql.available_gucs
Postgresql.call_nowait()
Postgresql.callback
Postgresql.can_create_replica_without_replication_connection()
Postgresql.cb_called
Postgresql.check_for_startup()
Postgresql.check_startup_state_changed()
Postgresql.checkpoint()
Postgresql.cluster_info_query
Postgresql.configure_server_parameters()
Postgresql.connection()
Postgresql.controldata()
Postgresql.create_replica_methods
Postgresql.data_dir
Postgresql.data_directory_empty()
Postgresql.database
Postgresql.enforce_hot_standby_feedback
Postgresql.ensure_major_version_is_known()
Postgresql.follow()
Postgresql.get_guc_value()
Postgresql.get_history()
Postgresql.get_major_version()
Postgresql.get_postgres_role_from_data_directory()
Postgresql.get_primary_timeline()
Postgresql.get_replica_timeline()
Postgresql.get_replication_connection_cursor()
Postgresql.global_config
Postgresql.handle_parameter_change()
Postgresql.initdb()
Postgresql.is_healthy()
Postgresql.is_leader()
Postgresql.is_running()
Postgresql.is_starting()
Postgresql.last_operation()
Postgresql.latest_checkpoint_location()
Postgresql.lsn_name
Postgresql.major_version
Postgresql.move_data_directory()
Postgresql.parse_wal_record()
Postgresql.pending_restart
Postgresql.pg_control_exists()
Postgresql.pg_control_timeline()
Postgresql.pg_ctl()
Postgresql.pg_isready()
Postgresql.pg_stat_replication()
Postgresql.pg_tblspc_realpaths()
Postgresql.pg_wal_realpath()
Postgresql.pgcommand()
Postgresql.postmaster_start_time()
Postgresql.primary_conninfo()
Postgresql.primary_slot_name()
Postgresql.promote()
Postgresql.query()
Postgresql.received_location()
Postgresql.received_timeline()
Postgresql.reload()
Postgresql.reload_config()
Postgresql.remove_data_directory()
Postgresql.replay_paused()
Postgresql.replayed_location()
Postgresql.replica_cached_timeline()
Postgresql.replica_method_can_work_without_replication_connection()
Postgresql.replica_method_options()
Postgresql.replication_state()
Postgresql.replication_state_from_parameters()
Postgresql.reset_cluster_info_state()
Postgresql.restart()
Postgresql.resume_wal_replay()
Postgresql.role
Postgresql.schedule_sanity_checks_after_pause()
Postgresql.server_version
Postgresql.set_connection_kwargs()
Postgresql.set_enforce_hot_standby_feedback()
Postgresql.set_pending_restart()
Postgresql.set_role()
Postgresql.set_state()
Postgresql.slots()
Postgresql.start()
Postgresql.state
Postgresql.stop()
Postgresql.supports_multiple_sync
Postgresql.synchronous_commit()
Postgresql.synchronous_standby_names()
Postgresql.sysid
Postgresql.terminate_postmaster()
Postgresql.terminate_starting_postmaster()
Postgresql.time_in_state()
Postgresql.timeline_wal_position()
Postgresql.wait_for_port_open()
Postgresql.wait_for_startup()
Postgresql.wal_dir
Postgresql.wal_name
Postgresql.waldump()
null_context()
- Submodules
- patroni.scripts package
- patroni.watchdog package
Submodules¶
- patroni.api module
RestApiHandler
RestApiHandler.do_DELETE_restart()
RestApiHandler.do_DELETE_switchover()
RestApiHandler.do_GET()
RestApiHandler.do_GET_cluster()
RestApiHandler.do_GET_config()
RestApiHandler.do_GET_failsafe()
RestApiHandler.do_GET_history()
RestApiHandler.do_GET_liveness()
RestApiHandler.do_GET_metrics()
RestApiHandler.do_GET_patroni()
RestApiHandler.do_GET_readiness()
RestApiHandler.do_HEAD()
RestApiHandler.do_OPTIONS()
RestApiHandler.do_PATCH_config()
RestApiHandler.do_POST_citus()
RestApiHandler.do_POST_failover()
RestApiHandler.do_POST_failsafe()
RestApiHandler.do_POST_reinitialize()
RestApiHandler.do_POST_reload()
RestApiHandler.do_POST_restart()
RestApiHandler.do_POST_sigterm()
RestApiHandler.do_POST_switchover()
RestApiHandler.do_PUT_config()
RestApiHandler.get_postgresql_status()
RestApiHandler.handle_one_request()
RestApiHandler.is_failover_possible()
RestApiHandler.log_message()
RestApiHandler.parse_request()
RestApiHandler.parse_schedule()
RestApiHandler.poll_failover_result()
RestApiHandler.query()
RestApiHandler.write_response()
RestApiServer
RestApiServer.check_access()
RestApiServer.check_auth_header()
RestApiServer.check_basic_auth_key()
RestApiServer.daemon_threads
RestApiServer.get_certificate_serial_number()
RestApiServer.handle_error()
RestApiServer.process_request_thread()
RestApiServer.query()
RestApiServer.reload_config()
RestApiServer.reload_local_certificate()
RestApiServer.shutdown_request()
check_access()
- patroni.async_executor module
- patroni.collections module
- patroni.config module
Config
GlobalConfig
GlobalConfig.check_mode()
GlobalConfig.get()
GlobalConfig.get_int()
GlobalConfig.get_standby_cluster_config()
GlobalConfig.is_paused
GlobalConfig.is_standby_cluster
GlobalConfig.is_synchronous_mode
GlobalConfig.is_synchronous_mode_strict
GlobalConfig.maximum_lag_on_failover
GlobalConfig.maximum_lag_on_syncnode
GlobalConfig.min_synchronous_nodes
GlobalConfig.primary_start_timeout
GlobalConfig.primary_stop_timeout
GlobalConfig.synchronous_node_count
default_validator()
get_global_config()
- patroni.ctl module
PatroniCtlException
PatronictlPrettyTable
apply_config_changes()
apply_yaml_file()
check_response()
confirm_members_action()
format_config_for_editing()
format_pg_version()
generate_topology()
get_all_members()
get_all_members_leader_first()
get_any_member()
get_cluster_service_info()
get_cursor()
get_dcs()
get_members()
invoke_editor()
load_config()
output_members()
parse_dcs()
parse_scheduled()
print_output()
query_member()
request_patroni()
show_diff()
temporary_file()
timestamp()
toggle_pause()
topology_sort()
wait_until_pause_is_applied()
watching()
- patroni.daemon module
- patroni.exceptions module
- patroni.file_perm module
- patroni.ha module
Failsafe
Ha
Ha.acquire_lock()
Ha.bootstrap()
Ha.bootstrap_standby_leader()
Ha.call_failsafe_member()
Ha.cancel_initialization()
Ha.check_failsafe_topology()
Ha.check_timeline()
Ha.clone()
Ha.delete_future_restart()
Ha.demote()
Ha.enforce_follow_remote_member()
Ha.enforce_primary_role()
Ha.evaluate_scheduled_restart()
Ha.failsafe_is_active()
Ha.fetch_node_status()
Ha.fetch_nodes_statuses()
Ha.follow()
Ha.future_restart_scheduled()
Ha.get_effective_tags()
Ha.get_failover_candidates()
Ha.get_remote_member()
Ha.handle_long_action_in_progress()
Ha.handle_starting_instance()
Ha.has_lock()
Ha.is_failover_possible()
Ha.is_failsafe_mode()
Ha.is_healthiest_node()
Ha.is_lagging()
Ha.is_leader()
Ha.is_paused()
Ha.is_standby_cluster()
Ha.is_sync_standby()
Ha.is_synchronous_mode()
Ha.load_cluster_from_dcs()
Ha.manual_failover_process_no_leader()
Ha.notify_citus_coordinator()
Ha.post_bootstrap()
Ha.post_recover()
Ha.primary_stop_timeout()
Ha.process_healthy_cluster()
Ha.process_manual_failover_from_leader()
Ha.process_sync_replication()
Ha.process_unhealthy_cluster()
Ha.recover()
Ha.reinitialize()
Ha.release_leader_key_voluntarily()
Ha.restart()
Ha.restart_matches()
Ha.restart_scheduled()
Ha.run_cycle()
Ha.schedule_future_restart()
Ha.set_is_leader()
Ha.set_start_timeout()
Ha.should_run_scheduled_action()
Ha.shutdown()
Ha.sysid_valid()
Ha.touch_member()
Ha.update_cluster_history()
Ha.update_failsafe()
Ha.update_lock()
Ha.wakeup()
Ha.watch()
Ha.while_not_sync_standby()
- patroni.log module
PatroniLogger
PatroniLogger.DEFAULT_FORMAT
PatroniLogger.DEFAULT_LEVEL
PatroniLogger.DEFAULT_MAX_QUEUE_SIZE
PatroniLogger.DEFAULT_TRACEBACK_LEVEL
PatroniLogger.LOGGING_BROKEN_EXIT_CODE
PatroniLogger.NORMAL_LOG_QUEUE_SIZE
PatroniLogger.queue_size
PatroniLogger.records_lost
PatroniLogger.reload_config()
PatroniLogger.run()
PatroniLogger.shutdown()
PatroniLogger.update_loggers()
ProxyHandler
QueueHandler
debug_exception()
error_exception()
- patroni.psycopg module
- patroni.raft_controller module
- patroni.request module
- patroni.utils module
Retry
RetryFailedError
cluster_as_json()
compare_values()
convert_to_base_unit()
data_directory_is_empty()
deep_compare()
enable_keepalive()
is_subpath()
iter_response_objects()
keepalive_intvl()
keepalive_socket_options()
parse_bool()
parse_int()
parse_real()
patch_config()
polling_loop()
split_host_port()
strtod()
strtol()
unquote()
uri()
validate_directory()
- patroni.validator module
BinDirectory
Case
Directory
EnumValidator
IntValidator
Optional
Or
Result
Schema
assert_()
comma_separated_host_port()
data_directory_empty()
get_bin_name()
get_major_version()
is_ipv4_address()
is_ipv6_address()
validate_binary_name()
validate_connect_address()
validate_data_dir()
validate_host_port()
validate_host_port_list()
validate_host_port_listen()
validate_host_port_listen_multiple_hosts()
validate_watchdog_mode()
- patroni.version module
Module contents¶
Define general variables and functions for patroni
.
- var PATRONI_ENV_PREFIX:
prefix for Patroni related configuration environment variables.
- var KUBERNETES_ENV_PREFIX:
prefix for Kubernetes related configuration environment variables.
- var MIN_PSYCOPG2:
minimum version of
psycopg2
required by Patroni to work.
- patroni.check_psycopg(_min_psycopg2: ~typing.Tuple[int, ...] = (2, 5, 4), _parse_version: ~typing.Callable[[str], ~typing.Tuple[int, ...]] = <function parse_version>) None ¶
Ensure at least one among
psycopg2
orpsycopg
libraries are available in the environment.Note
We pass
MIN_PSYCOPG2
andparse_version()
as arguments to simplify usage ofcheck_psycopg()
from thesetup.py
.Note
Patroni chooses
psycopg2
overpsycopg
, if possible.If nothing meeting the requirements is found, then exit with a fatal message.
- Parameters:
_min_psycopg2 – minimum required version in case
psycopg2
is chosen._parse_version – function used to parse
psycopg2
/psycopg
version into a comparable object.
- patroni.fatal(string: str, *args: Any) None ¶
Write a fatal message to stderr and exit with code
1
.- Parameters:
string – message to be written before exiting.
- patroni.parse_version(version: str) Tuple[int, ...] ¶
Convert version from human-readable format to tuple of integers.
Note
Designed for easy comparison of software versions in Python.
- Parameters:
version – human-readable software version, e.g.
2.5.4
.- Returns:
tuple of version parts, each part as an integer.
- Example:
>>> parse_version('2.5.4') (2, 5, 4)