patroni高可用测试

news2024/11/16 1:52:31

pkill postgres

在这里插入图片描述

主库日志

2024-09-25 16:42:30,579 INFO: no action. I am (postgres-1a86e6d5-0-0), the leader with the lock
2024-09-25 16:42:40,577 INFO: no action. I am (postgres-1a86e6d5-0-0), the leader with the lock
2024-09-25 16:42:50,578 INFO: no action. I am (postgres-1a86e6d5-0-0), the leader with the lock
2024-09-25 16:42:58,823 ERROR: get_postgresql_status
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/patroni/api.py", line 745, in query
    cursor.execute(sql, params)
psycopg2.OperationalError: terminating connection due to administrator command
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/patroni/api.py", line 673, in get_postgresql_status
    row = self.query(stmt.format(postgresql.wal_name, postgresql.lsn_name), retry=retry)[0]
  File "/usr/local/lib/python3.6/site-packages/patroni/api.py", line 655, in query
    return self.server.query(sql, *params)
  File "/usr/local/lib/python3.6/site-packages/patroni/api.py", line 750, in query
    raise PostgresConnectionException('connection problems')
patroni.exceptions.PostgresConnectionException: 'connection problems'
2024-09-25 16:42:58,835 ERROR: get_postgresql_status
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/patroni/api.py", line 744, in query
    with self.patroni.postgresql.connection().cursor() as cursor:
  File "/usr/local/lib/python3.6/site-packages/patroni/postgresql/__init__.py", line 282, in connection
    return self._connection.get()
  File "/usr/local/lib/python3.6/site-packages/patroni/postgresql/connection.py", line 24, in get
    self._connection = psycopg.connect(**self._conn_kwargs)
  File "/usr/local/lib/python3.6/site-packages/patroni/psycopg.py", line 42, in connect
    ret = _connect(*args, **kwargs)
  File "/usr/lib64/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/patroni/api.py", line 673, in get_postgresql_status
    row = self.query(stmt.format(postgresql.wal_name, postgresql.lsn_name), retry=retry)[0]
  File "/usr/local/lib/python3.6/site-packages/patroni/api.py", line 655, in query
    return self.server.query(sql, *params)
  File "/usr/local/lib/python3.6/site-packages/patroni/api.py", line 750, in query
    raise PostgresConnectionException('connection problems')
patroni.exceptions.PostgresConnectionException: 'connection problems'
2024-09-25 16:43:00,468 WARNING: Postgresql is not running.
2024-09-25 16:43:00,469 INFO: Lock owner: postgres-1a86e6d5-0-0; I am postgres-1a86e6d5-0-0
2024-09-25 16:43:00,522 INFO: Reaped pid=6013, exit status=0
2024-09-25 16:43:00,523 INFO: pg_controldata:
  pg_control version number: 1300
  Catalog version number: 202107181
  Database system identifier: 7414692467597594783
  Database cluster state: shut down
  pg_control last modified: Wed Sep 25 16:42:57 2024
  Latest checkpoint location: 0/20000028
  Latest checkpoint's REDO location: 0/20000028
  Latest checkpoint's REDO WAL file: 000000040000000000000020
  Latest checkpoint's TimeLineID: 4
  Latest checkpoint's PrevTimeLineID: 4
  Latest checkpoint's full_page_writes: on
  Latest checkpoint's NextXID: 0:753
  Latest checkpoint's NextOID: 16426
  Latest checkpoint's NextMultiXactId: 1
  Latest checkpoint's NextMultiOffset: 0
  Latest checkpoint's oldestXID: 727
  Latest checkpoint's oldestXID's DB: 1
  Latest checkpoint's oldestActiveXID: 0
  Latest checkpoint's oldestMultiXid: 1
  Latest checkpoint's oldestMulti's DB: 1
  Latest checkpoint's oldestCommitTsXid: 0
  Latest checkpoint's newestCommitTsXid: 0
  Time of latest checkpoint: Wed Sep 25 16:42:57 2024
  Fake LSN counter for unlogged rels: 0/3E8
  Minimum recovery ending location: 0/0
  Min recovery ending loc's timeline: 0
  Backup start location: 0/0
  Backup end location: 0/0
  End-of-backup record required: no
  wal_level setting: logical
  wal_log_hints setting: on
  max_connections setting: 200
  max_worker_processes setting: 8
  max_wal_senders setting: 10
  max_prepared_xacts setting: 0
  max_locks_per_xact setting: 64
  track_commit_timestamp setting: off
  Maximum data alignment: 8
  Database block size: 8192
  Blocks per segment of large relation: 131072
  WAL block size: 8192
  Bytes per WAL segment: 16777216
  Maximum length of identifiers: 64
  Maximum columns in an index: 32
  Maximum size of a TOAST chunk: 1996
  Size of a large-object chunk: 2048
  Date/time type storage: 64-bit integers
  Float8 argument passing: by value
  Data page checksum version: 0
  Mock authentication nonce: 31aae6ace80398a228c491656c26444d30ed617352f69068801256c575fd21c3

2024-09-25 16:43:00,524 INFO: Lock owner: postgres-1a86e6d5-0-0; I am postgres-1a86e6d5-0-0
2024-09-25 16:43:00,592 INFO: starting as readonly because i had the session lock
2024-09-25 16:43:00.918 CST [6019] LOG:  pgaudit extension initialized
2024-09-25 16:43:00,927 INFO: postmaster pid=6019
/tmp:5432 - no response
2024-09-25 16:43:00.965 CST [6019] LOG:  redirecting log output to logging collector process
2024-09-25 16:43:00.965 CST [6019] HINT:  Future log output will appear in directory "/pglog".
/tmp:5432 - accepting connections
/tmp:5432 - accepting connections
Wed Sep 25 16:43:01 CST 2024 INFO: on_role_change callback called (action=on_role_change role=replica cluster=postgres-1a86e6d5)
2024-09-25 16:43:02,015 INFO: Lock owner: postgres-1a86e6d5-0-0; I am postgres-1a86e6d5-0-0
2024-09-25 16:43:02,016 INFO: establishing a new patroni connection to the postgres cluster
server signaled
2024-09-25 16:43:02,194 INFO: promoted self to leader because I had the session lock
Wed Sep 25 16:43:02 CST 2024 INFO: pre promote script called
2024-09-25 16:43:02,218 INFO: pre_promote script `/opt/crunchy/bin/postgres-ha/callbacks/pgha-pre-promote.sh` exited with 0
server promoting
2024-09-25 16:43:02,223 INFO: cleared rewind state after becoming the leader
Wed Sep 25 16:43:02 CST 2024 INFO: on_role_change callback called (action=on_role_change role=master cluster=postgres-1a86e6d5)
Wed Sep 25 16:43:02 CST 2024 INFO: New primary still in recovery, waiting one second...
2024-09-25 16:43:03,268 INFO: Lock owner: postgres-1a86e6d5-0-0; I am postgres-1a86e6d5-0-0
2024-09-25 16:43:03,324 INFO: Reaped pid=6433, exit status=0
2024-09-25 16:43:03,450 INFO: no action. I am (postgres-1a86e6d5-0-0), the leader with the lock
2024-09-25 16:43:13,768 INFO: Lock owner: postgres-1a86e6d5-0-0; I am postgres-1a86e6d5-0-0
2024-09-25 16:43:13,820 INFO: Assigning synchronous standby status to ['postgres-1a86e6d5-1-0']
server signaled
2024-09-25 16:43:15,982 INFO: Synchronous standby status assigned to ['postgres-1a86e6d5-1-0']
2024-09-25 16:43:16,048 INFO: no action. I am (postgres-1a86e6d5-0-0), the leader with the lock
2024-09-25 16:43:23,881 INFO: no action. I am (postgres-1a86e6d5-0-0), the leader with the lock
2024-09-25 16:43:33,878 INFO: no action. I am (postgres-1a86e6d5-0-0), the leader with the lock
2024-09-25 16:43:43,877 INFO: no action. I am (postgres-1a86e6d5-0-0), the leader with the lock

备库日志

2024-09-25 16:42:50,592 INFO: no action. I am (postgres-1a86e6d5-1-0), a secondary, and following a leader (postgres-1a86e6d5-0-0)
2024-09-25 16:43:00,601 INFO: no action. I am (postgres-1a86e6d5-1-0), a secondary, and following a leader (postgres-1a86e6d5-0-0)
2024-09-25 16:43:02,138 INFO: no action. I am (postgres-1a86e6d5-1-0), a secondary, and following a leader (postgres-1a86e6d5-0-0)
2024-09-25 16:43:03,428 INFO: no action. I am (postgres-1a86e6d5-1-0), a secondary, and following a leader (postgres-1a86e6d5-0-0)
2024-09-25 16:43:13,896 INFO: no action. I am (postgres-1a86e6d5-1-0), a secondary, and following a leader (postgres-1a86e6d5-0-0)
2024-09-25 16:43:23,916 INFO: no action. I am (postgres-1a86e6d5-1-0), a secondary, and following a leader (postgres-1a86e6d5-0-0)
2024-09-25 16:43:33,893 INFO: no action. I am (postgres-1a86e6d5-1-0), a secondary, and following a leader (postgres-1a86e6d5-0-0)
2024-09-25 16:43:43,900 INFO: no action. I am (postgres-1a86e6d5-1-0), a secondary, and following a leader (postgres-1a86e6d5-0-0)
2024-09-25 16:43:53,904 INFO: no action. I am (postgres-1a86e6d5-1-0), a secondary, and following a leader (postgres-1a86e6d5-0-0)

pkill patroni

在这里插入图片描述

主库日志

在这里插入图片描述
在这里插入图片描述

备库日志

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2165517.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Linux基础之文件系统

一、磁盘结构的认识 首先我们能认识到的一点是:不是所有的文件都被打开的! 大部分文件都不是被打开的(当前并不需要被访问),都在磁盘中进行保存。那么没有被(进程)打开的文件,要不要…

Python 中什么是 Mock 对象?如何在测试中使用

Python 中什么是 Mock 对象?如何在测试中使用 在软件开发中,测试是确保代码质量的重要环节。尤其是在编写单元测试时,测试的准确性和可靠性至关重要。为了确保测试的有效性,开发者通常会使用 Mock 对象。本文将详细介绍 Mock 对象…

深度学习基础案例7--马铃薯病识别,对VGG16进行轻量级优化,计算量减少了99%,但是准确率下降4%

🍨 本文为🔗365天深度学习训练营 中的学习记录博客🍖 原作者:K同学啊 前言 本来想继续优化的,但是我看论文和查阅一些资料,涉及到了知识蒸馏、量化的知识,这些知识我需要花一点时间去研究一下&…

4. 数据结构: 对象和数组

数字、布尔值和字符串是构建数据结构的原子。不过,许多类型的信息需要不止一个原子。对象允许我们对值(包括其他对象)进行分组,从而构建更复杂的结构。到目前为止,我们所构建的程序都受到限制,因为它们只能…

MyBatis 入门教程-搭建入门工程

Maven作为一个优秀的项目构建和管理工具,在日常的开发中被大多数开发者使用,后续的项目也是基于Maven来构建。 创建一个Maven项目 利用IDEA创建项目工具来创建一个Maven项目 添加MyBatis的依赖 这里可以从Maven仓库地址中进行查看, https://mvnrepository.com/ 从这里可…

SUB1G无线通信模块赋能对讲机无线联网

一、模组介绍: ANS TKM-220是一款专为LPWAN物联网应用而研制的SUB1G无线模组,使用全新的TurMassTM 技术,具有超大容量 、高速率 、广覆盖和低成本的特点,处于国际领先水平 。 二、模组特点: ◉ 采用独创的TurMass™…

Oracle 19c 使用EMCC 监控当前所有数据库

一.EMCC简介 EMCC,全称Oracle Enterprise Manager Cloud Control,是Oracle提供的一套集中化监控工具,可以对数据库、操作系统、中间件等进行监控,通过OMS(Oracle Management Service)收集监控数据并将监控信…

Golang | Leetcode Golang题解之第421题数组中两个数的最大异或值

题目: 题解: const highBit 30type trie struct {left, right *trie }func (t *trie) add(num int) {cur : tfor i : highBit; i > 0; i-- {bit : num >> i & 1if bit 0 {if cur.left nil {cur.left &trie{}}cur cur.left} else …

C# 数据校验与控件绑定

在上一篇中,写了使用特性对一个对象的值进行校验;虽然代码比较简单,但依然不是最优解,在做数据新增校验的时候,倒也没什么问题,毕竟这是WinForm;但是如果是做数据编辑,代码就会变得更…

遗忘的数学(拉格朗日乘子法、牛顿法)

目录 拉格朗日乘子法定理 证明:​编辑 应用条件与符号选择 雅可比矩阵 黑塞矩阵 牛顿法 解方程的根的牛顿法 解方程组的根的牛顿法 数值优化的牛顿法(求最值) 拉格朗日乘子法定理 证明: dSi这一段没看懂…… 应用…

“AI+Security”系列第3期(四):360安全大模型业务实践

近日,由安全极客、Wisemodel 社区、InForSec 网络安全研究国际学术论坛和海升集团联合主办的“AI Security”系列第 3 期技术沙龙:“AI 安全智能体,重塑安全团队工作范式”活动顺利举行。此次活动吸引了线上线下超过千名观众参与。 活动中&…

C++——关联式容器(5):哈希表

7.哈希表 7.1 哈希表引入 哈希表的出现依旧是为了查找方便而设计的。在顺序结构中,查询一个值需要一一比较,复杂度为O(N);在平衡树中,查询变为了二分查找,复杂度为O(logN);而对于哈希表,我们可…

BST-二叉搜索树

前言 从图的角度出发,树是一种特殊的图。图的大多数算法,树都可以适用。对树操作中,你可以发现有关图算法思想的体现。 不过, 本篇不是完全从图的角度解读树, 重点在初学者视角(一般学习数据结构顺序是从树…

码点和码元的区别--Unicode标准的【码点】和【码元】

Unicode是通用字符编码标准是计算机科学领域里的一项业界标准,包括字符集、编码方案等。 Unicode标准定义了一个统一的多语言文本字符集(即Unicode字符集)。 Unicode标准定义了三种字符编码方案:UTF-8、UTF-16、UTF-32。 因此&…

【Java面向对象高级06】static的应用知识:代码块

文章目录 前言一、代码块概述二、代码块分2种 1、静态代码块2、实例代码块总结 前言 记录static的应用知识:代码块 一、代码块概述 代码块是类的5大成分之一(成员变量,构造器,方法,代码块,内部类&#xf…

「Python教程」vscode的安装和python插件下载

粗浅之言,如有错误,欢迎指正 文章目录 前言Python安装VSCode介绍VSCode下载安装安装python插件 前言 Python目前的主流编辑器有多个,例如 Sublime Text、VSCode、Pycharm、IDLE(安装python时自带的) 等。个人认为 vscode 虽然在大型项目上有…

一个好用的MP3音乐下载网,我推荐给你(免费)

点击访问->https://www.gequbao.com/ 或用Bing搜索歌曲宝即可。 主页面长这样子~ 以最近大火的悲鸣海为例,搜索; 以第一个为例,点击; 它既支持下载.mp3格式的音乐文件,还支持下载.lrc的歌词文件。 非常好用&…

使用ChatGPT引导批判性思维,提升论文的逻辑与说服力的全过程

学境思源,一键生成论文初稿: AcademicIdeas - 学境思源AI论文写作 批判性分析(Critical Analysis) 是论文写作中提升质量和说服力的重要工具。它不仅帮助作者深入理解和评价已有研究,还能指导作者在构建自己论点时更加…

网络工程师学习笔记——网络互连与互联网(三)

TCP三次握手 建立TCP连接是通过三次握手实现的,采用三报文握手主要是为了防止已失效的连接请求报文突然又传送到了,因而产生错误 主动发起TCP连接建立的称为客户端 被动等待的为TCP服务器,二者之间需要交换三个TCP报文段 首先是客户端主动…

jQuery——对象的使用

1、理解:即执行 jQuery 核心函数返回的对象 2、jQuery 对象内部包含的是 dom 元素对象的伪数组(可能只有一个元素) 3、jQuery 对象是一个包含所有匹配的任意多个 dom 元素的伪数组对象 4、基本行为: ① size(&#xf…