命令行部署金仓读写分离集群

article/2025/7/22 19:10:39

有大佬会问,图形化方式部署多流畅,干嘛自虐非要倒腾命令行方式,那是因为我们的环境要通过VPN再到堡垒机最后才能xshell登录,而且VPN、堡垒机不定时频繁超时断开。

KingbaseES读写分离集群简介

在多数据库实例的热备模式下,通过标准化配置(满足最低要求)、特定的部署方式等手段达到KingbaseES MAA(最大可用性架构)的中级架构要求:满足初级架构要求的基础上,能够处理硬件故障(不能是所有设备的硬件故障),具有更强的数据保护能力;同时能具有处理复杂故障场景(软硬件、网络等故障)的能力、具有更短的故障恢复时间,能够保证数据库服务持续对外提供服务。

安装前准备

服务器环境信息收集

ip

os

cpu架构

内存

角色

192.168.40.111

UOS Server 20

x86_64

4G

192.168.40.112

UOS Server 20

x86_64

4G

操作系统环境配置(所有节点)

关闭防火墙

停止并永久关闭防火墙

systemctl stop firewalld  
systemctl disable firewalld  

调整ssh参数

UOS 20不用改,默认值已经是以下值

vi /etc/ssh/sshd_config

找到以下开关改为

USEDNS=no
GSSAPIAuthentication=no

重启sshd服务

systemctl restart sshd

配置主机名

--节点1
hostnamectl set-hostname node1
exec bash--节点2
hostnamectl set-hostname node2
exec bash

配置/etc/hosts文件

vi /etc/hosts
192.168.40.111 node1
192.168.40.112 node2

安装介质下载并上传

登录官网

  • 下载授权文件---授权文件部分操作系统版本和CPU架构

  • 下载数据库软件版本---注意选择对应的操作系统版本和CPU架构

服务器上创建/install目录,将以上文件上传至服务器/install目录下。该步骤可自行选择做或不做,因为有的人习惯上传到/opt目录下或者是其他磁盘空间比较大的数据盘下。

mkdir -p /install

查看已上传的安装介质,输出如下:

[root@node1 ~]# ls -lhtr /install/
-rw-r--r-- 1 root     root     2.7K  5月 21 16:36 license_企业版.zip
-rw-r--r-- 1 root     root     2.6G  5月 21 16:42 KingbaseES_V009R001C002B0014_Lin64_install.iso

创建用户(所有节点)

cat /etc/passwd | grep kingbase(是否存在,存在则执行下条命令删除)
userdel -rf kingbase
groupadd -g 1010 kingbase
useradd -d /home/kingbase -g kingbase -u 1010 kingbase
echo 'kingbase' | passwd --stdin kingbase                      # 更改kingbase 即操作系统kingbase账户密码
id kingbase                                                 
用户id=1010(kingbase) 组id=1010(kingbase) 组=1010(kingbase)

创建目录(所有节点)

--集群部署软件安装目录  主节点操作即可
mkdir -p /data/kesclusterinstall
chown -R kingbase:kingbase /data/kesclusterinstall
chmod -R 775 /data/kesclusterinstall--集群安装目录
mkdir -p /data/kescluster
chown -R kingbase:kingbase /data/kescluster
chmod -R 775 /data/kescluster--集群数据目录
mkdir -p /data/kesdata
chown -R kingbase:kingbase /data/kesdata
chmod -R 700 /data/kesdata

挂载安装介质(主节点)

mount /install/KingbaseES_V009R001C002B0014_Lin64_install.iso /mnt

安装数据库集群部署软件(主节点)

切换到kingbase用户

该步骤必须操作

su - kingbase

执行安装软件

cd /mnt
./setup.sh -i console
简介

以下是介绍,回车即可

许可协议

以下是许可协议,回车即可

输入Y,继续

选择安装集

选择客户端安装,一路回车

选择授权文件

选择安装目录

预安装摘要

安装完成

修改集群安装配置文件install.conf

su - kingbase
cd /data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip
cp install.conf install.conf_20250528bak
vi install.conf

分别修改以下内容:

  • [install]组下面的所有节点ip参数更改 多个ip地址之间用空格隔开
[install]
## whether it is BMJ, if so, on_bmj=1, if not on_bmj=0, defaults to on_bmj=0
on_bmj=0## the cluster node IP which needs to be deployed, is separated by spaces, for example:  all_ip=(192.168.1.10 192.168.1.11)
## or all_ip=(host1 host2)
## means deployed cluster of DG ==> ha_running_mode='DG'
all_ip=(192.168.40.111 192.168.40.112)
  • [install]组下面的数据库集群安装位置参数更改
install_dir="/data/kescluster"
  • [install]组下面的数据库集群安装zip文件参数更改
zip_package="/data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip/db.zip"
  • [install]组下面的授权文件参数更改 如果是用同一个授权文件该参数可不更改
license_file=(license.dat)
  • [install]组下面的数据库安装用户信息配置 以下参数可自行更改,该场景选择默认 密码默认是12345678ab
db_user="system"                 # the user name of database
#db_password=""                  # the password of database.
db_port="54321"                  # the port of database, defaults is 54321
db_mode="oracle"                 # database mode: pg, oracle, mysql
db_auth="scram-sha-256"          # database authority: scram-sha-256, md5, scram-sm3, sm4, default is scram-sha-256
db_case_sensitive="yes"          # database case sensitive settings: yes, no. default is yes - case sensitive; no - case insensitive# (NOTE. cannot set to 'no' when db_mode="pg", and cannot set to 'yes' when db_mode="mysql").
db_checksums="yes"               # the checksum for data: yes, no. default is yes - a checksum is calculated for each data block to prevent corruption; no - nothing to do.
archive_mode="always"                # enables archiving; off, on, or alwaysencoding="UTF8"                  # set default encoding for new databases. must be one of ('default' 'UTF8' 'GBK' 'GB2312' 'GB18030')
locale="zh_CN.UTF-8"             # set default locale for new databases.
  • [install]组下面的网关ip参数,两台或者多台机器的网关必须保持一
trusted_servers="192.168.40.2"
  • [install]组下面的数据目录参数,建议不用修改,默认为安装目录下
data_directory="/data/kesdata"
  • [install]组下面的虚拟ip参数 指向虚拟ip 即DBVIP 需是一个从未使用过的新ip地址 作用:数据库公共访问入口
## the vitural IP, for example: virtual_ip="192.168.28.188/24"
virtual_ip="192.168.40.115"
  • [install]组下面的网关参数 多个网关名称空格隔开
net_device=(ens192 ens192)
  • [install]组下面的网关对应的ip参数 所有节点的
net_device_ip=(192.168.40.111 192.168.40.112)

修改集群安装配置文件cluster_install.sh

su - kingbase
cd /data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip
cp cluster_install.sh cluster_install.sh_20250528bak
vi cluster_install.sh

修改以下内容:

  • # normal configuration中all_ip=() 所有节点的ip 用空格隔开
all_ip=(192.168.40.111 192.168.40.112)
  • # normal configuration中install_dir="" 集群安装位置
install_dir="/data/kescluster"
  • # normal configuration中zip_package="" 集群安装需要的zip包
zip_package="/data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip/db.zip"
  • # normal configuration中trusted_servers="" 网关ip地址
trusted_servers="192.168.40.2"
  • # normal configuration中virtual_ip="" 虚拟ip 即DBVIP 数据库公共访问入口
virtual_ip="192.168.40.115"
  • # normal configuration中virtual_ip="" 中net_device=()
net_device=(ens192 ens192)
  • # normal configuration中net_device_ip=()
net_device_ip=(192.168.40.111 192.168.40.112)
  • # db configuration中更改以下参数:
db_user="system"
db_password="12345678ab"  #本案例采用默认密码 12345678ab
db_port="54321"
db_mode="oracle"
db_auth=""
db_case_sensitive=""   #YES 大小写敏感   NO 不敏感
db_checksums=""
archive_mode="always"

拷贝授权文件至集群配置文件目录

su - root
cd /data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip
cp /install/license_41248/license_41248_0.dat ./license.dat
chown -R kingbase:kingbase license.dat

配置服务器间免密操作

su - root
cd /data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip
./trust_cluster.sh 

分别在所有节点测试ssh 对方主机名 验证没问题则正常。

数据库集群安装

最后输出[INSTALL] start up the whole cluster ... OK 说明集群部署完成

su - kingbase
cd /data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip
./cluster_install.sh

详细输出如下:

[kingbase@node1 zip]$ sh cluster_install.sh
[CONFIG_CHECK] will deploy the cluster of DG
[CONFIG_CHECK] file format is correct ... OK
[CONFIG_CHECK] encoding: UTF8 OK
[CONFIG_CHECK] locale: zh_CN.UTF-8 OK
[CONFIG_CHECK] the number of net_device matches the length of all_ip or the number of net_device is 1 ... OK
[CONFIG_CHECK] the number of license_num matches the length of all_ip or the number of license_num is 1 ... OK
[CONFIG_CHECK] success to access license_file: /data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip/license.dat
[RUNNING] check if the host can be reached from current node and between all nodes by ssh ...
[RUNNING] success connect to "192.168.40.111" from current node by 'ssh' ... OK
[RUNNING] success connect to "192.168.40.111" from "192.168.40.111" by 'ssh' ... OK
[RUNNING] success connect to "192.168.40.112" from "192.168.40.111" by 'ssh' ... OK
[RUNNING] success connect to "192.168.40.112" from current node by 'ssh' ... OK
[RUNNING] success connect to "192.168.40.111" from "192.168.40.112" by 'ssh' ... OK
[RUNNING] success connect to "192.168.40.112" from "192.168.40.112" by 'ssh' ... OK
[RUNNING] chmod /bin/ping ...
[RUNNING] chmod /bin/ping ... Done
[RUNNING] ping access rights OK
[RUNNING] check if the virtual ip "192.168.40.115" already exist ...
[RUNNING] there is no "192.168.40.115" on any host, OK
[RUNNING] check the [net_device_ip] on dev [net_device] ...
[RUNNING] 192.168.40.111 on host "192.168.40.111" on dev "ens192" ..... OK
[RUNNING] 192.168.40.112 on host "192.168.40.112" on dev "ens192" ..... OK
[RUNNING] check the db is running or not...
[RUNNING] the db is not running on "192.168.40.111:54321" ..... OK
[RUNNING] the db is not running on "192.168.40.112:54321" ..... OK
[RUNNING] check the sys_securecmdd is running or not...
[RUNNING] the sys_securecmdd is not running on "192.168.40.111:8890" ..... OK
[RUNNING] the sys_securecmdd is not running on "192.168.40.112:8890" ..... OK
[RUNNING] check if the install dir (create dir and check it's owner/permission) ...
[RUNNING] check if the install dir (create dir and check it's owner/permission) on "192.168.40.111" ... OK
[RUNNING] check if the install dir (create dir and check it's owner/permission) on "192.168.40.112" ... OK
[RUNNING] check if the dir "/data/kescluster/kingbase" is already exist ...
[RUNNING] the dir "/data/kescluster/kingbase" is not exist on "192.168.40.111" ..... OK
[RUNNING] the dir "/data/kescluster/kingbase" is not exist on "192.168.40.112" ..... OK
[RUNNING] check the data directory (create it and check whether it is empty) ...
[RUNNING] when use_exist_data=0, create the empty data directory on "192.168.40.111" ..... OK
[RUNNING] when use_exist_data=0, create the empty data directory on "192.168.40.112" ..... OK
2025-05-28 17:31:07 [INFO] start to check system parameters on 192.168.40.111 ...
2025-05-28 17:31:08 [INFO] [GSSAPIAuthentication] no on 192.168.40.111
2025-05-28 17:31:08 [INFO] [UseDNS] no  on 192.168.40.111
2025-05-28 17:31:08 [INFO] [UsePAM] yes  on 192.168.40.111
2025-05-28 17:31:09 [INFO] [ulimit.open files] 65536 on 192.168.40.111
2025-05-28 17:31:09 [INFO] [ulimit.open proc] 65536 on 192.168.40.111
2025-05-28 17:31:09 [INFO] [ulimit.core size] unlimited on 192.168.40.111
2025-05-28 17:31:09 [INFO] [ulimit.mem lock] 64 (less than 50000000) on 192.168.40.111
2025-05-28 17:31:09 [INFO] the value of [ulimit.mem lock] is wrong, now will change it on 192.168.40.111 ...
2025-05-28 17:31:10 [INFO] change ulimit.mem lock on 192.168.40.111 ...
2025-05-28 17:31:10 [INFO] change ulimit.mem lock on 192.168.40.111 ... Done
2025-05-28 17:31:11 [INFO] [ulimit.mem lock] 50000000 on 192.168.40.111
2025-05-28 17:31:12 [INFO] [kernel.sem] 5010 641280 5010 256 on 192.168.40.111
2025-05-28 17:31:12 [INFO] [RemoveIPC] no on 192.168.40.111
2025-05-28 17:31:12 [INFO] [DefaultTasksAccounting] no on 192.168.40.111
2025-05-28 17:31:12 [INFO] write file "/etc/udev/rules.d/kingbase.rules" on 192.168.40.111
2025-05-28 17:31:14 [INFO] [crontab] chmod /usr/bin/crontab ...
2025-05-28 17:31:14 [INFO] [crontab] chmod /usr/bin/crontab ... Done
2025-05-28 17:31:14 [INFO] [crontab access] OK
2025-05-28 17:31:15 [INFO] [cron.deny] kingbase not exists in cron.deny
2025-05-28 17:31:15 [INFO] [crontab auth] crontab is accessible by kingbase now on 192.168.40.111
2025-05-28 17:31:15 [INFO] [SELINUX] disabled on 192.168.40.111
2025-05-28 17:31:16 [INFO] [firewall] down on 192.168.40.111
2025-05-28 17:31:17 [INFO] [The memory] OK on 192.168.40.111
2025-05-28 17:31:17 [INFO] [The hard disk] OK on 192.168.40.111
2025-05-28 17:31:17 [INFO] [ping] chmod /bin/ping ...
2025-05-28 17:31:17 [INFO] [ping] chmod /bin/ping ... Done
2025-05-28 17:31:18 [INFO] [ping access] OK
2025-05-28 17:31:18 [INFO] [/bin/cp --version] on 192.168.40.111 OK
2025-05-28 17:31:18 [INFO] [ip command path] on 192.168.40.111 OK
2025-05-28 17:31:18 [INFO] start to check system parameters on 192.168.40.112 ...
2025-05-28 17:31:18 [INFO] [GSSAPIAuthentication] no on 192.168.40.112
2025-05-28 17:31:19 [INFO] [UseDNS] no  on 192.168.40.112
2025-05-28 17:31:19 [INFO] [UsePAM] yes  on 192.168.40.112
2025-05-28 17:31:19 [INFO] [ulimit.open files] 65536 on 192.168.40.112
2025-05-28 17:31:20 [INFO] [ulimit.open proc] 65536 on 192.168.40.112
2025-05-28 17:31:20 [INFO] [ulimit.core size] unlimited on 192.168.40.112
2025-05-28 17:31:20 [INFO] [ulimit.mem lock] 64 (less than 50000000) on 192.168.40.112
2025-05-28 17:31:20 [INFO] the value of [ulimit.mem lock] is wrong, now will change it on 192.168.40.112 ...
2025-05-28 17:31:20 [INFO] change ulimit.mem lock on 192.168.40.112 ...
2025-05-28 17:31:21 [INFO] change ulimit.mem lock on 192.168.40.112 ... Done
2025-05-28 17:31:21 [INFO] [ulimit.mem lock] 50000000 on 192.168.40.112
2025-05-28 17:31:22 [INFO] [kernel.sem] 5010 641280 5010 256 on 192.168.40.112
2025-05-28 17:31:22 [INFO] [RemoveIPC] no on 192.168.40.112
2025-05-28 17:31:23 [INFO] [DefaultTasksAccounting] no on 192.168.40.112
2025-05-28 17:31:23 [INFO] write file "/etc/udev/rules.d/kingbase.rules" on 192.168.40.112
2025-05-28 17:31:24 [INFO] [crontab] chmod /usr/bin/crontab ...
2025-05-28 17:31:24 [INFO] [crontab] chmod /usr/bin/crontab ... Done
2025-05-28 17:31:25 [INFO] [crontab access] OK
2025-05-28 17:31:25 [INFO] [cron.deny] kingbase not exists in cron.deny
2025-05-28 17:31:26 [INFO] [crontab auth] crontab is accessible by kingbase now on 192.168.40.112
2025-05-28 17:31:26 [INFO] [SELINUX] disabled on 192.168.40.112
2025-05-28 17:31:27 [INFO] [firewall] down on 192.168.40.112
2025-05-28 17:31:27 [INFO] [The memory] OK on 192.168.40.112
2025-05-28 17:31:28 [INFO] [The hard disk] OK on 192.168.40.112
2025-05-28 17:31:28 [INFO] [ping] chmod /bin/ping ...
2025-05-28 17:31:28 [INFO] [ping] chmod /bin/ping ... Done
2025-05-28 17:31:28 [INFO] [ping access] OK
2025-05-28 17:31:29 [INFO] [/bin/cp --version] on 192.168.40.112 OK
2025-05-28 17:31:29 [INFO] [ip command path] on 192.168.40.112 OK
[INSTALL] create the install dir "/data/kescluster/kingbase" on every host ...
[INSTALL] success to create the install dir "/data/kescluster/kingbase" on "192.168.40.111" ..... OK
[INSTALL] success to create the install dir "/data/kescluster/kingbase" on "192.168.40.112" ..... OK
[INSTALL] success to access the zip_package "/data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip/db.zip" on "192.168.40.111" ..... OK
[INSTALL] decompress the "/data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip/db.zip" to "/data/kescluster/kingbase/__tmp_decompress__"
[INSTALL] success to recreate the tmp dir "/data/kescluster/kingbase/__tmp_decompress__" on "192.168.40.111" ..... OK
[INSTALL] success to decompress the "/data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip/db.zip" to "/data/kescluster/kingbase/__tmp_decompress__" on "192.168.40.111"..... OK
[INSTALL] scp the dir "/data/kescluster/kingbase/__tmp_decompress__" to "/data/kescluster/kingbase" on all host
[INSTALL] try to copy the install dir "/data/kescluster/kingbase" to "192.168.40.111" .....
[INSTALL] success to scp the install dir "/data/kescluster/kingbase" to "192.168.40.111" ..... OK
[INSTALL] try to copy the install dir "/data/kescluster/kingbase" to "192.168.40.112" .....
[INSTALL] success to scp the install dir "/data/kescluster/kingbase" to "192.168.40.112" ..... OK
[INSTALL] remove the dir "/data/kescluster/kingbase/__tmp_decompress__"
[INSTALL] change the auth of bin directory on 192.168.40.111 ...
[INSTALL] change the auth of bin directory on 192.168.40.112 ...
[RUNNING] chmod u+s and a+x for "/sbin" and "/opt/kes/bin"
[RUNNING] chmod u+s and a+x /sbin/ip on "192.168.40.111" ..... OK
[RUNNING] chmod u+s and a+x /opt/kes/bin/arping on "192.168.40.111" ..... OK
[RUNNING] chmod u+s and a+x /sbin/ip on "192.168.40.112" ..... OK
[RUNNING] chmod u+s and a+x /opt/kes/bin/arping on "192.168.40.112" ..... OK
[INSTALL] check license_file ...
[INSTALL] Copy license to /data/kescluster/kingbase/../: license.dat
[INSTALL] success to copy /data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip/license.dat to /data/kescluster/kingbase/../ on 192.168.40.111
[INSTALL] check license_file ...
[INSTALL] Copy license to /data/kescluster/kingbase/../: license.dat
[INSTALL] success to copy /data/kesclusterinstall/KESRealPro/V009R001C002B0014/ClientTools/guitools/DeployTools/zip/license.dat to /data/kescluster/kingbase/../ on 192.168.40.112
[INSTALL] set the archive_command to "exit 0" and the archive dir is NULL
[INSTALL] the archive dir is NULL, not do archive ...
[INSTALL] create the dir "etc" "log" on all host
[RUNNING] config sys_securecmdd and start it ...
[RUNNING] config the sys_securecmdd port to 8890 ...
[RUNNING] success to config the sys_securecmdd port on 192.168.40.111 ... OK
successfully initialized the sys_securecmdd, please use "/data/kescluster/kingbase/bin/sys_HAscmdd.sh start" to start the sys_securecmdd
[RUNNING] success to config sys_securecmdd on 192.168.40.111 ... OK
Created symlink /etc/systemd/system/multi-user.target.wants/securecmdd.service → /etc/systemd/system/securecmdd.service.
[RUNNING] success to start sys_securecmdd on 192.168.40.111 ... OK
[RUNNING] config sys_securecmdd and start it ...
[RUNNING] config the sys_securecmdd port to 8890 ...
[RUNNING] success to config the sys_securecmdd port on 192.168.40.112 ... OK
successfully initialized the sys_securecmdd, please use "/data/kescluster/kingbase/bin/sys_HAscmdd.sh start" to start the sys_securecmdd
[RUNNING] success to config sys_securecmdd on 192.168.40.112 ... OK
Created symlink /etc/systemd/system/multi-user.target.wants/securecmdd.service → /etc/systemd/system/securecmdd.service.
[RUNNING] success to start sys_securecmdd on 192.168.40.112 ... OK
[RUNNING] check if the host can be reached between all nodes by scmd ...
[RUNNING] success connect to "192.168.40.111" from "192.168.40.111" by '/data/kescluster/kingbase/bin/sys_securecmd' ... OK
[RUNNING] success connect to "192.168.40.112" from "192.168.40.111" by '/data/kescluster/kingbase/bin/sys_securecmd' ... OK
[RUNNING] success connect to "192.168.40.111" from "192.168.40.112" by '/data/kescluster/kingbase/bin/sys_securecmd' ... OK
[RUNNING] success connect to "192.168.40.112" from "192.168.40.112" by '/data/kescluster/kingbase/bin/sys_securecmd' ... OK
[INSTALL] begin to init the database on "192.168.40.111" ...
The database cluster will be initialized with localesCOLLATE:  zh_CN.UTF-8CTYPE:    zh_CN.UTF-8MESSAGES: CMONETARY: zh_CN.UTF-8NUMERIC:  zh_CN.UTF-8TIME:     zh_CN.UTF-8
The files belonging to this database system will be owned by user "kingbase".
This user must also own the server process.The default text search configuration will be set to "simple".The comparision of strings is case-sensitive.
Data page checksums are enabled.fixing permissions on existing directory /data/kesdata ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Shanghai
creating configuration files ... ok
Begin setup encrypt device
initializing the encrypt device ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
create security database ... ok
load security database ... ok
syncing data to disk ... okSuccess. You can now start the database server using:/data/kescluster/kingbase/bin/sys_ctl -D /data/kesdata -l logfile start[INSTALL] end to init the database on "192.168.40.111" ... OK
[INSTALL] wirte the kingbase.conf on "192.168.40.111" ...
[INSTALL] wirte the kingbase.conf on "192.168.40.111" ... OK
[INSTALL] wirte the es_rep.conf on "192.168.40.111" ...
[INSTALL] wirte the es_rep.conf on "192.168.40.111" ... OK
[INSTALL] wirte the sys_hba.conf on "192.168.40.111" ...
[INSTALL] wirte the sys_hba.conf on "192.168.40.111" ... OK
[INSTALL] wirte the .encpwd on every host
[INSTALL] write the repmgr.conf on every host
[INSTALL] write the repmgr.conf on "192.168.40.111" ...
[INSTALL] write the repmgr.conf on "192.168.40.111" ... OK
[INSTALL] write the repmgr.conf on "192.168.40.112" ...
[INSTALL] write the repmgr.conf on "192.168.40.112" ... OK
[INSTALL] start up the database on "192.168.40.111" ...
[INSTALL] /data/kescluster/kingbase/bin/sys_ctl -w -t 60 -l /data/kescluster/kingbase/logfile -D /data/kesdata start
waiting for server to start.... done
server started
[INSTALL] start up the database on "192.168.40.111" ... OK
[INSTALL] create the database "esrep" and user "esrep" for repmgr ...
CREATE DATABASE
CREATE ROLE
GRANT
GRANT ROLE
[INSTALL] create the database "esrep" and user "esrep" for repmgr ... OK
[INSTALL] register the primary on "192.168.40.111" ...
[INFO] connecting to primary database...
[NOTICE] attempting to install extension "repmgr"
[NOTICE] "repmgr" extension successfully installed
[NOTICE] PING 192.168.40.115 (192.168.40.115) 56(84) bytes of data.--- 192.168.40.115 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1004ms[WARNING] ping host"192.168.40.115" failed
[DETAIL] average RTT value is not greater than zero
[INFO] loadvip result: true, arping result: true
[NOTICE] node (ID: 1) acquire the virtual ip 192.168.40.115 success
[NOTICE] primary node record (ID: 1) registered
[INSTALL] register the primary on "192.168.40.111" ... OK
[INSTALL] clone and start up the standby ...
clone the standby on "192.168.40.112" ...
/data/kescluster/kingbase/bin/repmgr -h 192.168.40.111 -U esrep -d esrep -p 54321 --fast-checkpoint --upstream-node-id 1 standby clone
[NOTICE] destination directory "/data/kesdata" provided
[INFO] connecting to source node
[DETAIL] connection string is: host=192.168.40.111 user=esrep port=54321 dbname=esrep
[DETAIL] current installation size is 87 MB
[NOTICE] checking for available walsenders on the source node (2 required)
[NOTICE] checking replication connections can be made to the source server (2 required)
[INFO] checking and correcting permissions on existing directory "/data/kesdata"
[INFO] creating replication slot as user "esrep"
[NOTICE] starting backup (using sys_basebackup)...
[INFO] executing:/data/kescluster/kingbase/bin/sys_basebackup -l "repmgr base backup"  -D /data/kesdata -h 192.168.40.111 -p 54321 -U esrep -c fast -X stream -S repmgr_slot_2
[NOTICE] standby clone (using sys_basebackup) complete
[NOTICE] you can now start your Kingbase server
[HINT] for example: sys_ctl -D /data/kesdata start
[HINT] after starting the server, you need to register this standby with "repmgr standby register"
clone the standby on "192.168.40.112" ... OK
start up the standby on "192.168.40.112" ...
/data/kescluster/kingbase/bin/sys_ctl -w -t 60 -l /data/kescluster/kingbase/logfile -D /data/kesdata start
waiting for server to start.... done
server started
start up the standby on "192.168.40.112" ... OK
register the standby on "192.168.40.112" ...
[INFO] connecting to local node "node2" (ID: 2)
[INFO] connecting to primary database
[INFO] standby registration complete
[NOTICE] standby node "node2" (ID: 2) successfully registered
[INSTALL] register the standby on "192.168.40.112" ... OK
[INSTALL] start up the whole cluster ...
2025-05-28 17:33:26 Ready to start all DB ...
2025-05-28 17:33:26 begin to start DB on "[192.168.40.111]".
2025-05-28 17:33:27 DB on "[192.168.40.111]" already started, connect to check it.
2025-05-28 17:33:29 DB on "[192.168.40.111]" start success.
2025-05-28 17:33:29 Try to ping trusted_servers on host 192.168.40.111 ...
2025-05-28 17:33:31 Try to ping trusted_servers on host 192.168.40.112 ...
2025-05-28 17:33:34 begin to start DB on "[192.168.40.112]".
2025-05-28 17:33:35 DB on "[192.168.40.112]" already started, connect to check it.
2025-05-28 17:33:36 DB on "[192.168.40.112]" start success.ID | Name  | Role    | Status    | Upstream | Location | Priority | Timeline | LSN_Lag | Connection string
----+-------+---------+-----------+----------+----------+----------+----------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------1  | node1 | primary | * running |          | default  | 100      | 1        |         | host=192.168.40.111 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=2 keepalives_interval=2 keepalives_count=3 tcp_user_timeout=90002  | node2 | standby |   running | node1    | default  | 100      | 1        | 0 bytes | host=192.168.40.112 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=2 keepalives_interval=2 keepalives_count=3 tcp_user_timeout=9000
2025-05-28 17:33:36 The primary DB is started.
2025-05-28 17:33:40 Success to load virtual ip [192.168.40.115] on primary host [192.168.40.111].
2025-05-28 17:33:40 Try to ping vip on host 192.168.40.111 ...
2025-05-28 17:33:43 Try to ping vip on host 192.168.40.112 ...
2025-05-28 17:33:46 begin to start repmgrd on "[192.168.40.111]".
[2025-05-28 17:33:46] [NOTICE] using provided configuration file "/data/kescluster/kingbase/bin/../etc/repmgr.conf"
[2025-05-28 17:33:46] [NOTICE] redirecting logging output to "/data/kescluster/kingbase/log/hamgr.log"2025-05-28 17:33:48 repmgrd on "[192.168.40.111]" start success.
2025-05-28 17:33:48 begin to start repmgrd on "[192.168.40.112]".
[2025-05-28 17:33:49] [NOTICE] using provided configuration file "/data/kescluster/kingbase/bin/../etc/repmgr.conf"
[2025-05-28 17:33:49] [NOTICE] redirecting logging output to "/data/kescluster/kingbase/log/hamgr.log"2025-05-28 17:33:51 repmgrd on "[192.168.40.112]" start success.ID | Name  | Role    | Status    | Upstream | repmgrd | PID   | Paused? | Upstream last seen
----+-------+---------+-----------+----------+---------+-------+---------+--------------------1  | node1 | primary | * running |          | running | 46621 | no      | n/a2  | node2 | standby |   running | node1    | running | 33864 | no      | 1 second(s) ago
[2025-05-28 17:33:53] [NOTICE] redirecting logging output to "/data/kescluster/kingbase/log/kbha.log"[2025-05-28 17:33:57] [NOTICE] redirecting logging output to "/data/kescluster/kingbase/log/kbha.log"2025-05-28 17:33:59 Done.
[INSTALL] start up the whole cluster ... OK

配置环境变量(所有节点)

--配置环境变量,尾部增加集群安装目录
vi .bashrc
尾部增加
export PATH=$PATH:/data/kescluster/kingbase/bin--环境变量生效
source .bashrc

集群管理

查询集群状态

[kingbase@node1 ~]$ repmgr cluster showID | Name  | Role    | Status    | Upstream | Location | Priority | Timeline | LSN_Lag | Connection string
----+-------+---------+-----------+----------+----------+----------+----------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------1  | node1 | primary | * running |          | default  | 100      | 1        |         | host=192.168.40.111 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=2 keepalives_interval=2 keepalives_count=3 tcp_user_timeout=90002  | node2 | standby |   running | node1    | default  | 100      | 1        | 0 bytes | host=192.168.40.112 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=2 keepalives_interval=2 keepalives_count=3 tcp_user_timeout=9000
[kingbase@node2 ~]$

集群启停

集群的启停通常有两种方式:一键启停和单个节点独立启停。

方式1:一键启停

一键停止
sys_monitor.sh stop
一键启动
sys_monitor.sh start
问题处理
问题描述:一键启动提示logfile: Permission denied

该问题推测是只在数据目录和集群安装目录彼此独立存在的场景下,如果数据目录是在集群安装目录下则不会有该报错。其他该报错可以优化下,毕竟集群安装过程是很顺利的,就一键停止后再一键启动会发生该错误。

[kingbase@node2 ~]$ sys_monitor.sh start
2025-05-29 13:36:57 Ready to start all DB ...
2025-05-29 13:36:57 begin to start DB on "[192.168.40.112]".
waiting for server to start..../bin/sh: line 1: /data/kesdata/../logfile: Permission deniedstopped waiting
sys_ctl: could not start server
Examine the log output.
2025-05-29 13:36:58 execute to start DB on "[192.168.40.112]" failed.
2025-05-29 13:36:58 Start DB on localhost(192.168.40.112) failed, will do nothing and exit.
解决办法
--手动创建logfile文件并赋予权限
su - root
cd /data
touch logfile
chown kingbase:kingbase logfile--一键启动集群正常
sys_monitor start

方式2:手动启停

停止
使用root权限在集群所有节点上注释或删除启动时创建的CRON定时任务
# 进入定时任务编辑模式,通过crontab注释(句首使用#)以下语句:
# * 1 * * * * $user . /etc/profile;$bin_path/kbha -A daemon -f $rep_conf
停止集群所有节点中的守护进程

停止集群所有节点中的守护进程 -- 依次kill守护进程kbha和repmgrd

kill -9 `pidof  kbha repmgrd`
停止集群中所有节点的数据库
--语法
sys_ctl -D $data_directory -l logfile stop--node1
[kingbase@node1 ~]$ sys_ctl -D /data/kesdata -l logfile stop
等待服务器进程关闭 .... 完成
服务器进程已经关闭--node2
[kingbase@node2 ~]$ sys_ctl -D /data/kesdata -l logfile stop
等待服务器进程关闭 ........ 完成
服务器进程已经关闭
启动
检查所有节点目录中是否存在standby.signal文件

检查集群关闭时的状态是否正常,避免后续启动过程中出现双主情况,具体的检查过程如下:

1、查看集群中每个节点数据库的data目录,目录中存在standby.signal文件的节点为备库,反之为主库;

2、集群中可以同时存在多个备库,但是只能存在一个主库,如果检查过程中存在多个主库,切勿贸然启动集群。

--节点1  主节点
[kingbase@node1 ~]$ ls -l /data/kesdata/standby.signal
ls: 无法访问 '/data/kesdata/standby.signal': 没有那个文件或目录--节点2  备节点
[kingbase@node2 ~]$ ls -l /data/kesdata/standby.signal
-rwx------ 1 kingbase kingbase 20  5月 30 10:26 /data/kesdata/standby.signal
依次启动集群中所有节点上的数据库

如果集群状态检查结果无误,执行以下命令依次启动集群中所有数据库。

--语法
sys_ctl -D $data_directory -l logfile start--节点1
[kingbase@node1 ~]$ sys_ctl -D /data/kesdata/ -l logfile start
等待服务器进程启动 .... 完成
服务器进程已经启动--节点2
[kingbase@node2 ~]$ sys_ctl -D /data/kesdata/ -l logfile start
等待服务器进程启动 .... 完成
服务器进程已经启动
依次启动所有节点上的repmgrd守护进程
确定repmgr.conf 文件位置

repmgr.conf 文件位置在集群安装目录的kingbase子目录下的etc子目录中,如下:

[kingbase@node1 kingbase]$ ps -ef | grep repmgr.conf
kingbase    1944       1  0 10:25 ?        00:00:01 /data/kescluster/kingbase/bin/kbha -A daemon -f /data/kescluster/kingbase/bin/../etc/repmgr.conf
kingbase    2211       1  0 10:26 ?        00:00:02 /data/kescluster/kingbase/bin/repmgrd -d -v -f /data/kescluster/kingbase/bin/../etc/repmgr.conf[kingbase@node1 kingbase]$ ls -l /data/kescluster/kingbase/etc/repmgr.conf
-rw-rw-r-- 1 kingbase kingbase 1370  5月 28 17:33 /data/kescluster/kingbase/etc/repmgr.conf
依次启动所有节点上的repmgrd守护进程
--语法
repmgrd -d -v -f $rep_conf--节点1
[kingbase@node1 ~]$ repmgrd -d -v -f /data/kescluster/kingbase/etc/repmgr.conf
[2025-05-30 15:31:13] [NOTICE] using provided configuration file "/data/kescluster/kingbase/etc/repmgr.conf"
[2025-05-30 15:31:13] [NOTICE] redirecting logging output to "/data/kescluster/kingbase/log/hamgr.log"--节点2
[kingbase@node2 ~]$ repmgrd -d -v -f /data/kescluster/kingbase/etc/repmgr.conf
[2025-05-30 15:32:02] [NOTICE] using provided configuration file "/data/kescluster/kingbase/etc/repmgr.conf"
[2025-05-30 15:32:02] [NOTICE] redirecting logging output to "/data/kescluster/kingbase/log/hamgr.log"
依次启动所有节点的kbha守护进程
--语法
kbha -A daemon -f $rep_conf--节点1
[kingbase@node1 ~]$ kbha -A daemon -f /data/kescluster/kingbase/etc/repmgr.conf
[2025-05-30 15:34:43] [NOTICE] redirecting logging output to "/data/kescluster/kingbase/log/kbha.log"--节点2
[kingbase@node2 ~]$ kbha -A daemon -f /data/kescluster/kingbase/etc/repmgr.conf
[2025-05-30 15:34:50] [NOTICE] redirecting logging output to "/data/kescluster/kingbase/log/kbha.log"
依次在所有节点上添加CRON定时任务

需要使用root权限在集群所有节点上添加CRON定时任务

# 进入定时任务编辑模式,通过crontab写入语句:
crontab -e
* 1 * * * * $user . /etc/profile;$bin_path/kbha -A daemon -f $rep_conf

集群主备切换

集群主备切换时指主动让主备角色互换,这种场景和故障自动转移的情况有所不同。自动故障转移是主库故障后,备库升主以替代原主库,这个流程是意外发生、不受控制的。而主备切换一般是在运维过程中由运维人员手动触发的,使主备角色互换。

命令以及详细参数请参考: repmgr standby switchover章节。

查询集群状态

[kingbase@node1 ~]$ repmgr service statusID | Name  | Role    | Status    | Upstream | repmgrd | PID   | Paused? | Upstream last seen
----+-------+---------+-----------+----------+---------+-------+---------+--------------------1  | node1 | primary | * running |          | running | 17463 | no      | n/a2  | node2 | standby |   running | node1    | running | 22541 | no      | 0 second(s) ago

node1节点是主节点,node2节点是备节点

查询集群同步情况

test=# select client_addr,write_lsn,flush_lsn,replay_lsn,sync_state,sync_priority from sys_stat_replication;client_addr   | write_lsn | flush_lsn | replay_lsn | sync_state | sync_priority
----------------+-----------+-----------+------------+------------+---------------192.168.40.112 | 0/E0006E8 | 0/E0006E8 | 0/E0006E8  | quorum     |             1
(1 行记录)

手动将备节点切换为主节点

选择备节点 node2 为新的 primary,在 备节点node2 运行切换命令

--手动将备节点切换为主节点
[kingbase@node2 ~]$ repmgr standby switchover --siblings-follow参数说明:
--siblings-follow            让跟随旧主节点的standby节点跟随新的主节点

输出如下:


[NOTICE] executing switchover on node "node2" (ID: 2)
[INFO] set the primary to the readonly mode
[WARNING] option "--sibling-nodes" specified, but no sibling nodes exist
[INFO] The output from primary check cmd "repmgr node check --terse -LERROR --archive-ready --optformat" is: "--status=OK --files=0
"
[INFO] LSN delay of primary and standby: max LSN delay 0MB on node2, LSN delay 0MB on local node
[NOTICE] attempting to pause repmgrd on 2 nodes
[INFO] pausing repmgrd on node "node1" (ID 1)
[INFO] pausing repmgrd on node "node2" (ID 2)
[NOTICE] local node "node2" (ID: 2) will be promoted to primary; current primary "node1" (ID: 1) will be demoted to standby
[NOTICE] stopping current primary node "node1" (ID: 1)
[NOTICE] issuing CHECKPOINT on node "node1" (ID: 1)
[NOTICE] node (ID: 1) release the virtual ip 192.168.40.115 success
[DETAIL] executing server command "/data/kescluster/kingbase/bin/sys_ctl  -D '/data/kesdata' -l /data/kescluster/kingbase/bin/logfile -W -m fast stop"
[INFO] checking for primary shutdown; 1 of 60 attempts ("shutdown_check_timeout")
[INFO] checking for primary shutdown; 2 of 60 attempts ("shutdown_check_timeout")
[NOTICE] current primary has been cleanly shut down at location 0/F000028
[DETAIL] cancel read-only mode
[DETAIL] success to cancel read-only mode
[NOTICE] please confirm that the primary server is normally connected
[NOTICE] PING 192.168.40.115 (192.168.40.115) 56(84) bytes of data.--- 192.168.40.115 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1009ms[WARNING] ping host"192.168.40.115" failed
[DETAIL] average RTT value is not greater than zero
[INFO] loadvip result: true, arping result: true
[NOTICE] new primary node (ID: 2) acquire the virtual ip 192.168.40.115 success
[NOTICE] promoting standby to primary
[DETAIL] promoting server "node2" (ID: 2) using sys_promote()
[NOTICE] waiting for promotion to complete, replay lsn: 0/F0000A0
[NOTICE] STANDBY PROMOTE successful
[DETAIL] server "node2" (ID: 2) was successfully promoted to primary
[NOTICE] issuing CHECKPOINT
[NOTICE] node "node2" (ID: 2) promoted to primary, node "node1" (ID: 1) demoted to standby
[NOTICE] switchover was successful
[DETAIL] node "node2" is now primary and node "node1" is attached as standby
[INFO] unpausing repmgrd on node "node1" (ID 1)
[INFO] unpause node "node1" (ID 1) successfully
[INFO] unpausing repmgrd on node "node2" (ID 2)
[INFO] unpause node "node2" (ID 2) successfully
[NOTICE] STANDBY SWITCHOVER has completed successfully

从执行切换命令打印的日志信息中不难看出,其大致步骤如下:

  1. 尝试暂停集群中各节点的 repmgrd,因为主备切换过程中需要关闭主库,如果没有暂停 repmgrd,关闭的主库会被再次拉起
  2. node1 上的主库做一次 checkpoint,然后运行 sys_ctl stop,关闭数据库
  3. 移除 node1 节点上的虚拟 IP,并将虚拟 IP 挂载到需要升主的 node2 节点
  4. 在 node2 节点上运行 promote 命令,将数据库提升为 primary
  5. 启动 node1 节点数据库,将其降级为 standby
  6. node3 运行 repmgr standby follow,跟随 node2 上的新主
  7. 取消暂停,将集群中各个节点被暂停的repmgrd恢复正常,主备切换完成
repmgr standby switchover参数解释
描述

只能在备节点执行,把主节点降级为备库,把当前备节点提升为主库。

选项
--always-promote             在任何时候都将备用数据库提升为主数据库,即使它数据落后或偏离原主数据库原主数据库将关闭,需要手动操作才能重新加入集群
--dry_run                    检查先决条件,模拟完整switchover过程,但不会对数据做任何的修改
-F, --force                  忽略warnings信息,继续switchover操作
--force-rewind[=VALUE]       如有必要,会执行sys_rewind把数据同步为跟原主库一致
-R, --remote-user=USERNAME   远程SSH/securecmdd操作的系统用户名(默认为当前操作系统用户)
-S, --superuser=USERNAME     使用超级用户代替普通流复制用户执行需要超级用户权限的操作
--repmgrd-no-pause           不要在执行切换时暂停repmgrd
--siblings-follow            让跟随旧主节点的standby节点跟随新的主节点
--archive-mode={ignore|default|archive}指定执行主备切换时对未归档文件处理方式ignore:忽略未归档的WAL文件并快速关闭archive进程default:未归档WAL文件数量不能超过限制(默认128个)archive:等待所有未归档WAL文件归档完成,如果归档文件长时间(60秒)未减少将中止切换流程
--lsnpending=VALUE           主备之间允许的最大LSN延迟(默认512MB),超过此限制则不允许切换,单位:MB
--wait                       等待WAL文件传输完成,使用此参数时,--lsnpending参数不再有效
--choose                     检查哪些备库可以执行“repmgr standby switchover”命令
退出码

SUCCESS (0) :切换成功。

ERR_SWITCHOVER_FAIL (18) :切换命令执行失败。

ERR_SWITCHOVER_INCOMPLETE (22) :已执行切换,但遇到了问题。通常是以前的主数据库无法作为备数据库重新加入集群。

事件通知

standby_switchover

查看集群状态

[kingbase@node1 ~]$ repmgr service statusID | Name  | Role    | Status    | Upstream | repmgrd | PID   | Paused? | Upstream last seen
----+-------+---------+-----------+----------+---------+-------+---------+--------------------1  | node1 | standby |   running | node2    | running | 17463 | no      | 1 second(s) ago2  | node2 | primary | * running |          | running | 22541 | no      | n/a

http://www.hkcw.cn/article/ckTLVcbXAE.shtml

相关文章

南部战区海军多艘舰艇实战化演练 提升协同作战能力

南部战区海军某训练中心联合某驱逐舰支队组织渭南舰、玉林舰等多艘舰艇,在多个海域展开多个课目训练,旨在检验编队协同作战能力和指挥员决策水平。在编队航行途中,突然接到上级通报,当前活动海区有敌方无人艇活动。各舰立即进入战斗状态。渭南舰雷达战位敏锐发现不明海上目…

乌对俄发动大规模特种作战 美方回应 未提前获知袭击计划

当地时间6月1日,美国政府官员表示,特朗普政府并未提前得知乌克兰将在周末对俄罗斯发起的大规模袭击行动。同一天,乌克兰国家安全局在社交媒体上宣布,对俄罗斯实施了特种作战行动,袭击了俄军的战略轰炸机。乌克兰总统泽连斯基当晚发表视频讲话称,乌国家安全局为此行动筹备…

VisionPro项目记录2 —— 不规则胶路检测

简介 本文介绍了一种基于Cognex视觉工具的胶路检测方法,分为直线和弧形两部分检测。 直线部分采用卡尺工具检测胶路宽度,通过动态调整仿射矩形区域进行多位置测量;弧形部分使用blob工具沿圆周设置检测区域。 两种方法均通过脚本实现工具映…

STM32F407寄存器操作(多通道单ADC+DMA)

1.前言 又是半年没更新了,趁着端午放假有点时间,并且最近项目要用这块知识,我就顺带研究一下ADC吧。 一般来说ADC主要用法包含了1.单通道软件触发(这是最简单和最常用的用法)2.单通道多次采集(需要快速采…

RuoYi前后端分离框架实现前后端数据传输加密(二)之前端篇

一、背景 本文是RuoYi前后端分离框架实现前后端数据传输加密(一)之后端篇文章配套的,主要介绍前端对自定义字段传输加密的实现,两篇文章结合可以完整的完成RuoYi前后端分离框架对API通信过程中实现自定义字段加密传输。前端的加解密实现,不涉及到界面的修改,仅仅是方法的…

马斯克称不想为美政府所做一切担责 “政府效率部”成替罪羊

美国企业家埃隆马斯克在接受哥伦比亚广播公司采访时表达了对政府的看法。他表示自己并不想公开反对美国政府,但也不愿意为政府所做的一切承担责任。马斯克提到,他领导的“政府效率部”成了所有问题的替罪羊,所有的裁员无论真假都被归咎于这个部门。马斯克还表示,他对国会共…

苏超第三轮全部战罢 南通队强势领跑

6月1日晚9时28分,江苏省城市足球联赛第三轮结束。本轮赛事分为两个比赛日进行。5月31日,镇江队0∶2不敌宿迁队,常州队0∶1负于扬州队,徐州队2∶1战胜连云港队。6月1日,盐城队1∶0击败淮安队,泰州队0∶4输给南通队,南京队与无锡队的比赛以1∶0结束。本轮联赛中,南通队和…

节后粽子有买三送一还有6折出售 促销力度大吸引顾客

作为传统节令食品,粽子在今年端午节期间再次成为餐桌主角。与往年不同的是,除了经典的“咸甜之争”外,“低卡”、“低脂”等健康概念成为今年粽子市场的新亮点。据《2025中国粽子行业白皮书》,从规模上来看,2025年中国粽子行业市场规模将达到110亿元,增长率在7%左右,产量…

泽连斯基再提乌俄领导人会晤 需达成具体协议

据法新社报道,俄罗斯总统新闻秘书佩斯科夫周三对乌克兰总统泽连斯基呼吁举行美俄乌三国领导人会谈一事作出回应。佩斯科夫表示,只有在俄乌双方达成具体协议后,才有可能举行此类会谈。他强调,这样的会谈应是乌克兰和俄罗斯代表团之间达成具体协议的结果。此前,乌克兰总统泽…

3、禁止树莓派屏幕休眠,设置树莓派屏幕常亮

树莓派是微型电脑,系统自带休眠保护功能,但是有人可能会处理一些事务,想树莓派屏幕常亮,保证树莓派一直都处于活动状态,今天分享如何让树莓派屏幕常亮,禁止休眠的解决方案。 1、 系统:raspbia…

巴黎欧冠夺冠狂欢夜559人被捕 暴力事件引发谴责

法甲球队巴黎圣日耳曼在5月31日晚赢得欧冠联赛冠军奖杯,法国多地的球迷彻夜庆祝。然而,据法国内政部消息,在狂欢夜有559人因滋事被捕,并发生了两起命案。6月1日,法国总统马克龙在爱丽舍宫接见巴黎圣日耳曼球队时,严厉谴责了庆祝活动中发生的暴力事件,称这些行为“不可接…

英国耗资百亿英镑新建核潜艇 备战状态升级

英国首相斯塔默表示,他将“恢复英国的战备状态”,并将提高英国的武器生产能力。6月2日,英国政府发布了《战略国防评估》,这份报告评估了英国面临的威胁,包括俄乌冲突及美国总统特朗普向北约盟国施压,要求提高国防开支及加强防御等情况。该报告呼吁英国武装部队进入“备战…

飞牛fnNAS装机之迷你小主机的利旧

前几天找Console线的时候,翻出一台迷你小主机,想起来以前是做“软路由”用的,现在用不上了。本想放回箱子,但突然想起最近正在做飞牛NAS的专题,不如将其改造成NAS得了。 这个东东有HDMI、VGA接口,2个USB(其中一个支持3.0),还有4个网口。 打开机盖,看看内部情况。发现…

2025年渗透测试面试题总结-奇安信[校招]奇安信观星实验室(题目+回答)

安全领域各种资源,学习文档,以及工具分享、前沿信息分享、POC、EXP分享。不定期分享各种好玩的项目及好用的工具,欢迎关注。 目录 奇安信[校招]奇安信观星实验室 1. 跟过的大型应用软件CVE漏洞 2. 容器虚拟化漏洞研究 3. 系统审计案例与漏…

郑钦文法网对阵萨巴伦卡 山海皆可平

6月1日,在法国网球公开赛女单第四轮比赛中,中国选手郑钦文以2比1战胜俄罗斯选手萨姆索诺娃,首次闯入法网女单8强。赛后,郑钦文发文:“人都应该有梦,有梦就别怕痛,是一颗宝石就该闪烁”,并鼓励大家勇敢追梦。在另一场1/8决赛中,头号种子萨巴伦卡把握住第八个赛点,以7-…

英首相称将恢复英国战备状态 提升武器生产能力至战时水平

英国首相基尔斯塔默表示,将恢复英国的“战备状态”,以此作为武装部队的核心目标。他表示,英国将把武器生产能力提升至战时水平。斯塔默在《太阳报》刊文称,英国正面临一个更加危险的世界,现在是时候改变保卫这些岛屿的方式了。斯塔默强调,英国将直面这一时刻,采取大多数…

动态规划第二弹:路径类问题(不同路径,珠宝的最高价值,地下城游戏)

目录 前言 1. 不同路径 (1)题目及示例 (2)解题思路 (3)代码 2. 珠宝的最高价值 (1)题目及示例 (2)解题思路 (3)代码 3. 地下…

LabVIEW双光子显微镜开发

基于LabVIEW 开发高性能双光子显微镜系统,聚焦于生物样本深层成像与纳米材料三维表征。实现了超快激光控制、多维数据采集与实时图像重建。系统采用飞秒激光光源与高精度振镜扫描模块,结合 LabVIEW 的 FPGA 实时控制能力,可对活体组织、荧光纳…

C++校园植树节活动 全国信息素养大赛复赛决赛 C++小学/初中组 算法创意实践挑战赛 内部集训模拟题详细解析

C++校园植树节活动 全国信息素养大赛 C++复赛/决赛模拟训练题 博主推荐 所有考级比赛学习相关资料合集【推荐收藏】1、C++专栏 电子学会C++一级历年真题解析电子学会C&#

题海拾贝:压缩字符串

Hello大家好&#xff01;很高兴我们又见面啦&#xff01;给生活添点passion&#xff0c;开始今天的编程之路&#xff01; 我的博客&#xff1a;<但凡. 我的专栏&#xff1a;《编程之路》、《数据结构与算法之美》、《题海拾贝》、《C修炼之路》 欢迎点赞&#xff0c;关注&am…