【PG】PostgreSQL高可用 之repmgr常用命令

注册 / 取消注册(register)

repmgr -f /etc/repmgr.conf primary register
repmgr -f /etc/repmgr.conf standby registerrepmgr -f /etc/repmgr.conf primary unregister -F --node-id=2
repmgr -f /etc/repmgr.conf standby  unregister

克隆主库(repmgr standby clone)

克隆之前进行检查

 repmgr -h 10.79.21.29 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone --dry-run

真实执行 

$repmgr -h 10.79.21.30 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone
NOTICE: destination directory "/home/storage/pgsql/data" provided
INFO: connecting to source node
DETAIL: connection string is: host=10.79.21.30 user=repmgr dbname=repmgr
DETAIL: current installation size is 115 MB
INFO: replication slot usage not requested;  no replication slot will be set up for this standby
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 "/home/storage/pgsql/data"
NOTICE: starting backup (using pg_basebackup)...
HINT: this may take some time; consider using the -c/--fast-checkpoint option
INFO: executing:/usr/local/pgsql/bin/pg_basebackup -l "repmgr base backup"  -D /home/storage/pgsql/data -h 10.79.21.30 -p 5432 -U repmgr -X stream
NOTICE: standby clone (using pg_basebackup) complete
NOTICE: you can now start your PostgreSQL server
HINT: for example: /usr/local/pgsql/bin/pg_ctl  -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log start
HINT: after starting the server, you need to register this standby with "repmgr standby register"

提升从库为主 (repmgr standby promote)

场景

如果主服务器发生故障或需要从复制集群中删除,则必须指定新的主服务器,以确保集群继续正常运行。可以通过repmgr standby promote 来完成,它将当前服务器上的备用服务器提升为主服务器。

查看状态

$repmgr -f /etc/repmgr.conf cluster showID | Name  | Role    | Status    | Upstream | Location | Priority | Timeline | Connection string
----+-------+---------+-----------+----------+----------+----------+----------+------------------------------------------------------------------------1  | node1 | primary | * running |          | default  | 100      | 3        | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=22  | node2 | standby |   running | node1    | default  | 100      | 3        | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2

停止主库 

 pg_ctl  -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log stop

再次查看状态(从节点)

$repmgr -f /etc/repmgr.conf cluster showID | Name  | Role    | Status        | Upstream | Location | Priority | Timeline | Connection string
----+-------+---------+---------------+----------+----------+----------+----------+------------------------------------------------------------------------1  | node1 | primary | ? unreachable | ?        | default  | 100      |          | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=22  | node2 | standby |   running     | ? node1  | default  | 100      | 3        | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2WARNING: following issues were detected- unable to connect to node "node1" (ID: 1)- node "node1" (ID: 1) is registered as an active primary but is unreachable- unable to connect to node "node2" (ID: 2)'s upstream node "node1" (ID: 1)- unable to determine if node "node2" (ID: 2) is attached to its upstream node "node1" (ID: 1)HINT: execute with --verbose option to see connection error messages

提升从节点(在从节点上执行)

repmgr -f /etc/repmgr.conf standby promote --log-level=debug --verbose

如果想查看详细的日志输出 可以添加 --log-level=debug --verbose

$repmgr -f /etc/repmgr.conf standby promote --log-level=debug --verbose
NOTICE: using provided configuration file "/etc/repmgr.conf"
DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.29 port=5432 fallback_application_name=repmgr options=-csearch_path="
DEBUG: set_config():SET synchronous_commit TO 'local'
INFO: connected to standby, checking its state
DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
DEBUG: get_node_record():SELECT n.node_id, n.type, n.upstream_node_id, n.node_name,  n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached   FROM repmgr.nodes n  WHERE n.node_id = 2
INFO: searching for primary node
DEBUG: get_primary_connection():SELECT node_id, conninfo,          CASE WHEN type = 'primary' THEN 1 ELSE 2 END AS type_priority	   FROM repmgr.nodes    WHERE active IS TRUE      AND type != 'witness' ORDER BY active DESC, type_priority, priority, node_id
INFO: checking if node 1 is primary
DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path="
ERROR: connection to database failed
DETAIL:
could not connect to server: Connection refusedIs the server running on host "10.79.21.30" and acceptingTCP/IP connections on port 5432?DETAIL: attempted to connect using:user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path=
INFO: checking if node 2 is primary
DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.29 port=5432 fallback_application_name=repmgr options=-csearch_path="
DEBUG: set_config():SET synchronous_commit TO 'local'
DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
DEBUG: get_node_replication_stats():SELECT pg_catalog.current_setting('max_wal_senders')::INT AS max_wal_senders,         (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS attached_wal_receivers,         current_setting('max_replication_slots')::INT AS max_replication_slots,         (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE slot_type='physical') AS total_replication_slots,         (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS TRUE AND slot_type='physical')  AS active_replication_slots,         (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS FALSE AND slot_type='physical') AS inactive_replication_slots,         pg_catalog.pg_is_in_recovery() AS in_recovery
DEBUG: get_active_sibling_node_records():SELECT n.node_id, n.type, n.upstream_node_id, n.node_name,  n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached     FROM repmgr.nodes n    WHERE n.upstream_node_id = 1      AND n.node_id != 2      AND n.active IS TRUE ORDER BY n.node_id
DEBUG: clear_node_info_list() - closing open connections
DEBUG: clear_node_info_list() - unlinking
DEBUG: get_node_record():SELECT n.node_id, n.type, n.upstream_node_id, n.node_name,  n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached   FROM repmgr.nodes n  WHERE n.node_id = 2
NOTICE: promoting standby to primary
DETAIL: promoting server "node2" (ID: 2) using pg_promote()
NOTICE: waiting up to 60 seconds (parameter "promote_check_timeout") for promotion to complete
DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
INFO: standby promoted to primary after 1 second(s)
DEBUG: setting node 2 as primary and marking existing primary as failed
DEBUG: begin_transaction()
DEBUG: commit_transaction()
NOTICE: STANDBY PROMOTE successful
DETAIL: server "node2" (ID: 2) was successfully promoted to primary
DEBUG: _create_event(): event is "standby_promote" for node 2
DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
DEBUG: _create_event():INSERT INTO repmgr.events (              node_id,              event,              successful,              details             )       VALUES ($1, $2, $3, $4)    RETURNING event_timestamp
DEBUG: _create_event(): Event timestamp is "2023-11-15 19:31:25.636843+08"
DEBUG: clear_node_info_list() - closing open connections
DEBUG: clear_node_info_list() - unlinking

查看状态 

$repmgr -f /etc/repmgr.conf cluster showID | Name  | Role    | Status    | Upstream | Location | Priority | Timeline | Connection string
----+-------+---------+-----------+----------+----------+----------+----------+------------------------------------------------------------------------1  | node1 | primary | - failed  | ?        | default  | 100      |          | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=22  | node2 | primary | * running |          | default  | 100      | 4        | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2WARNING: following issues were detected- unable to connect to node "node1" (ID: 1)HINT: execute with --verbose option to see connection error messages

孤立的备用服务器成为新主的从(repmgr standby follow)

场景

在复制集群的现有主服务器发生故障或删除之后,repmgr standby follow可用于使“孤立”备用服务器成为新的主服务器的从 并追赶上其当前状态

repmgr -f /etc/repmgr.conf standby follow

计划内切换(repmgr  standby swtichover)

场景

在某些情况下,需要以有计划的方式提升备用数据库,例如,主数据库上需要执行维护;repmgr  standby swtichover 命令支持这种切换。

repmgr standby switchover与其他repmgr 操作的不同之处在于,它还在其他服务器(降级候选服务器,以及可选的任何遵循新主服务器的其他服务器)上执行操作,这意味着从执行的服务器到这些服务器需要无密码 SSH 访问 。

查看状态

repmgr -f /etc/repmgr.conf cluster show

$repmgr -f /etc/repmgr.conf cluster showID | Name  | Role    | Status    | Upstream | Location | Priority | Timeline | Connection string
----+-------+---------+-----------+----------+----------+----------+----------+------------------------------------------------------------------------1  | node1 | primary | * running |          | default  | 100      | 1        | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=22  | node2 | standby |   running | node1    | default  | 100      | 1        | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2

准备切换

切换操作的成功取决于 repmgr能否快速、干净地关闭当前主服务器。

确保被升级的候选者有足够的空闲 walsender 可用(PostgreSQL 配置项max_wal_senders),并且如果复制槽正在使用中,则至少有一个空闲槽可用于降级候选者(PostgreSQL 配置项max_replication_slots)。

确保可以从升级候选者(standby)到降级候选者(current primary)进行无密码 SSH 连接。如果--siblings-follow 使用,请确保被从升级的候选者到附加到降级候选者的所有节点(包括 witness server,如果正在使用)可以进行无密码 SSH 连接。

再次检查哪些命令将用于停止/启动/重新启动当前主节点

repmgr -f /etc/repmgr.conf node service --list-actions --action=stop
repmgr -f /etc/repmgr.conf node service --list-actions --action=start
repmgr -f /etc/repmgr.conf node service --list-actions --action=restart

执行前检查

repmgr standby switchover使用 --dry-run选项执行前检查;这将执行任何必要的检查并通知成功/失败,并在运行第一个实际命令(关闭当前的主节点)之前停止

repmgr standby switchover -f /etc/repmgr.conf --dry-run --verbose --log-level=debug

$repmgr standby switchover -f /etc/repmgr.conf --dry-run --verbose --log-level=debug
NOTICE: using provided configuration file "/etc/repmgr.conf"
DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.29 port=5432 fallback_application_name=repmgr options=-csearch_path="
DEBUG: set_config():SET synchronous_commit TO 'local'
DEBUG: get_node_record():SELECT n.node_id, n.type, n.upstream_node_id, n.node_name,  n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached   FROM repmgr.nodes n  WHERE n.node_id = 2
NOTICE: checking switchover on node "node2" (ID: 2) in --dry-run mode
DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
INFO: searching for primary node
DEBUG: get_primary_connection():SELECT node_id, conninfo,          CASE WHEN type = 'primary' THEN 1 ELSE 2 END AS type_priority	   FROM repmgr.nodes    WHERE active IS TRUE      AND type != 'witness' ORDER BY active DESC, type_priority, priority, node_id
INFO: checking if node 1 is primary
DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path="
DEBUG: set_config():SET synchronous_commit TO 'local'
DEBUG: get_recovery_type(): SELECT pg_catalog.pg_is_in_recovery()
INFO: current primary node is 1
DEBUG: get_node_record():SELECT n.node_id, n.type, n.upstream_node_id, n.node_name,  n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached   FROM repmgr.nodes n  WHERE n.node_id = 1
DEBUG: remote node name is "node1"
DEBUG: test_ssh_connection(): executing ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /bin/true 2>/dev/null
INFO: SSH connection to host "10.79.21.30" succeeded
DEBUG: remote_command():ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf  -L debug --version >/dev/null 2>&1 && echo "1" || echo "0"
DEBUG: remote_command(): output returned was:
1DEBUG: remote_command():ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf  -L debug --version 2>/dev/null
DEBUG: remote_command(): output returned was:
repmgr 5.3.3DEBUG: "repmgr" version on "10.79.21.30" is 50303
DEBUG: remote_command():ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 test -f /etc/repmgr.conf && echo 1 || echo 0
DEBUG: remote_command(): output returned was:
1DEBUG: remote_command():ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf  -L debug node check --data-directory-config --optformat -LINFO 2>/dev/null
DEBUG: remote_command(): output returned was:
--configured-data-directory=OKINFO: able to execute "repmgr" on remote host "10.79.21.30"
DEBUG: remote_command():ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf  -L debug node check --replication-config-owner --optformat -LINFO 2>/dev/null
DEBUG: remote_command(): output returned was:
--replication-config-owner=OKDEBUG: get_node_replication_stats():SELECT pg_catalog.current_setting('max_wal_senders')::INT AS max_wal_senders,         (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS attached_wal_receivers,         current_setting('max_replication_slots')::INT AS max_replication_slots,         (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE slot_type='physical') AS total_replication_slots,         (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS TRUE AND slot_type='physical')  AS active_replication_slots,         (SELECT pg_catalog.count(*) FROM pg_catalog.pg_replication_slots WHERE active IS FALSE AND slot_type='physical') AS inactive_replication_slots,         pg_catalog.pg_is_in_recovery() AS in_recovery
DEBUG: get_active_sibling_node_records():SELECT n.node_id, n.type, n.upstream_node_id, n.node_name,  n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached     FROM repmgr.nodes n    WHERE n.upstream_node_id = 1      AND n.node_id != 2      AND n.active IS TRUE ORDER BY n.node_id
DEBUG: clear_node_info_list() - closing open connections
DEBUG: clear_node_info_list() - unlinking
INFO: 1 walsenders required, 10 available
DEBUG: remote_command():ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf  -L debug node check --remote-node-id=2 --replication-connection
DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path="
DEBUG: remote_command(): output returned was:
--connection=OKINFO: demotion candidate is able to make replication connection to promotion candidate
DEBUG: guc_set():
SELECT true FROM pg_catalog.pg_settings  WHERE name = 'archive_mode' AND setting != 'off'
DEBUG: remote_command():ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf  -L debug node check --terse -LERROR --archive-ready --optformat
DEBUG: remote_command(): output returned was:
--status=OK --files=0INFO: 0 pending archive files
DEBUG: get_replication_lag_seconds():SELECT CASE WHEN (pg_catalog.pg_last_wal_receive_lsn() = pg_catalog.pg_last_wal_replay_lsn())           THEN 0         ELSE EXTRACT(epoch FROM (pg_catalog.clock_timestamp() - pg_catalog.pg_last_xact_replay_timestamp()))::INT           END         AS lag_seconds
DEBUG: lag is 0
INFO: replication lag on this standby is 0 seconds
DEBUG: get_all_node_records():SELECT n.node_id, n.type, n.upstream_node_id, n.node_name,  n.conninfo, n.repluser, n.slot_name, n.location, n.priority, n.active, n.config_file, '' AS upstream_node_name, NULL AS attached     FROM repmgr.nodes n ORDER BY n.node_id
DEBUG: clear_node_info_list() - closing open connections
DEBUG: clear_node_info_list() - unlinking
NOTICE: attempting to pause repmgrd on 2 nodes
DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.30 port=5432 fallback_application_name=repmgr options=-csearch_path="
DEBUG: set_config():SET synchronous_commit TO 'local'
DEBUG: connecting to: "user=repmgr connect_timeout=2 dbname=repmgr host=10.79.21.29 port=5432 fallback_application_name=repmgr options=-csearch_path="
DEBUG: set_config():SET synchronous_commit TO 'local'
NOTICE: local node "node2" (ID: 2) would be promoted to primary; current primary "node1" (ID: 1) would be demoted to standby
DEBUG: remote_command():ssh -o Batchmode=yes -q -o ConnectTimeout=10 10.79.21.30 /usr/local/pgsql/bin/repmgr -f /etc/repmgr.conf  -L debug node service --terse -LERROR --list-actions --action=stop
DEBUG: remote_command(): output returned was:
/usr/local/pgsql/bin/pg_ctl  -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log stopINFO: following shutdown command would be run on node "node1":"/usr/local/pgsql/bin/pg_ctl  -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log stop"
INFO: parameter "shutdown_check_timeout" is set to 60 seconds
DEBUG: clear_node_info_list() - closing open connections
DEBUG: clear_node_info_list() - unlinking
INFO: prerequisites for executing STANDBY SWITCHOVER are met

执行切换

repmgr -f /etc/repmgr.conf standby switchover 

$repmgr -f /etc/repmgr.conf standby switchover
NOTICE: executing switchover on node "node2" (ID: 2)
NOTICE: attempting to pause repmgrd on 2 nodes
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)
DETAIL: executing server command "/usr/local/pgsql/bin/pg_ctl  -D '/home/storage/pgsql/data' -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/10000028
NOTICE: promoting standby to primary
DETAIL: promoting server "node2" (ID: 2) using pg_promote()
NOTICE: waiting up to 60 seconds (parameter "promote_check_timeout") for promotion to complete
NOTICE: STANDBY PROMOTE successful
DETAIL: server "node2" (ID: 2) was successfully promoted to primary
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
NOTICE: STANDBY SWITCHOVER has completed successfully

再次查看状态切换成功

[postgres@ehr-db-mysql-test-s01.zjy:/home/storage/repmgr]$repmgr -f /etc/repmgr.conf cluster showID | Name  | Role    | Status    | Upstream | Location | Priority | Timeline | Connection string
----+-------+---------+-----------+----------+----------+----------+----------+------------------------------------------------------------------------1  | node1 | standby |   running | node2    | default  | 100      | 1        | host=10.79.21.30 port=5432 user=repmgr dbname=repmgr connect_timeout=22  | node2 | primary | * running |          | default  | 100      | 2        | host=10.79.21.29 port=5432 user=repmgr dbname=repmgr connect_timeout=2

报错1 ERROR: unable to execute "repmgr" on "10.79.21.30"

原因 :没有设置pg_bindir参数

解决 : 配置文件添加pg_bindir参数

$repmgr -f /etc/repmgr.conf standby switchover
NOTICE: executing switchover on node "node2" (ID: 2)
ERROR: unable to execute "repmgr" on "10.79.21.30"
HINT: check "pg_bindir" is set to the correct path in "repmgr.conf"; current value: (not set)

报错2 ERROR: shutdown of the primary server could not be confirmed

repmgr -f /etc/repmgr.conf standby switchover
NOTICE: executing switchover on node "node2" (ID: 2)
NOTICE: attempting to pause repmgrd on 2 nodes
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)
DETAIL: executing server command "pg_ctl  -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log 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")
...
INFO: checking for primary shutdown; 60 of 60 attempts ("shutdown_check_timeout")
ERROR: shutdown of the primary server could not be confirmed
HINT: check the primary server status before performing any further actions

解决:

参数改为绝对路径

service_start_command='/usr/local/pgsql/bin/pg_ctl  -D /home/storage/pgsql/data -l /home/storage/pgsql/data/server.log start'

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

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

相关文章

【Linux】-进程间通信-命名管道文件(没有关系的进程间进行通信),以及写一个日志模板

💖作者:小树苗渴望变成参天大树🎈 🎉作者宣言:认真写好每一篇博客💤 🎊作者gitee:gitee✨ 💞作者专栏:C语言,数据结构初阶,Linux,C 动态规划算法🎄 如 果 你 …

Vue3.0和2.0语法不同分析

前言&#xff1a;本篇文章只做VUE3.0和VUE2.0语法上的不同分析&#xff0c;不做性能和源码架构等的分析。 一、VUE3.0和VUE2.0代码结构不同 VUE3.0代码实例 <template><div><span>count is {{ count }}</span><span>plusOne is {{ plusOne }}…

Games104现代游戏引擎笔记 面向数据编程与任务系统

Basics of Parallel Programming 并行编程的基础 核达到了上限&#xff0c;无法越做越快&#xff0c;只能通过更多的核来解决问题 Process 进程 有独立的存储单元&#xff0c;系统去管理&#xff0c;需要通过特殊机制去交换信息 Thread 线程 在进程之内&#xff0c;共享了内存…

Linux本地docker一键部署traefik+内网穿透工具实现远程访问Web UI管理界面

文章目录 前言1. Docker 部署 Trfɪk2. 本地访问traefik测试3. Linux 安装cpolar4. 配置Traefik公网访问地址5. 公网远程访问Traefik6. 固定Traefik公网地址 前言 Trfɪk 是一个云原生的新型的 HTTP 反向代理、负载均衡软件&#xff0c;能轻易的部署微服务。它支持多种后端 (D…

LabVIEW和NIUSRP硬件加快了认知无线电开发

LabVIEW和NIUSRP硬件加快了认知无线电开发 对于电视频谱&#xff0c;主用户传输有两种类型&#xff1a;广播电视和节目制作和特殊事件(PMSE)设备。广播塔的位置已知&#xff0c;且覆盖电视传输塔&#xff08;复用器&#xff09;附近的某个特定地理区域&#xff08;称为排除区域…

postgresql视图的一些问题

在postgresql中&#xff0c;如果创建视图后&#xff0c;需要修改基础表&#xff0c;会出现一些问题。 基础表和视图 postgres# create table cstech(age int, name varchar(10), class int); CREATE TABLE# 这里我们采用select * 来选择所有字段postgres# create view cs_v a…

AI绘画运行webui.sh报错如何解决

项目场景&#xff1a; Python AI 绘画&#xff0c;配置环境启动时报错 问题描述 Stable Diffusion web UI 配置时&#xff0c;运行./webui.sh报错 Could not find a version that satisfies the requirement torch2.0.1 (from versions: 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0,…

JS模块引入方式使用 importScripts 替代 import

sw.js文件如果放在public文件夹中运行报错,如提示 sw.js:2 Uncaught SyntaxError: Cannot use import statement outside a module 错误的话.// 使用 importScripts 替代 import// 使用 importScripts 替代 import importScripts(https://storage.googleapis.com/workbox-cdn/r…

进程管理(四)

管程概念及实现要旨 管程引入了条件变量condition。 wait操作,把当前进程挂到条件变量对应的阻塞队列上去,signal把条件队列上的对手进程唤醒。 注意:条件变量的signal操作和信号量的signal是有区别的。条件变量的signal可能啥都不干,如果有阻塞的进程唤醒,没有啥事都不做…

从零开始的C++(十八)

avl树中insert的模拟实现 avl树特点&#xff1a; 1.是搜索二叉树 2.每个结点的左右子树高度差的绝对值不超过2 inser模拟实现&#xff1a; // 右单旋void RotateR(Node* pParent){Node* parent pParent;Node* pr parent->_pRight;Node* prl pr->_pLeft;//记录父节点…

红海营销时代,内容占位的出海品牌更有机会营销占位

#01 品牌出海&#xff1a;内容占位就是品牌营销占位 红海营销时代&#xff0c;内容信息充斥着用户周边。无论线上还是线下&#xff0c;生活工作、休闲娱乐等不同场景内&#xff0c;广告信息均无孔不入。对于用户来说&#xff0c;能记住的品牌或者商品往往寥寥无几。 占位营销…

全网好评!12个网络工程师必备工具!

你们好&#xff0c;我的网工朋友。 今天来一期久违的工具推荐。工欲善其事必先利其器&#xff0c;好的工具势必会让网工们如虎添翼。 快速掌握正确的工具&#xff0c;意味着你可以轻松地完成复杂的工作。 但市面上的软件太多了&#xff0c;到底选用哪个工具&#xff0c;这还…

【最新Tomcat】IntelliJ IDEA通用配置Tomcat教程(超详细)

前言 IntelliJ IDEA是一个强大的集成开发环境&#xff0c;能够大大简化Java应用程序的开发和部署过程。而Tomcat作为一个流行的Java Web服务器&#xff0c;其与IntelliJ IDEA的整合能够提供便捷的开发环境&#xff0c;让开发人员更专注于代码的创作与优化。 在配置IntelliJ IDE…

linux在非联网、无网络环境下,使用yumdownload、reportrack方法安装rpm包

文章目录 前言1、下载yum-utils​​2、yumdownloader3、repotrack4、安装5、yumdownloader和repotrack的区别总结 前言 当开发者在联网环境下使用Linux时&#xff0c;可以轻松地通过yum或apt-get安装软件。然而&#xff0c;在公司和企业中&#xff0c;由于安全原因&#xff0c…

执行npm的时候报权限问题的解决方案

我们在执行npm操作的过程中&#xff0c;会出现以下权限问题&#xff0c;解决方案: 管理员身份 运行cmd 切换目录到要执行命令的文件下 再进行npm操作即可

java17 linux 环境配置

linux版本 :centos 8 1.能联网的情况下: wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz 2.mkdir /usr/local/java tar zxvf jdk-17_linux-x64_bin.tar.gz -C /usr/local/java 3./etc/profile增加: export JAVA_HOME/usr/local/java/jdk-17.…

社交媒体驱动的独立站流量增长:YouTube引流技巧

随着互联网的不断发展&#xff0c;视频内容在网上变得越来越受欢迎。YouTube作为世界上最大的视频分享平台之一&#xff0c;成为了吸引流量和观众的理想场所。对于跨境卖家来说&#xff0c;利用YouTube来增加独立站流量是一种有效的策略&#xff0c;可以增加知名度、吸引潜在客…

IDEA创建SpringBoot的多模块项目教程

最近在写一个多模块的SpringBoot项目&#xff0c;基于过程总了一些总结&#xff0c;故把SpringBoot多个模块的项目创建记录下来。 首先&#xff0c;先建立一个父工程&#xff1a; &#xff08;1&#xff09;在IDEA工具栏选择File->New->Project &#xff08;2&#xff0…

hypermesh学习总结(一)

1、hypermesh导入导出 2、hypermesh如何使用拓扑命令&#xff0c;连接多个几何体为一个&#xff1f; 3、hypermesh模式选择 分别有显示动力学模式explicit,标准模式Standard3D(静力学及模态等) 4、检查网格单元质量 5、基本平移旋转显示视角操作 6、更改网格划分最小…

二-内存模型及所有权和引用、借用

1. 内存模型1 内存模型&#xff0c;heap和stack的区别&#xff0c;GC方面和go的区别 基本同go一样&#xff0c;分为堆内存、栈内存。栈内存函数退出时会自动释放&#xff0c;大小有限&#xff0c;一般是比较“小”的变量存到栈上。 比较“大”的或者大小动态变化的会分配到堆上…