postgresql双机热备、高可用方案(采用pacemaker+corosync实现)

2023-05-16


PostgreSQL高可用
需求描述
我们有两台centos7的数据库主机A、B。要对A、B实现双机热备,A作为数据库master主机,对外提供读写服务,B作为slave主机能实时同步A的数据。当A发生故障时,B从slave状态切换到master状态,以保证pg数据库能正常对外提供服务。

经过调研,最终我们给出的解决方案是采用pacemaker和corosync组件来实现postgresql的高可用。

所有部署脚本可以下github中找到:https://github.com/qinguanri/pg-ha

环境说明
操作系统centos7:
[root@10 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@10 ~]# uname -a
Linux 10.16.93.179 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

postgresql版本:9.2.15

2台主机:
角色    IP
node1    10.16.93.179
node2    10.16.93.182
- 分配2个虚IP。我们的数据库对外提供服务时,暴露的是虚IP:

vip-master: 10.16.93.180

vip-slave: 10.16.93.181

配置Linux集群环境
注意:请严格按照下文所给的顺序进行配置

1.安装Pacemaker和Corosync包
需要在所有节点执行:

$  yum install -y pacemaker pcs psmisc policycoreutils-python postgresql-server

2.禁用防火墙
在所有节点执行:

$  systemctl disable firewalld.service
$  systemctl stop firewalld.service

3.启用pcs
在所有节点执行:

$  systemctl start pcsd.service
$  systemctl enable pcsd.service
ln -s '/usr/lib/systemd/system/pcsd.service' '/etc/systemd/system/multi-user.target.wants/pcsd.service'
$ echo hacluster |  passwd hacluster --stdin
Changing password for user hacluster.
Changing password for user hacluster.
passwd: all authentication tokens updated successfully.

4.集群认证
在任何一个节点上执行,这里选择node1:

$  pcs cluster auth -u hacluster -p hacluster 10.16.93.179 10.16.93.182
10.16.93.179: Authorized
10.16.93.182: Authorized

5.同步配置
在node1上执行:

$  pcs cluster setup --last_man_standing=1 --name pgcluster 10.16.93.179 10.16.93.182
Shutting down pacemaker/corosync services...
Redirecting to /bin/systemctl stop  pacemaker.service
Redirecting to /bin/systemctl stop  corosync.service
Killing any remaining services...
Removing all cluster configuration files...
10.16.93.179: Succeeded
10.16.93.182: Succeeded

6.启动集群
在node1上执行。(有时需要稍等十几秒,才能看到命令的输出结果):

$ pcs cluster start --all
172.17.5.90: Starting Cluster...
172.17.5.91: Starting Cluster...
172.17.5.92: Starting Cluster...

7.检验
1)检验corosync

在node1上执行:

$ pcs status corosync
Membership information
----------------------
    Nodeid      Votes Name
         1          1 10.16.93.179 (local)
         2          1 10.16.93.182

2)检验pacemaker

root@10 data]# pcs status
Cluster name: pgcluster
WARNING: corosync and pacemaker node names do not match (IPs used in setup?)
Last updated: Mon Apr  4 23:45:48 2016          Last change: Fri Apr  1 09:17:03 2016 by root via crm_attribute on tsung_test
Stack: corosync
Current DC: tsung_test (version 1.1.13-10.el7_2.2-44eb2dd) - partition with quorum
2 nodes and 5 resources configured

Online: [ 10.16.93.179 tsung_test ]

Full list of resources:

 Master/Slave Set: pgsql-cluster [pgsql]
     Masters: [ tsung_test ]
     Slaves: [ 10.16.93.179 ]
 Resource Group: master-group
     vip-master (ocf::heartbeat:IPaddr2):       Started tsung_test
 Resource Group: slave-group
     vip-slave  (ocf::heartbeat:IPaddr2):       Started 10.16.93.179

PCSD Status:
  10.16.93.179: Online
  tsung_test (10.16.93.182): Online

Daemon Status:
  corosync: active/disabled
  pacemaker: active/disabled
  pcsd: active/enabled

注意:当vip-master和vip-slave都是Started状态时,集群节点配置正确。否则,请检查你的配置是否有误

安装和配置PostgreSQL
1.创建数据库目录
需要在所有节点上执行:

$  mkdir -p /data/postgresql/{data,xlog_archive}
$  chown -R postgres:postgres /data/postgresql/
$  chmod 0700 /data/postgresql/data

2.初始化db
在node1上执行:

$  su - postgres
$ initdb -D /data/postgresql/data/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
fixing permissions on existing directory /data/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /data/postgresql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
    postgres -D /data/postgresql/data
or
    pg_ctl -D /data/postgresql/data -l logfile start

3.修改配置文件
在node1上执行:

$ vim /data/postgresql/data/postgresql.conf
listen_addresses = '*'
wal_level = hot_standby
synchronous_commit = on
archive_mode = on
archive_command = 'cp %p /data/postgresql/xlog_archive/%f'
max_wal_senders=5
wal_keep_segments = 32
hot_standby = on
restart_after_crash = off
replication_timeout = 5000
wal_receiver_status_interval = 2
max_standby_streaming_delay = -1
max_standby_archive_delay = -1
synchronous_commit = on
restart_after_crash = off
hot_standby_feedback = on

$ vim /data/postgresql/data/pg_hba.conf

local   all             all                      trust
host    all             all    127.0.0.1/32      trust
host    all             all    ::1/128           trust
host    all             all    10.16.0.0/16      md5
host    all             all    10.18.0.0/16      md5
host    replication     all    10.16.0.0/16      md5

注意:pg_hba.conf文件用于配置postgresql的访问控制,例如:host all all 10.16.0.0/16 md5,表示允许10.16.0.0/16网段的主机访问所有用户、所有数据库,密码使用md5密文的方式。你需要根据你的实际网段进行设置。当出现访问权限错误时,请检查你的pg_hba.conf文件

4.启动
启动数据库,创建replicator用户。将用户postgres的密码修改为postgres(pg初始安装时,postgres用户的登录密码默认为空)

在node1上执行:

$ pg_ctl -D /data/postgresql/data/ start
server starting
[    2015-10-16 08:51:31.451 UTC 53158 5620ba93.cfa6 1 0]LOG:  redirecting log output to logging collector process
[    2015-10-16 08:51:31.451 UTC 53158 5620ba93.cfa6 2 0]HINT:  Future log output will appear in directory "pg_log".
$ psql -U postgres
psql (9.2.13)
Type "help" for help.
postgres=# create role replicator with login replication password '8d5e9531-3817-460d-a851-659d2e51ca99';
CREATE ROLE
postgres=# alter user postgres with password 'postgres';

postgres=# \q

5.制作slave
在node2上执行:

$  su - postgres
$ pg_basebackup -h 10.16.93.179 -U postgres -D /data/postgresql/data/ -X stream -P
could not change directory to "/home/wenhang.pan"
20127/20127 kB (100%), 1/1 tablespace


$ vim /data/postgresql/data/recovery.conf
standby_mode = 'on'
primary_conninfo = 'host=10.16.93.179 port=5432 user=replicator application_name=zhaopin-5-92 password=8d5e9531-3817-460d-a851-659d2e51ca99 keepalives_idle=60 keepalives_in
terval=5 keepalives_count=5'
restore_command = 'cp /data/postgresql/xlog_archive/%f %p'
recovery_target_timeline = 'latest'

6.启动slave
在node2上执行:

$ pg_ctl -D /data/postgresql/data/ start
pg_ctl: another server might be running; trying to start server anyway
server starting
-bash-4.2$ LOG:  database system was interrupted while in recovery at log time 2015-10-16 08:19:07 GMT
HINT:  If this has occurred more than once some data might be corrupted and you might need to choose an earlier recovery target.
LOG:  entering standby mode
LOG:  redo starts at 0/3000020
LOG:  consistent recovery state reached at 0/30000E0
LOG:  database system is ready to accept read only connections
LOG:  streaming replication successfully connected to primary

7.查看集群状态
在node1上执行一下命令。这个时候,可看到node2是一个replication。同步状态为sync

[root@10 ~]# psql -U postgres
psql (9.2.15)
Type "help" for help.

postgres=# select * from pg_stat_replication ;
pid  | usesysid |  usename   | application_name | client_addr  | client_hostname | client_port |         backend_start 
        |   state   | sent_location | write_location | flush_location | replay_location | sync_priority | sync_state 
-------+----------+------------+------------------+--------------+-----------------+-------------+-----------------------
--------+-----------+---------------+----------------+----------------+-----------------+---------------+------------
 17349 |    16384 | replicator | 10.16.93.182     | 10.16.93.182 |                 |       22690 | 2016-04-14 14:07:25.18
1297+08 | streaming | 0/9014508     | 0/9014508      | 0/9014508      | 0/9014508       |             1 | sync
(1 row)

8.停止PostgreSQL服务
在node1、node2上执行:

$ pg_ctl -D /data/postgresql/data/ -mi stop
waiting for server to shut down.... done
server stopped

注意:在配置自动切换前,一定要先把node1、node2上的PostgreSQL服务停掉

配置自动切换
上面的配置完成了数据库的初始化。下面进行自动切换相关的配置。当发生故障时,master/slave身份实现自动切换。

1.配置
在node1执行:

1)配置项较多,我们先将配置步骤写到脚本里

[root@10 ~]# vim cluster_setup.sh

# 将cib配置保存到文件
pcs cluster cib pgsql_cfg                                                                   
# 在pacemaker级别忽略quorum
pcs -f pgsql_cfg property set no-quorum-policy="ignore"        
# 禁用STONITH           
pcs -f pgsql_cfg property set stonith-enabled="false"                    
# 设置资源粘性,防止节点在故障恢复后发生迁移     
pcs -f pgsql_cfg resource defaults resource-stickiness="INFINITY"       
# 设置多少次失败后迁移
pcs -f pgsql_cfg resource defaults migration-threshold="3"                 
# 设置master节点虚ip
pcs -f pgsql_cfg resource create vip-master IPaddr2 ip="10.16.93.180" cidr_netmask="24"    op start   timeout="60s" interval="0s"  on-fail="restart"    op monitor timeout="60s" interval="10s" on-fail="restart"    op stop    timeout="60s" interval="0s"  on-fail="block"                             
# 设置slave节点虚ip                       
pcs -f pgsql_cfg resource create vip-slave IPaddr2 ip="10.16.93.181" cidr_netmask="24"    op start   timeout="60s" interval="0s"  on-fail="restart"    op monitor timeout="60s" interval="10s" on-fail="restart"    op stop    timeout="60s" interval="0s"  on-fail="block"                                                        
# 设置pgsql集群资源
# pgctl、psql、pgdata和config等配置根据自己的环境修改,node list填写节点的hostname,master_ip填写虚master_ip
pcs -f pgsql_cfg resource create pgsql pgsql pgctl="/usr/bin/pg_ctl" psql="/usr/bin/psql" pgdata="/data/postgresql/data/" config="/data/postgresql/data/postgresql.conf" rep_mode="sync" node_list="tsung_test 10.16.93.179" master_ip="10.16.93.180"  repuser="replicator" primary_conninfo_opt="password=8d5e9531-3817-460d-a851-659d2e51ca99 keepalives_idle=60 keepalives_interval=5 keepalives_count=5" restore_command="cp /data/postgresql/xlog_archive/%f %p" restart_on_promote='true' op start   timeout="60s" interval="0s"  on-fail="restart" op monitor timeout="60s" interval="4s" on-fail="restart" op monitor timeout="60s" interval="3s"  on-fail="restart" role="Master" op promote timeout="60s" interval="0s"  on-fail="restart" op demote  timeout="60s" interval="0s"  on-fail="stop" op stop    timeout="60s" interval="0s"  on-fail="block"       
 # 设置master/slave模式,clone-max=2,两个节点
pcs -f pgsql_cfg resource master pgsql-cluster pgsql master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true                                                                       
# 配置master ip组
pcs -f pgsql_cfg resource group add master-group vip-master        
# 配置slave ip组     
pcs -f pgsql_cfg resource group add slave-group vip-slave                 
# 配置master ip组绑定master节点
pcs -f pgsql_cfg constraint colocation add master-group with master pgsql-cluster INFINITY    
# 配置启动master节点
pcs -f pgsql_cfg constraint order promote pgsql-cluster then start master-group symmetrical=false score=INFINITY                                 
# 配置停止master节点                                                                   
pcs -f pgsql_cfg constraint order demote  pgsql-cluster then stop  master-group symmetrical=false score=0                                                                                                                
# 配置slave ip组绑定slave节点
pcs -f pgsql_cfg constraint colocation add slave-group with slave pgsql-cluster INFINITY         
# 配置启动slave节点
pcs -f pgsql_cfg constraint order promote pgsql-cluster then start slave-group symmetrical=false score=INFINITY                               
# 配置停止slave节点                                                                         
pcs -f pgsql_cfg constraint order demote  pgsql-cluster then stop  slave-group symmetrical=false score=0                                                                                                                  
# 把配置文件push到cib
pcs cluster cib-push pgsql_cfg

2)执行操作文件

$  sh cluster_setup.sh
1
2.查看状态
1)查看cluster状态

在node1上执行:

[root@10 ~]# pcs status
Cluster name: pgcluster
WARNING: corosync and pacemaker node names do not match (IPs used in setup?)
Last updated: Mon Apr  4 23:15:56 2016          Last change: Fri Apr  1 09:17:03 2016 by root via crm_attribute on tsung_test
Stack: corosync
Current DC: tsung_test (version 1.1.13-10.el7_2.2-44eb2dd) - partition with quorum
2 nodes and 5 resources configured

Online: [ 10.16.93.179 tsung_test ]

Full list of resources:

 Master/Slave Set: pgsql-cluster [pgsql]
     Masters: [ tsung_test ]
     Slaves: [ 10.16.93.179 ]
 Resource Group: master-group
     vip-master (ocf::heartbeat:IPaddr2):       Started tsung_test
 Resource Group: slave-group
     vip-slave  (ocf::heartbeat:IPaddr2):       Started 10.16.93.179

PCSD Status:
  10.16.93.179: Online
  tsung_test (10.16.93.182): Online

Daemon Status:
  corosync: active/disabled
  pacemaker: active/disabled
  pcsd: active/enabled

2)查看PostgreSQL集群状态

在node1上执行:

[root@tsung_test data]# psql -U postgres

psql (9.2.15)
Type "help" for help.

postgres=# select * from pg_stat_replication ;
  pid  | usesysid |  usename   | application_name | client_addr  | client_hostname | client_port |         backend_start         |   state   | sent_location | write_locatio
n | flush_location | replay_location | sync_priority | sync_state
-------+----------+------------+------------------+--------------+-----------------+-------------+-------------------------------+-----------+---------------+--------------
--+----------------+-----------------+---------------+------------
 19415 |    16384 | replicator | 10.16.93.182     | 10.16.93.182 |                 |       18289 | 2016-04-01 09:17:29.037197-04 | streaming | 0/40F0ED8     | 0/40F0ED8
  | 0/40F0ED8      | 0/40F0ED8       |             0 | async
(1 row)

验证自动切换
参考文献
http://clusterlabs.org/wiki/PgSQL_Replicated_Cluster
http://m.oschina.net/blog/518928
http://m.oschina.net/blog/519458?mType=Group
————————————————
 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

postgresql双机热备、高可用方案(采用pacemaker+corosync实现) 的相关文章

  • 图像连通域分析

    转自 xff1a https blog csdn net tiandijun article details 51279643 xff0c 转载仅为方便学习 一 前言 二值图像的图像的亮度值只有两个状态 xff1a 黑 0 和白 255 二
  • C++ wchar_t *和char * 互转

    转自 xff1a https blog csdn net lightspear article details 54695123 说道wchar t和char两个类型大家都不会陌生 wchar t xff1a 在windows下是Unico
  • android识别模拟器

    识别安卓模拟器的两种方案 xff01 禁止通过模拟器进行刷量 xff0c 防止作弊行为 xff01 import android content Context import android content Intent import an
  • ubuntu在终端中打开文件管理器

    打开ubuntu的终端 xff0c 输入nautilus path 弹出资源管理器界面
  • chrome jsonView插件安装

    由于谷歌浏览器经常打不开应用商店 xff0c 还有就是安装第三方插件的办法 方法就如下 xff1a 由于最近做和json相关的东西 xff0c 所以 xff0c 以jsonView插件为例分享一下 1 打开https github com
  • Gradle学习笔记 使用Gradle Wrapper

    Gradle可以在没有安装Gradle的情况下使用 xff0c 这时候就需要Gradle Wrapper了 Gradle Wrapper其实就是一个脚本文件 xff0c 它会在没有安装Gradle的情况下为我们下载Gradle xff0c
  • 《30天自制操作系统》:值得推荐的一本好书

    自己编写一个操作系统 xff0c 是许多程序员的梦想 也许有人曾经挑战过 xff0c 但因为太难而放弃了 其实你错了 xff0c 你的失败并不是因为编写操作系统太难 xff0c 而是因为没有人告诉你那其实是一件很简单的事 那么 xff0c
  • 验证谷角猜想

    import java util public class Test3 3 验证谷角猜想 xff1a 日本数学家谷角静夫在研究自然数时发现了一个奇怪的现象 对于任意一个自然数n xff0c 若n为偶数 xff0c 则将其除以2 xff1b
  • 生产者消费者问题(Linux多线程下两种实现)

    生产者消费者问题是同步问题中的一种常见情况 xff0c 借用一下维基百科的话 生产者消费者问题 xff08 英语 xff1a Producer consumer problem xff09 xff0c 也称 有限缓冲问题 xff08 英语
  • Mac Tomcat安装 localhost 拒绝了我们的连接请求

    Mac Tomcat安装 localhost 拒绝了我们的连接请求 Mac下安装Tomcat服务器 xff0c 下载的Tomcat10 在bin目录下 xff0c 授权 chmod 777 sh 启动Tomcat服务 startup sh
  • 从SAP最佳业务实践看企业管理(83)-PP-145按库存生产

    xfeff xfeff 从SAP 最佳业务实践看企业管理 83 PP 145 按库存生产 1 MTS 按库存生产 在按库存生产策略的类型中 xff0c 客户基本上对最终产品规格的确定没有什么建议或要求 xff0c 他们的投入很少 生产商生产
  • Jenkins学习笔记:解决插件安装问题

    安装插件结束后 xff0c 当时界面提示很多插件没有成功 xff0c 问我是否需要重试 xff0c 我安排到后面再做解决 今天打开Jenkins后 xff0c 发现之前的密码不能登录了 xff0c 仔细想了想 xff0c 记起之前改过了 用
  • Tensorflow lite for 移动端安卓开发(二)——完整详细过程训练自己的模型

    官方给的Tensorflow lite demo是ImageNet 中训练的1000类物体识别 xff0c 基于移动端的项目需要 xff0c 现在要用模型训练自己的数据 xff0c 提供两种训练方法 xff0c 这也是自己在摸索Tensor
  • 亚马逊,一个沉睡广告巨人的苏醒(虎嗅网)

    虽然拥有令无数广告主羡慕的高质量用户数据和巨大的网站流量 xff0c 但是在很长的一段时间内亚马逊还是将主要的精力集中在商品销售上 xff0c 广告只是作为自身业务的补充可有可无的存在 不过最近两年 xff0c 亚马逊对广告这种不屑的态度正
  • 大数据案例分析:电信业Hadoop应用分析 原文出自【比特网】,转载请保留原文链接:http://do.chinabyte.com/228/12410228.shtml

    电信业Hadoop应用分析 昨日 xff0c 联通研究院处长王志军在第七届 开源中国 开源世界 高峰论坛上分享了Hadoop在电信行业大数据应用的经验 随着国内3G网络的发展 xff0c 或者移动通信网络的发展 xff0c 中国联通 600
  • 大腕出手看门道,谈BAT的投资战略差异 三家战略投资的思考原点并不相同虎嗅网)

    中国互联网的收购之战 xff0c 比娱乐圈的明星离婚更一波三折和猜不透结局 当所有人以为搜狗被360牵回山寨只是早晚的事的时候 xff0c 搜狗和腾讯宣布好上了 眼瞅着今年第三季度即将结束 xff0c 中国互联网巨头们在2013年的 军备竞
  • JDK6的安装

    http www java net download jdk6 6u10 promoted b32 binaries jdk 6u10 rc2 bin b32 windows i586 p 12 sep 2008 exe XP 下 JDK6
  • 如何利用大数据进行价值兑现才是正经事(虎嗅网)

    如果有一天你可以预测未来 xff0c 你要做的第一件事情是什么 xff1f 买彩票 xff1f 第二件 第三件事情呢 xff1f 先卖个关子 xff0c 我们后面再说这件事情 大数据是个产业 xff0c 广义上指的是在这个信息过载时代围绕着
  • 络达开发---串口日志&日志过滤

    平台 xff1a AB1565M SDK版本 xff1a V2 11 0 开发环境 xff1a windows10 采用官方ATK中的日志工具可以通过硬件物理串口来实时查看芯片中软件的运行日志 如下图所示 xff0c 其实该ATK工具为一若
  • 多图震撼!数字的未来,2013报告(虎嗅网)

    新媒体 完爆 旧媒体 从市值上来看 xff0c 以苹果 谷歌 亚马逊 Facebook 雅虎等为首的新媒体公司市值已超过1万亿美元 xff0c 而以迪斯尼 Comcast 时代华纳 Viacom CBS 新闻集团 21世纪福克斯等为首的旧媒

随机推荐

  • 网页采集器-八爪鱼采集器

    八爪鱼采集器下载地址 xff1a http www bazhuayu cc download 八爪鱼采集器的注册地址 xff1a http www bazhuayu cc signup id 61 0e492e9c 6d80 4c2a a2
  • 考研书单与技巧

    书尽量在网上搞活动时买正版的 xff0c 这样也不贵 每科研究透一到两本书 xff0c 不要贪多 xff01 1 英语 xff1a xff08 积累的过程 xff0c 可以现在开始 xff0c 正好把六级过了 xff09 xff08 看好所
  • Tomcat 9安装配置教程

    首先 xff0c 先去这个网址下载Tomcat 9 http tomcat apache org 然后根据自己的电脑系统版本去下载相对应的文件 xff01 我的系统版本是 Windows 10 64位 xff0c 所以我选择 34 64 b
  • Ef Core 使用Entity方式配置外键

    一 Ef Core 使用Entry方式配置外键 当一个表中有多个外键指向同一个表时候 xff0c 需要使用Entity方式执行具体外键约束名称 xff0c 使用方法如下 xff1a protected override void OnMod
  • Python安装后目录在哪儿_如何查看Python的安装目录

    一 Python的安装录 当前安装版本为 xff1a python 3 10 4 1 在安装python的时候可以看到安装目录 xff0c 可以修改安装目录 xff1a 2 windows系统下64位安装目录如下 xff1a 跟其他软件不太
  • linux下完全删除mysql

    linux下完全删除mysql 查询所有mysql的服务并停止所有mysql服务 查询自启服务列表 span class token function chkconfig span list 执行结果 mysqld 0 关闭 1 关闭 2
  • linux安装mysql-8.0.19-最全讲解

    linux离线方式安装mysql 8 0 19 下载mysql包 注意 在MySQL Server 8 0 12中 xff0c 压缩算法从Gzip更改为XZ xff1b 并且通用二进制文件的文件扩展名从 tar gz更改为 tar xz 安
  • Windows环境下给oracle打补丁详细教程

    环境检查 1 检查oracle数据库版本 xff0c 安装前检查 xff1a 确保Oracle数据库安装与您正在应用此修补程序的版本相同 C WINDOWS system32 span class token operator gt spa
  • CentOS7安装docker

    安装docker docker官网 xff1a http www docker com docker中文网站 xff1a https www docker com 仓库 Docker Hub官网 https hub docker com 官
  • springCloud---替换注册中心eureka为nacos后 @Value 获取不到值

    在替换为nacos后 xff0c 启动时出现如下错误 xff1a 64 Value 获取不到值 xff0c 无法解析 test 占位符 此时就会进行各种百度 xff0c google xff0c 查文档 xff01 而我遇到的问题出现在 x
  • Linux防火墙及端口策略设置(iptables&firewalld)

    防火墙设置 service firewalld stop service firewalld start service firewall restart service firewalld status 开机禁用 xff1a system
  • windows环境下安装MySQL8.0.19

    安装过程中可能提示缺少xx dll文件 xff0c 建议首先安装微软常用运行库集合 下载地址 1 下载MySQL8压缩包 xff0c 进行解压 xff0c 在根目录下创建data文件夹 xff0c 创建my ini配置文件 2 在配置文件中
  • 解决多个tomcat端口冲突

    我在一台PC机上安装了两个tomcat xff0c 需要同时启动 xff0c 每个tomcat上跑一个程序 xff0c 但是现在提示端口号冲突 xff0c 需要手动更改 需要修改三个地方 xff1a 1 首先 xff1a 在Tomcat的根
  • Android JsonArray移除里面的一个对象

    remove是在 API level 19 时加入的 xff0c 在低版本调用时会出现错误 这里用反射实现了兼容老版本的方法 public void Remove int positon throws Exception if positi
  • libgtk2.0-dev 安装broken packages问题解决方法

    在安装opencv的过程中 xff0c 需要安装到 libgtk2 0 dev xff0c 安装过程中可能会出现broken packages的问题 输出信息如下 xff1a apt get install libgtk2 0 dev Re
  • vue 代码格式化(VS code)

    1 安装了vetur xff08 Vue tooling for VS Code xff09 扩展插件 在扩展中搜索vetur xff0c 然后点击安装 2 直接 xff08 或者 选中你想格式化的代码 xff09 xff0c 右键 xff
  • ViewBinding与Kotlin委托

    接上篇幅 自定义属性委托的用处很多 xff0c 例如组合替代继承 xff0c 给个ViewBinding在Fragment中的使用的例子 xff1a 委托 自定义属性委托 lt p gt lt p gt lt ul gt lt li gt
  • Android之使用Kotlin构建Gradle

    Android StudioGradle3 4 25 1 1 首先kotlin dsl不是什么新鲜的东西了 xff0c Gradle5 0发布的时候就有了 Gradle Kotlin DSL目前的版本是1 0 2 现在是否可以抛弃groov
  • 浅析spring中注解的运行

    为了了解注解的运行机制 xff0c 需要自定义一个注解 xff0c 如下方式来模拟注解方式实现注入对象 xff1a 1 新建一个自定义注解MyResource java span class hljs annotation 64 Reten
  • postgresql双机热备、高可用方案(采用pacemaker+corosync实现)

    PostgreSQL高可用 需求描述 我们有两台centos7的数据库主机A B 要对A B实现双机热备 xff0c A作为数据库master主机 xff0c 对外提供读写服务 xff0c B作为slave主机能实时同步A的数据 当A发生故