PostgreSQL两节点用keepalived实现主备的高可用架构

在这里插入图片描述

使用keepalived实现PostgreSQL数据库两节点主备的高可用架构部署详解

    • 环境配置和规划
    • 部署PostgreSQL的主备流复制架构
    • keepalived介绍
    • 安装部署keepalived
    • 数据库配置
    • 配置keepalived相关参数文件
    • 启动keepalived
    • 模拟故障切换
    • 问题记录
    • 实践建议

看腻了就来听听视频演示吧(持续更新中):https://www.bilibili.com/video/BV1K1421z7Kp/

环境配置和规划

hostnameOSPostgreSQLkeepalivedIPVIP
db06CentOS 7.916.22.2.8172.16.107.156172.16.107.159
db07CentOS 7.916.22.2.8172.16.107.157同上

部署PostgreSQL的主备流复制架构

极简步骤

echo "172.16.107.156 db06" >> /etc/hosts
echo "172.16.107.157 db07" >> /etc/hostssystemctl stop firewalld
systemctl disable firewalldsetenforce 0
sed -ri 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/configecho "postgres soft nproc unlimited" >> /etc/security/limits.conf 
echo "postgres hard nproc unlimited" >> /etc/security/limits.conf 
echo "postgres soft nofile 1024000" >> /etc/security/limits.conf 
echo "postgres hard nofile 1024000" >> /etc/security/limits.conf 
echo "postgres soft stack unlimited" >> /etc/security/limits.conf 
echo "postgres hard stack unlimited" >> /etc/security/limits.conf 
echo "postgres soft core unlimited" >> /etc/security/limits.conf 
echo "postgres hard core unlimited" >> /etc/security/limits.conf 
echo "postgres soft memlock unlimited" >> /etc/security/limits.conf 
echo "postgres hard memlock unlimited" >> /etc/security/limits.conf yum install -y gcc zlib-devel libaio libuuid readline-devel krb5-libs libicu libicu-devel libnl libnl-devel libnl-3 libnl3-devel libxslt tcl perl openldap pam openssl openssl-devel libxml2 bzip2useradd -rmU postgres
echo "postgres"|passwd postgres --stdin
su - postgres
mkdir {pghome,pgdata,pg_archive,pg_log}
chmod -R 700 {pghome,pgdata,pg_archive,pg_log}echo "export PGHOME=/home/postgres/pghome" >> ~/.bashrc
echo "export PGDATA=/home/postgres/pgdata" >> ~/.bashrc
echo "export PGPORT=54321" >> ~/.bashrc
echo "export PGDATABASE=postgres" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
echo "export PATH=$PGHOME/bin:$PATH" >> ~/.bashrc
source ~/.bashrctar -xzvf postgresql-16.2.tar.gz 
cd postgresql-16.2
./configure --prefix=/home/postgres/pghome/
gmake world
gmake install-world

主节点操作:

initdb -D /home/postgres/pgdata/ --data-checksums -E UTF8 --locale=zh_CN.UTF-8vi $PGDATA/postgresql.conflisten_addresses = '0.0.0.0'
port = '54321'
max_connections = '1024'
wal_buffers=32MB
work_mem=4MB
superuser_reserved_connections = 10
max_locks_per_transaction = '64'
max_prepared_transactions = '0'
max_replication_slots = '10'
max_wal_senders = '50'
max_worker_processes = '8'
track_commit_timestamp = 'off'
logging_collector = on
log_directory = '/home/postgres/pg_log'
log_checkpoints = on
log_lock_waits = on
log_statement = ddl
log_truncate_on_rotation = on
log_rotation_age = 1440
log_rotation_size = 40MB
wal_level = 'replica'
wal_log_hints = 'on'
idle_in_transaction_session_timeout='30min'
idle_session_timeout='30min'
hba_file = '/home/postgres/pgdata/pg_hba.conf'
ident_file = '/home/postgres/pgdata/pg_ident.conf'
# archive
archive_mode = 'on'
archive_command = 'scp %p 172.16.107.156:/home/postgres/pg_archive/%f'
archive_timeout = '1800s'
restore_command = 'scp 172.16.107.156:/home/postgres/pg_archive/%f %p'
recovery_target_timeline = 'latest'
archive_cleanup_command = 'pg_archivecleanup /home/postgres/pg_archive %r'
# replication
cluster_name = 'PGDBCluster'
hot_standby = 'on'
max_standby_streaming_delay = 30s
wal_receiver_status_interval = 10s
hot_standby_feedback = on
synchronous_commit = on
synchronous_standby_names='' # * sync; enpty async
primary_conninfo = 'application_name=pgdb01 host=172.16.107.157 port=54321 user=replicator password=replicator'vi $PGDATA/pg_hba.conf
host replication replicator 172.16.107.156/32 scram-sha-256
host replication replicator 172.16.107.157/32 scram-sha-256
host all all 0.0.0.0/0 scram-sha-256pg_ctl start
psql -U postgres -c "CREATE USER replicator REPLICATION ENCRYPTED PASSWORD 'replicator';"

备节点操作:

pg_basebackup -D $PGDATA -Fp -Xs -v -P -h 172.16.107.156 -p 54321 -U replicatorvi $PGDATA/postgresql.conf
primary_conninfo = 'application_name=pgdb02 host=172.16.107.156 port=54321 user=replicator password=replicator'echo "standby_mode = on" > $PGDATA/standby.signalpg_ctl start

主备状态查看:

pg_controldata | grep cluster# 主节点查看
select * from pg_stat_replication\gx
# 备节点查看
select * from pg_stat_wal_receiver\gx

keepalived介绍

vrrp协议的软件实现,原生设计目的就是为了高可用ipvs服务
keepalived官方文档:https://www.keepalived.org/documentation.html
功能:

  • 基于vrrp协议完成地址漂移
  • 为vip地址所在的节点生成ipvs规则(在配置文件中预先定义)
  • 为ipvs集群的各RS做健康状态检测
  • 基于脚本调用接口完成脚本中定义的功能,进而影响集群事务,以此支持nginx、haproxy等服务。

image.png

  • 用户空间核心组件:
    – vrrp stack:VIP消息通告
    – checkers:监测real server
    – system call:实现vrrp协议状态转换时调用脚本的功能
    – SMTP:邮件组件
    – IPVS wrapper:生成IPVS规则
    – Netlink Reflector:网络接口
    – WatchDog:监控进程
  • 控制组件:提供keepalived.conf的解析器,完成keepalived配置
  • IO复用器:针对网络目的而优化的自己的线程抽象
  • 内存管理组件:为某些通用的内存管理功能(例如分配,重新分配,发布等)提供访问权限

安装部署keepalived

下载keepalived: 选择最新版本
https://www.keepalived.org/download.html
image.png

安装keepalived:

# 安装依赖包
yum install -y openssl* popt-*
# 解压安装
tar -xzvf keepalived-2.2.8.tar.gz
cd keepalived-2.2.8
./configure --prefix=/usr/local/keepalived
make
make install

设置keepalived为系统服务:

ln -s /usr/local/keepalived/sbin/keepalived /usr/sbin/
cp keepalived/etc/init.d/keepalived /etc/init.d/
cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
service keepalived status

数据库配置

创建数据库和用户:

create user keepalived with password 'Test@123';
create database keepalived;
alter database keepalived owner to keepalived;

创建同步表:

\c keepalived keepalived
-- 创建表
create table sr_delay (id int, last_alive timestamp(0) without time zone default now());-- sr_delay表插入一条数据
insert into sr_delay values(1,now());

后续keepalived会每隔指定时间探测postgresql数据库存活,并且以keepalived用户登录keepalived数据库刷新这张表

配置keepalived相关参数文件

keepalived.conf文件:

mkdir -p /etc/keepalived/log/
vi /etc/keepalived/keepalived.conf! Configuration File for keepalived
global_defs {router_id DB1_PG_HA	   # 节点名,各节点不同,推荐使用主机名 
}vrrp_script check_pg_alived {script "/etc/keepalived/pg_monitor.sh"interval 10		# 脚本探测间隔,每隔10sfall 3		# 失败尝试次数
}vrrp_instance VI_1 {state BACKUPnopreempt		# 非抢占模式interface ens192 	# 网卡名virtual_router_id 10	# 虚拟路由ID,各节点配置必须一致priority 100		# 节点优先级,抢占模式与权重weight组合使用advert_int 1authentication {auth_type PASSauth_pass Test@123	# 加入集群密码,需保持一致}track_script {check_pg_alived}virtual_ipaddress {	# VIP网卡信息172.16.107.159/24 dev ens192 label ens192:vip}# 节点升主时执行的脚本notify_master /etc/keepalived/pg_active_standby.sh# 节点故障时执行的脚本#notify_fault /etc/keepalived/pg_fault.sh
}

以上是keepalived主节点配置,keepalived备节点的priority修改为90(节点优先级),其余参数配置一样。上面程序分为以下三块:

  • global_defs:通知模块,定义邮件列表,当keepalived发生事件时发送邮件
  • vrrp_script:定义本机检测模块,每10秒执行脚本pg_monitor.sh,fall表示重试3次
  • vrrp_instance:vrrp实例定义模块,定义了实例名称和实例路由ID,实例状态定义为backup,同时设置非抢占模式nopreempt,当节点启动时不会抢占VIP。备节点的priority需要设置比主节点低,这样高的会成为keepalived的主节点,同时设置了VIP,使用的网络设备是ens192。
    – notify_master:当keepalived角色从备转成主时触发脚本
    – notify_fault:当keepalived角色发生故障时执行的脚本

监控pg_monitor.sh文件:

vi /etc/keepalived/pg_monitor.sh#!/bin/bash# env setting
export PGPORT=54321
export PGUSER=keepalived
export PGDBNAME=keepalived
export PGDATA=/home/postgres/pgdata
export LANG=en_US.utf8
export PGHOME=/home/postgres/pghome
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib
export PATH=$PGHOME/bin:$PATH:MONITOR_LOG="/etc/keepalived/log/pg_monitor.log"
SQL1="update sr_delay set last_alive=now();"
SQL2='select 1;'# 脚本不检查备库存活状态,如果是备库直接退出
standby_flg=`psql -p $PGPORT -U postgres -At -c "select pg_is_in_recovery();"`
if [ ${standby_flg} == 't' ]; thenecho -e "`date +%F\ %T`: This is a standby database, exit!\n" >> $MONITOR_LOGexit 0
fi# 主库更新sr_delay表
psql -At -d $PGDBNAME -p $PGPORT -U $PGUSER -c "$SQL2"
if [ $? -eq 0 ]; thenecho $SQL1 | psql -At -d $PGDBNAME -p $PGPORT -U $PGUSERecho -e "`date +%F\ %T`: Primary db is health." >> $MONITOR_LOGexit 0
elseecho -e "`date +%F\ %T`: Attention: Primary db is not health." >> $MONITOR_LOGexit 1
fi

切换pg_avtive_standby.sh脚本文件:
发生failover故障切换脚本内容

vi /etc/keepalived/pg_active_standby.sh
#!/bin/bash#env setting
export PGPORT=54321
export PGUSER=keepalived
export PG_OS_USER=postgres
export PGDBNAME=keepalived
export PGDATA=/home/postgres/pgdata
export LANG=en_US.utf8
export PGHOME=/home/postgres/pghome
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib
export PATH=$PGHOME/bin:$PATH:.# variables setting
LAG_MINUTES=60
HOST_IP=`hostname -i`
NOTICE_EMAIL="xxoo@qq.com"
FAILOVE_LOG="/etc/keepalived/log/pg_failover.log"SQL1="select 'this_is_standby' as cluster_role from (select pg_is_in_recovery() as std ) t where t.std is true;"
SQL2="select 'standby_in_allowed_lag' as cluster_lag from sr_delay where now() - last_alive < interval '$LAG_MINUTES SECONDS';"# 配置对端远程管理卡ip地址、用户名、密码
FENCE_IP=172.16.107.157
FENCE_USER=root
FENCE_PWD=root# VIP 发生漂移,纪录到日志
echo -e "`date +%F\ %T`: keepalived VIP switchover!" >> $FAILOVE_LOG# pg_failover函数,当主库故障时激活
pg_failover()
{su - $PG_OS_USER -c "pg_ctl promote -D ${PGDATA}"
if [ $? -eq 0 ]; thenecho -e "`date +%F\ %T`: `hostname` promote standby success." >> $FAILOVE_LOG
fi}# 检查备库是否正常
STANDBY_CNT=`echo $SQL1 | psql -At -d $PGDBNAME -p $PGPORT -U $PGUSER -f - | grep -c this_is_standby`
echo -e "STANDBY_CNT: $STANDBY_CNT" >> $FAILOVE_LOGif [ $STANDBY_CNT -ne 1 ]; thenecho -e "`date +%F\ %T`: `hostname` is not standby database, failover not allow!" >> $FAILOVE_LOGexit 1
fiif [ $STANDBY_CNT -eq 1 ]; thenpg_failover  >> $FAILOVE_LOG
fi

脚本授权:

chmod +x /etc/keepalived/pg_*.sh

启动keepalived

service keepalived start

模拟故障切换

# 主节点
pg_ctl stop
# 观察日志打印信息和VIP的漂移情况
tail -20f /etc/keepalived/log/pg_monitor.log
tail -20f /etc/keepalived/log/pg_failover.log
ip a
# 原主节点已新备节点加入新集群
echo "standby_mode = on" > $PGDATA/standby.signal
pg_ctl start

问题记录

问题一:节点健康语句检查返回

# 问题返回:$? 只保存上一个命令的退出状态,0成功,1失败
echo 'select 1;' | psql -At -p 54321 -U keepalived -d keepalived
echo $?
echo 'select 1 from dual;' | psql -At -p 54321 -U keepalived -d keepalived
echo $?
# 推荐使用
psql -At -p 54321 -U keepalived -d keepalived -c "select 1;"
echo $?
psql -At -p 54321 -U keepalived -d keepalived -c "select 1 from dual;"
echo $?

问题二:Keepalived默认参数配置路径
Keepalived默认的配置文件路径在:/etc/keepalived/keepalived.conf
Keepalived默认的日志文件保存在OS日志:/var/log/messages

[root@db06 ~]# cat /usr/local/keepalived/etc/sysconfig/keepalived 
# Options for keepalived. See `keepalived --help' output and keepalived(8) and
# keepalived.conf(5) man pages for a list of all options. Here are the most
# common ones :
#
# --vrrp               -P    Only run with VRRP subsystem.
# --check              -C    Only run with Health-checker subsystem.
# --dont-release-vrrp  -V    Dont remove VRRP VIPs & VROUTEs on daemon stop.
# --dont-release-ipvs  -I    Dont remove IPVS topology on daemon stop.
# --dump-conf          -d    Dump the configuration data.
# --log-detail         -D    Detailed log messages.
# --log-facility       -S    0-7 Set local syslog facility (default=LOG_DAEMON)
#KEEPALIVED_OPTIONS="-D"

“-D”:输出日志的选项
-f:修改默认配置文件路径
-S:修改日志文件的默认路径,-S 0 表示local0.* 具体路径看/etc/rsyslog.conf文件配置

vi /usr/local/keepalived/etc/sysconfig/keepalived
KEEPALIVED_OPTIONS="-f /etc/keepalived/keepalived.conf -D -S 0"echo "local0.* /etc/keepalived/log/keepalived.log" >> /etc/rsyslog.conf
systemctl restart rsyslog
systemctl restart keepalived

image.png

问题三:Keepalived主节点故障发生漂移
Keepalived主节点故障,此时VIP会发生漂移,备库会被提升为主库,此时数据库会出现双主现象

# 模拟主节点故障
systemctl stop keepalived
# 若此时停原主库当备库重新加入集群会失败
pg_ctl stop
echo "standby_mode = on" > $PGDATA/standby.signal
pg_ctl start
# 数据库日志打印报错消息
2024-04-22 15:11:02.412 CST [8653] FATAL:  could not start WAL streaming: ERROR:  requested starting point 0/8A000000 on timeline 4 is not in this server's historyDETAIL:  This server's history forked from timeline 4 at 0/89028940.
2024-04-22 15:11:03.015 CST [8467] LOG:  new timeline 5 forked off current database system timeline 4 before current recovery point 0/8A0000A0
# 此时可以查看数据库的时间线,发现当新的备库时间线确实与新主库不一致
pg_controldata | grep TimeLineID
# 可用pg_rewind来同步时间线
pg_ctl stop
[postgres@db07 ~]$ pg_rewind --target-pgdata=/home/postgres/pgdata --source-server='host=172.16.107.156 port=54321 user=postgres dbname=postgres password=postgres'
pg_rewind: servers diverged at WAL location 0/89028940 on timeline 4
pg_rewind: rewinding from last common checkpoint at 0/89027978 on timeline 4
pg_rewind: Done!
# 修复后调整最后一行流复制的参数配置再重新拉起,同上面搭建备库步骤一样
vi $PGDATA/postgresql.conf 
primary_conninfo = 'application_name=pgdb02 host=172.16.107.156 port=54321 user=replicator password=replicator'echo "standby_mode = on" > $PGDATA/standby.signal
pg_ctl start

pg_rewind使用要求目标服务器:

  • wal_log_hints=on
  • full_page_writes=on
  • initdb初始化库时启用了数据校验(checksums)

问题四:数据库编译时报错
数据库编译时缺少icu依赖

# 处理方式一:安装icu依赖
yum install -y libicu libicu-devel 
# 处理方式二:指定不编译icu模块
./configure --prefix=/home/postgres/pghome/ --without-icu

image.png

问题五:keepalive编译时报错
keepalive编译时告警缺少icu依赖libnl依赖

# 处理方式一:安装libnl依赖
yum install -y libnl libnl-devel libnl-3 libnl3-devel
# 处理方式二:忽略,IPV6的相关功能,影响不大!

libnlwarning.png

实践建议

  • 配置SMTP邮件告警:
    https://www.modb.pro/db/1785122224978071552
  • 做好备份冗余

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

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Java 多线程(八)—— 锁策略,synchronized 的优化,JVM 与编译器的锁优化,ReentrantLock,CAS

前言 本文为 Java 面试小八股&#xff0c;一句话&#xff0c;理解性记忆&#xff0c;不能理解就死背吧。 锁策略 悲观锁与乐观锁 悲观锁和乐观锁是锁的特性&#xff0c;并不是特指某个具体的锁。 我们知道在多线程中&#xff0c;锁是会被竞争的&#xff0c;悲观锁就是指锁…

LSTM反向传播及公式推导

先回顾一下正向传播的公式: 化简一下: 反向传播从下到上逐步求偏导: 对zt求偏导(预测值和标签值相减): zt对未知数wt,ht,bt分别求偏导: ht对ot,Ct求偏导: ot对Net0求偏导: Net0对w0,b0求偏导: .... 总体的思路就是那个公式从下到上逐步对未知数求偏导: 下面是总体的流程…

Flutter项目打包ios, Xcode 发布报错 Module‘flutter barcode_scanner‘not found

报错图片 背景 flutter 开发的 apple app 需要发布新版本&#xff0c;但是最后一哆嗦碰到个报错&#xff0c;这个小问题卡住了我一天&#xff0c;之间的埪就不说了&#xff0c;直接说我是怎么解决的&#xff0c;满满干货 思路 这个报错 涉及到 flutter_barcode_scanner; 所…

微信小程序性能优化 ==== 合理使用 setData 纯数据字段

目录 1. setData 的流程 2. 数据通信 3. 使用建议 3.1 data 应只包括渲染相关的数据 3.2 控制 setData 的频率 3.3 选择合适的 setData 范围 3.4 setData 应只传发生变化的数据 3.5 控制后台态页面的 setData 纯数据字段 组件数据中的纯数据字段 组件属性中的纯数据…

Java.6--多态-设计模式-抽象父类-抽象方法

一、多态 1.定义--什么是多态&#xff1f; a.同一个父类的不同子类对象&#xff0c;在做同一行为的时候&#xff0c;有不同的表现形式&#xff0c;这就是多态。&#xff08;总结为&#xff1a;一个父类下的不同子类&#xff0c;同一行为&#xff0c;不同表现形式。&#xff0…

springboot3.x.x 集成 连接SQL Server 2008 驱动版本和SSL套接字问题的解决

驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version TLS10 is not accepted by client 依赖版本 <dependency><groupId>com.microsoft.sqlserver</groupId><artifactId>mssql-jdbc&…

ABAP 函数

1、基础语句注意事项 1.1基础 SE38编辑 SM30 数据库表中添加多条数据 SE91编辑消息类 SE11查看数据库表 SE16N主要查看数据 1.2语句 1.FOR ALL ENTRIES IN 对于不能使用join的聚集表或者需要使用SELECT 的内表&#xff0c;我们一般使用for all entries in 语句将该表…

虚拟机安装麒麟v10、配置网络、安装docker

一、虚拟机安装麒麟v10 1、下载iso&#xff08;https://www.kylinos.cn/support/trial.html&#xff09; 2、虚拟机安装 3、选择 4、设置开机自动连接网络 参考地址&#xff1a;https://www.cnblogs.com/goding/p/18283912 安装好后发现屏幕分辨率毕竟低&#xff0c;点设置分…

开源模型应用落地-LangChain实用小技巧-带阈值的相似性搜索(十五)

一、前言 带阈值的相似性搜索是一种非常实用的信息检索方法。它允许用户设定一个具体的相似度标准&#xff0c;从而提升搜索结果的相关性和准确性。在面对大规模数据时&#xff0c;传统的相似性搜索往往难以满足用户的需求&#xff0c;因为返回的结果可能包含很多不相干的信息。…

数字图像处理的概念(一)

一 何谓数字图像处理 1 图像的概念 图像是对客观存在的物体的一种相似性的、生动的写真或描述。 2 图像的类别 可见光成像和不可见光成像 单波段、多波段和超波段图像 伽马射线成像 主要用途包括核 医学和天文观测 等 。 核医学 a)同位素注射 骨骼扫描图像 b)正电子放射( …

华为“纯血鸿蒙”重磅发布!首次融入原生AI能力

华为成功举办“原生鸿蒙之夜暨全场景新品发布会”&#xff0c;会上隆重宣布&#xff1a;我国首个自主研发的移动操作系统——华为原生鸿蒙操作系统HarmonyOS NEXT正式面世&#xff0c;标志着鸿蒙历史上的一次重大飞跃&#xff0c;至此&#xff0c;鸿蒙系统已成为继苹果iOS与安卓…

算法革新决定未来!深挖数字北极星3.0背后的技术逻辑

2023年9月22日,望繁信科技首届PRO_大会在广州圆满举行,望繁信科技联合创始人&CTO李进峰博士在大会主论坛带来了《再突破——流程挖掘算法的革新和调优》的精彩分享,向大家详细介绍了数字北极星3.0以及流程资产等新功能背后的核心技术。 创新流程资产挖掘图算法 为中国企…

Flutter 状态管理框架Get

状态管理框架 Get的使用 目录 状态管理框架 Get的使用 GetMaterialApp 路由的注册 路由的跳转 middlewares的使用 组件使用 defaultDialog bottomSheet snackbar 状态刷新有很多种方式 ValueBuilder Obx 基础使用 是时候引入GetxController, 也是Get里面的常用的 G…

OpenCV与AI深度学习 | 实战 | OpenCV中更稳更快的找圆方法--EdgeDrawing使用演示(详细步骤 + 代码)

本文来源公众号“OpenCV与AI深度学习”&#xff0c;仅用于学术分享&#xff0c;侵权删&#xff0c;干货满满。 原文链接&#xff1a;实战 | OpenCV中更稳更快的找圆方法--EdgeDrawing使用演示&#xff08;详细步骤 代码&#xff09; 导 读 本文主要介绍如何在OpenCV中使用E…

pycharm 中提示ModuleNotFoundError: No module named ‘distutils‘

在Pycharm 中的命令行中输入 pip install setuptools&#xff0c;即可解决

K8S测试pod内存和CPU资源不足

只设置requests参数 mysql主从pod启动后监控 读压测之后 同时设置limits和requests&#xff0c;只调低内存值 监控 压力测试 同时设置limits和requests&#xff0c;只调低CPU值 初始状态 开始压测 结论 对于CPU&#xff0c;如果pod中服务使用CPU超过设置的limits&…

(小白教程)MPV.NET 播放器安装和添加插件脚本Bilibili弹幕

MPV.NET安装和添加插件脚本 MPV跨平台播放器&#xff1a;该播放器基于流行的mpv媒体播放器。mpv.net 设计为与 mpv 兼容&#xff0c;几乎所有 mpv 功能都可用&#xff0c;这意味着官方mpv 手册适用于 mpv.net&#xff0c;差异记录在mpv.net 手册中。 主要差异是mpv.net为MPV添加…

Linux 字符设备驱动 之 无法归类的《杂项设备驱动》

学习目标&#xff1a; 了解 杂项设备驱动 和普通字符设备的异同&#xff0c;及杂项设备驱动程序的写法 学习内容&#xff1a; 一、杂项设备驱动的特别之处 杂项设备&#xff08;Miscellaneous Devices&#xff09;是一种通用的设备类型&#xff0c;用于表示那些不适合其他设备…

基于springboot企业微信SCRM管理系统源码带本地搭建教程

系统是前后端分离的架构&#xff0c;前端使用Vue2&#xff0c;后端使用SpringBoot2。 技术框架&#xff1a;SpringBoot2.0.0 Mybatis1.3.2 Shiro swagger-ui jpa lombok Vue2 Mysql5.7 运行环境&#xff1a;jdk8 IntelliJ IDEA maven 宝塔面板 系统与功能介绍 基…

ubuntu 安装haproxy

####安装##### sudo apt update sudo apt install haproxy sudo haproxy -v sudo systemctl status haproxy sudo cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg-org####配置站点##### nano /etc/haproxy/haproxy.cfgfrontend www-httpbind *:5001mode httpdefault_ba…