Redis 7.x 系列【22】主從復制配置項

有道無術,術尚可求,有術無道,止于術。

本系列Redis 版本 7.2.5

源碼地址:https://gitee.com/pearl-organization/study-redis-demo

文章目錄

    • 1. 前言
    • 2. 配置說明
      • 2.1 replicaof
      • 2.2 masterauth
      • 2.3 masteruser
      • 2.4 replica-serve-stale-data
      • 2.5 replica-read-only
      • 2.6 repl-diskless-sync
      • 2.7 repl-diskless-sync-delay
      • 2.8 repl-diskless-sync-max-replicas
      • 2.9 repl-diskless-load
      • 2.10 repl-ping-replica-period
      • 2.11 repl-timeout
      • 2.12 repl-disable-tcp-nodelay
      • 2.13 repl-backlog-size
      • 2.14 repl-backlog-ttl
      • 2.15 replica-priority
      • 2.16 propagation-error-behavior
      • 2.17 replica-ignore-disk-write-errors no
      • 2.18 replica-announced
      • 2.19 min-replicas-to-write、min-replicas-max-lag
      • 2.20 replica-announce-ip、replica-announce-port

1. 前言

redis.conf 配置文件中,提供了很多個主從復制的配置項(在從節點中配置):

################################# REPLICATION ################################## Master-Replica replication. Use replicaof to make a Redis instance a copy of
# another Redis server. A few things to understand ASAP about Redis replication.
#
#   +------------------+      +---------------+
#   |      Master      | ---> |    Replica    |
#   | (receive writes) |      |  (exact copy) |
#   +------------------+      +---------------+
#
# 1) Redis replication is asynchronous, but you can configure a master to
#    stop accepting writes if it appears to be not connected with at least
#    a given number of replicas.
# 2) Redis replicas are able to perform a partial resynchronization with the
#    master if the replication link is lost for a relatively small amount of
#    time. You may want to configure the replication backlog size (see the next
#    sections of this file) with a sensible value depending on your needs.
# 3) Replication is automatic and does not need user intervention. After a
#    network partition replicas automatically try to reconnect to masters
#    and resynchronize with them.
#
# replicaof <masterip> <masterport># If the master is password protected (using the "requirepass" configuration
# directive below) it is possible to tell the replica to authenticate before
# starting the replication synchronization process, otherwise the master will
# refuse the replica request.
#
# masterauth <master-password>
#
# However this is not enough if you are using Redis ACLs (for Redis version
# 6 or greater), and the default user is not capable of running the PSYNC
# command and/or other commands needed for replication. In this case it's
# better to configure a special user to use with replication, and specify the
# masteruser configuration as such:
#
# masteruser <username>
#
# When masteruser is specified, the replica will authenticate against its
# master using the new AUTH form: AUTH <username> <password>.# When a replica loses its connection with the master, or when the replication
# is still in progress, the replica can act in two different ways:
#
# 1) if replica-serve-stale-data is set to 'yes' (the default) the replica will
#    still reply to client requests, possibly with out of date data, or the
#    data set may just be empty if this is the first synchronization.
#
# 2) If replica-serve-stale-data is set to 'no' the replica will reply with error
#    "MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'"
#    to all data access commands, excluding commands such as:
#    INFO, REPLICAOF, AUTH, SHUTDOWN, REPLCONF, ROLE, CONFIG, SUBSCRIBE,
#    UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB, COMMAND, POST,
#    HOST and LATENCY.
#
replica-serve-stale-data yes# You can configure a replica instance to accept writes or not. Writing against
# a replica instance may be useful to store some ephemeral data (because data
# written on a replica will be easily deleted after resync with the master) but
# may also cause problems if clients are writing to it because of a
# misconfiguration.
#
# Since Redis 2.6 by default replicas are read-only.
#
# Note: read only replicas are not designed to be exposed to untrusted clients
# on the internet. It's just a protection layer against misuse of the instance.
# Still a read only replica exports by default all the administrative commands
# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
# security of read only replicas using 'rename-command' to shadow all the
# administrative / dangerous commands.
replica-read-only yes# Replication SYNC strategy: disk or socket.
#
# New replicas and reconnecting replicas that are not able to continue the
# replication process just receiving differences, need to do what is called a
# "full synchronization". An RDB file is transmitted from the master to the
# replicas.
#
# The transmission can happen in two different ways:
#
# 1) Disk-backed: The Redis master creates a new process that writes the RDB
#                 file on disk. Later the file is transferred by the parent
#                 process to the replicas incrementally.
# 2) Diskless: The Redis master creates a new process that directly writes the
#              RDB file to replica sockets, without touching the disk at all.
#
# With disk-backed replication, while the RDB file is generated, more replicas
# can be queued and served with the RDB file as soon as the current child
# producing the RDB file finishes its work. With diskless replication instead
# once the transfer starts, new replicas arriving will be queued and a new
# transfer will start when the current one terminates.
#
# When diskless replication is used, the master waits a configurable amount of
# time (in seconds) before starting the transfer in the hope that multiple
# replicas will arrive and the transfer can be parallelized.
#
# With slow disks and fast (large bandwidth) networks, diskless replication
# works better.
repl-diskless-sync yes# When diskless replication is enabled, it is possible to configure the delay
# the server waits in order to spawn the child that transfers the RDB via socket
# to the replicas.
#
# This is important since once the transfer starts, it is not possible to serve
# new replicas arriving, that will be queued for the next RDB transfer, so the
# server waits a delay in order to let more replicas arrive.
#
# The delay is specified in seconds, and by default is 5 seconds. To disable
# it entirely just set it to 0 seconds and the transfer will start ASAP.
repl-diskless-sync-delay 5# When diskless replication is enabled with a delay, it is possible to let
# the replication start before the maximum delay is reached if the maximum
# number of replicas expected have connected. Default of 0 means that the
# maximum is not defined and Redis will wait the full delay.
repl-diskless-sync-max-replicas 0# -----------------------------------------------------------------------------
# WARNING: Since in this setup the replica does not immediately store an RDB on
# disk, it may cause data loss during failovers. RDB diskless load + Redis
# modules not handling I/O reads may cause Redis to abort in case of I/O errors
# during the initial synchronization stage with the master.
# -----------------------------------------------------------------------------
#
# Replica can load the RDB it reads from the replication link directly from the
# socket, or store the RDB to a file and read that file after it was completely
# received from the master.
#
# In many cases the disk is slower than the network, and storing and loading
# the RDB file may increase replication time (and even increase the master's
# Copy on Write memory and replica buffers).
# However, when parsing the RDB file directly from the socket, in order to avoid
# data loss it's only safe to flush the current dataset when the new dataset is
# fully loaded in memory, resulting in higher memory usage.
# For this reason we have the following options:
#
# "disabled"    - Don't use diskless load (store the rdb file to the disk first)
# "swapdb"      - Keep current db contents in RAM while parsing the data directly
#                 from the socket. Replicas in this mode can keep serving current
#                 dataset while replication is in progress, except for cases where
#                 they can't recognize master as having a data set from same
#                 replication history.
#                 Note that this requires sufficient memory, if you don't have it,
#                 you risk an OOM kill.
# "on-empty-db" - Use diskless load only when current dataset is empty. This is 
#                 safer and avoid having old and new dataset loaded side by side
#                 during replication.
repl-diskless-load disabled# Master send PINGs to its replicas in a predefined interval. It's possible to
# change this interval with the repl_ping_replica_period option. The default
# value is 10 seconds.
#
# repl-ping-replica-period 10# The following option sets the replication timeout for:
#
# 1) Bulk transfer I/O during SYNC, from the point of view of replica.
# 2) Master timeout from the point of view of replicas (data, pings).
# 3) Replica timeout from the point of view of masters (REPLCONF ACK pings).
#
# It is important to make sure that this value is greater than the value
# specified for repl-ping-replica-period otherwise a timeout will be detected
# every time there is low traffic between the master and the replica. The default
# value is 60 seconds.
#
# repl-timeout 60# Disable TCP_NODELAY on the replica socket after SYNC?
#
# If you select "yes" Redis will use a smaller number of TCP packets and
# less bandwidth to send data to replicas. But this can add a delay for
# the data to appear on the replica side, up to 40 milliseconds with
# Linux kernels using a default configuration.
#
# If you select "no" the delay for data to appear on the replica side will
# be reduced but more bandwidth will be used for replication.
#
# By default we optimize for low latency, but in very high traffic conditions
# or when the master and replicas are many hops away, turning this to "yes" may
# be a good idea.
repl-disable-tcp-nodelay no# Set the replication backlog size. The backlog is a buffer that accumulates
# replica data when replicas are disconnected for some time, so that when a
# replica wants to reconnect again, often a full resync is not needed, but a
# partial resync is enough, just passing the portion of data the replica
# missed while disconnected.
#
# The bigger the replication backlog, the longer the replica can endure the
# disconnect and later be able to perform a partial resynchronization.
#
# The backlog is only allocated if there is at least one replica connected.
#
# repl-backlog-size 1mb# After a master has no connected replicas for some time, the backlog will be
# freed. The following option configures the amount of seconds that need to
# elapse, starting from the time the last replica disconnected, for the backlog
# buffer to be freed.
#
# Note that replicas never free the backlog for timeout, since they may be
# promoted to masters later, and should be able to correctly "partially
# resynchronize" with other replicas: hence they should always accumulate backlog.
#
# A value of 0 means to never release the backlog.
#
# repl-backlog-ttl 3600# The replica priority is an integer number published by Redis in the INFO
# output. It is used by Redis Sentinel in order to select a replica to promote
# into a master if the master is no longer working correctly.
#
# A replica with a low priority number is considered better for promotion, so
# for instance if there are three replicas with priority 10, 100, 25 Sentinel
# will pick the one with priority 10, that is the lowest.
#
# However a special priority of 0 marks the replica as not able to perform the
# role of master, so a replica with priority of 0 will never be selected by
# Redis Sentinel for promotion.
#
# By default the priority is 100.
replica-priority 100# The propagation error behavior controls how Redis will behave when it is
# unable to handle a command being processed in the replication stream from a master
# or processed while reading from an AOF file. Errors that occur during propagation
# are unexpected, and can cause data inconsistency. However, there are edge cases
# in earlier versions of Redis where it was possible for the server to replicate or persist
# commands that would fail on future versions. For this reason the default behavior
# is to ignore such errors and continue processing commands.
#
# If an application wants to ensure there is no data divergence, this configuration
# should be set to 'panic' instead. The value can also be set to 'panic-on-replicas'
# to only panic when a replica encounters an error on the replication stream. One of
# these two panic values will become the default value in the future once there are
# sufficient safety mechanisms in place to prevent false positive crashes.
#
# propagation-error-behavior ignore# Replica ignore disk write errors controls the behavior of a replica when it is
# unable to persist a write command received from its master to disk. By default,
# this configuration is set to 'no' and will crash the replica in this condition.
# It is not recommended to change this default, however in order to be compatible
# with older versions of Redis this config can be toggled to 'yes' which will just
# log a warning and execute the write command it got from the master.
#
# replica-ignore-disk-write-errors no# -----------------------------------------------------------------------------
# By default, Redis Sentinel includes all replicas in its reports. A replica
# can be excluded from Redis Sentinel's announcements. An unannounced replica
# will be ignored by the 'sentinel replicas <master>' command and won't be
# exposed to Redis Sentinel's clients.
#
# This option does not change the behavior of replica-priority. Even with
# replica-announced set to 'no', the replica can be promoted to master. To
# prevent this behavior, set replica-priority to 0.
#
# replica-announced yes# It is possible for a master to stop accepting writes if there are less than
# N replicas connected, having a lag less or equal than M seconds.
#
# The N replicas need to be in "online" state.
#
# The lag in seconds, that must be <= the specified value, is calculated from
# the last ping received from the replica, that is usually sent every second.
#
# This option does not GUARANTEE that N replicas will accept the write, but
# will limit the window of exposure for lost writes in case not enough replicas
# are available, to the specified number of seconds.
#
# For example to require at least 3 replicas with a lag <= 10 seconds use:
#
# min-replicas-to-write 3
# min-replicas-max-lag 10
#
# Setting one or the other to 0 disables the feature.
#
# By default min-replicas-to-write is set to 0 (feature disabled) and
# min-replicas-max-lag is set to 10.# A Redis master is able to list the address and port of the attached
# replicas in different ways. For example the "INFO replication" section
# offers this information, which is used, among other tools, by
# Redis Sentinel in order to discover replica instances.
# Another place where this info is available is in the output of the
# "ROLE" command of a master.
#
# The listed IP address and port normally reported by a replica is
# obtained in the following way:
#
#   IP: The address is auto detected by checking the peer address
#   of the socket used by the replica to connect with the master.
#
#   Port: The port is communicated by the replica during the replication
#   handshake, and is normally the port that the replica is using to
#   listen for connections.
#
# However when port forwarding or Network Address Translation (NAT) is
# used, the replica may actually be reachable via different IP and port
# pairs. The following two options can be used by a replica in order to
# report to its master a specific set of IP and port, so that both INFO
# and ROLE will report those values.
#
# There is no need to use both the options if you need to override just
# the port or the IP address.
#
# replica-announce-ip 5.5.5.5
# replica-announce-port 1234

2. 配置說明

2.1 replicaof

replicaof 參數用于在從節點中配置主節點的IP、端口:

# replicaof <masterip> <masterport>

2.2 masterauth

masterauth 參數用于配置主節點的密碼,如果主節點設置了密碼保護,可以在開始復制同步過程之前告知從節點進行身份驗證,否則主節點將拒絕從節點的請求。

# masterauth <master-password>

2.3 masteruser

masteruser 參數用于配置主節點的用戶名,Redis ACL(適用于 Redis 6 或更高版本)中,可以配置一個專用用戶用于復制:

# masteruser <username>

2.4 replica-serve-stale-data

replica-serve-stale-data 用于配置從節點與主節點失去連接,或者正在進行時,從節點如何響應客戶端的讀請求。

replica-serve-stale-data yes

設置為 yes(默認)時,從節點仍然會響應客戶端請求,可能會返回過期的數據,如果是第一次同步,則數據集可能為空。

設置為 no 時,當主節點連接中斷,從節點將對所有訪問命令回復錯誤消息:“MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'”。INFOREPLICAOFAUTHSHUTDOWNREPLCONFROLECONFIGSUBSCRIBEUNSUBSCRIBEPSUBSCRIBEPUNSUBSCRIBEPUBLISHPUBSUBCOMMANDPOST、HOSTLATENCY 等命令除外。

2.5 replica-read-only

replica-read-only 用于設置從節點是否允許進行寫操作。

replica-read-only yes

設置為 yes(默認)時,從節點是只讀的,即不允許客戶端發送寫命令。這是為了避免從節點上的數據和主節點的數據發生沖突,確保數據一致性和主從復制的正確性。

設置為 no 時,從節點將允許接受客戶端發送的寫命令。這種設置一般用于特殊需求或者特定場景下,例如需要在從節點執行某些數據修改操作。

2.6 repl-diskless-sync

repl-diskless-sync 用于配置在全量復制時,是否使用無盤復制。

repl-diskless-sync yes

設置為 yes(默認)時,表示使用無盤復制模式,主節點在生成 RDB 快照后,不會立即將其寫入磁盤,而是直接將其內容通過網絡發送給從節點。這樣,就避免了磁盤 I/O 的開銷,從而提高了復制的效率。但是由于 RDB 快照內容保存在內存中,可能會增加主節點的內存壓力。

設置為 no 時,主節點在生成 RDB 快照,并將其寫入磁盤。然后,主節點會將這個 RDB 文件發送給從節點。這個過程中,磁盤 I/O 可能會成為了性能瓶頸之一。

2.7 repl-diskless-sync-delay

repl-diskless-sync-delay 用于配置在無盤復制過程中,主節點在開始實際傳輸 RDB 數據之前需要等待的時間。延遲的目的是希望在這段時間內,更多的從節點能夠連接到主節點,以便主節點可以并行地將 RDB 數據發送給這些從節點,從而提高復制的效率。

repl-diskless-sync-delay 5

延遲以秒為單位指定,默認為5秒。要完全禁用延遲,只需將其設置為0秒,傳輸將盡快開始。

2.8 repl-diskless-sync-max-replicas

repl-diskless-sync-max-replicas 用于配置在無盤復制過程中,如果已連接的從節點達到預期的最大數量,可以在達到最大延遲(repl-diskless-sync-delay)之前開始復制。

repl-diskless-sync-max-replicas 0

默認值為0意味著最大值未定義,Redis會等待完整的延遲時間。

2.9 repl-diskless-load

repl-diskless-load 用于配置在無盤復制過程中,從節點在接收到 RDB 數據時的處理方式。

repl-diskless-load disabled

支持的配置項:

  • disabled:默認值,從節點在接收到 RDB 數據時,不會立即加載到內存中,而是會先將數據寫入磁盤,然后再從磁盤中加載到內存中。這種方式更加保守,可以確保數據的持久性和安全性,但在某些情況下可能會增加磁盤 I/O 的開銷。
  • on-empty-db:當從節點的數據庫為空時,才直接從內存中加載 RDB 數據,而不是先寫入磁盤。這種方式可以在一定程度上減少磁盤 I/O,但在從節點已經包含數據的情況下仍然會先寫入磁盤。這是更安全的方式,避免在復制過程中同時加載舊數據集和新數據集。
  • swapdb:從節點在接收到 RDB 數據時,在內存中先創建一個數據庫的拷貝,然后將接收到的 RDB 數據解析并加載到這個拷貝中。如果解析成功,則替換掉原有的數據庫;如果失敗,則恢復原有的數據庫。注意,這需要足夠的內存,如果內存不足,可能會面臨OOM(內存耗盡)風險。

2.10 repl-ping-replica-period

repl-ping-replica-period 用于配置主節點向其從節點發送PING命令的時間間隔,默認值為 10 秒。

# repl-ping-replica-period 10

2.11 repl-timeout

repl-ping-replica-period 用于配置主從節點之間在復制過程中的超時時間,默認值為60秒。

# repl-timeout 60

在復制的過程中,如果超過了時間,主從節點之間還沒有任何數據交換,則認為復制連接可能出現問題。此時會采取一些措施來嘗試恢復復制連接,如關閉當前的復制連接并嘗試重新建立連接。

從主節點角度來說,在 repl-timeout 時間內,沒有收到從節點發送的 REPLCONF ACK 確認信息,則認定超時。

從節點角度來說,在 repl-timeout 時間內,沒有收到主節點發送 RDB 快照數據、PING命令,則認定超時。

2.12 repl-disable-tcp-nodelay

repl-disable-tcp-nodelay用于配置在主從節點同步后,是否禁用 TCP_NODELAY

repl-disable-tcp-nodelay no

TCP_NODELAYTCP/IP 協議棧中的一個套接字選項,用于控制 TCP 連接的 Nagle 算法。Nagle 算法是一種旨在減少網絡擁塞的算法,它通過合并小的 TCP 數據包成更大的數據包來發送,從而減少網絡上的小數據包數量,但可能會增加數據的延遲。

設置為 no 時(默認),Redis 會立即發送同步數據,沒有延遲。這樣做可以確保數據的一致性,但可能會增加網絡帶寬的消耗。

設置為 yes 時,Redis 會合并小的 TCP 數據包,從而節省帶寬,但這樣做會增加數據同步的延遲,可能會達到 40 毫秒或更多。這可能會導致主從節點之間的數據在短時間內出現不一致的情況。

2.13 repl-backlog-size

repl-backlog-size 用于配置復制積壓緩沖區(repl_backlog_buffer)的大小,默認為 1MB

epl-backlog-size 1mb

2.14 repl-backlog-ttl

repl-backlog-ttl 用于配置復制積壓緩沖區中數據的存活時長,默認為3600 秒,為0表示永久存活。

# repl-backlog-ttl 3600

改配置確保了即使從節點長時間離線,只要在這個時間范圍內重新連接,就有可能通過部分同步來恢復數據一致性。

2.15 replica-priority

replica-priority 用于配置在主節點故障時,從節點將被選為新的主節點的優先級(哨兵模式)。

replica-priority 100

默認情況下,優先級為100。值越小,表示優先級越高。例如,如果有三個副本的優先級分別為1010025,哨兵模式會選擇優先級為10的節點。優先級為 0 表示用不會被升級為主節點。

2.16 propagation-error-behavior

propagation-error-behavior 用于配置在命令傳播過程中,發生錯誤的處理方式。

# propagation-error-behavior ignore

命令傳播過程中發生錯誤,可能會導致數據不一致性,默認是忽略此類錯誤并繼續處理命令。

2.17 replica-ignore-disk-write-errors no

replica-ignore-disk-write-errors 用于配置從節點在遇到磁盤寫入錯誤時的處理方式。

# replica-ignore-disk-write-errors no

可選配置項:

  • no:這是默認值,表示從節點不會忽略磁盤寫入錯誤。如果發生磁盤寫入錯誤,從節點將停止處理數據復制,將會停止接收數據并報告錯誤給客戶端和或日志系統。因為它無法可靠地保證數據的一致性。這有助于防止數據損壞,但也可能導致服務中斷。

2.18 replica-announced

replica-announced 用于配置從節點是否應該被Sentinel公告或暴露給Sentinel的客戶端。

# replica-announced yes

在哨兵模式中,默認情況下,所有的從節點都會被包含在 Sentinel 的公告中。可以配置 Sentinel 忽略某些從節點,這種未公告的從節點會被 sentinel replicas <master> 命令忽略,并且不會被暴露給 Redis Sentinel 的客戶端。

此配置不會改變優先級的行為。即使將 replica-announced 設置為 ‘no’,該節點仍然可以被提升為主節點。

2.19 min-replicas-to-write、min-replicas-max-lag

min-replicas-to-writemin-replicas-max-lag 用于配置在連接的從節點數量少于 N 個,并且這些從節點的延遲時間不超過 M 秒的情況下停止接受寫操作。

例如,要求至少有 3 個從節點,且延遲時間不超過 10 秒,可以使用以下配置:

min-replicas-to-write 3  
min-replicas-max-lag 10

將其中一個或兩個值設置為 0 可以禁用此功能。默認情況下,min-replicas-to-write 被設置為 0(功能禁用),而 min-replicas-max-lag 被設置為 10

2.20 replica-announce-ip、replica-announce-port

replica-announce-ipreplica-announce-port 允許從節點在連接到主節點時,宣布一個與自身實際 IP 地址和端口不同的 IP 地址和端口。這在某些特定的網絡配置或部署場景中非常有用,比如當從節點位于 NAT 后面或使用了容器/虛擬化技術時。

# replica-announce-ip 5.5.5.5
# replica-announce-port 1234

從節點需要上報自己的地址信息給主節點,當使用端口轉發或網絡地址轉換(NAT),或者使用了容器/虛擬化技術時, IP 地址和端口信息可能不正確,可以使用以上配置進行指定。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/42832.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/42832.shtml
英文地址,請注明出處:http://en.pswp.cn/web/42832.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Linux udp編程

我最近開了幾個專欄&#xff0c;誠信互三&#xff01; > |||《算法專欄》&#xff1a;&#xff1a;刷題教程來自網站《代碼隨想錄》。||| > |||《C專欄》&#xff1a;&#xff1a;記錄我學習C的經歷&#xff0c;看完你一定會有收獲。||| > |||《Linux專欄》&#xff1…

Go中gin框架的*gin.Context參數常見實用方法

梗概&#xff1a; *gin.Context是處理HTTP請求的核心。ctx代表"context"&#xff08;上下文&#xff09;&#xff0c;它包含了處理請求所需的所有信息和方法&#xff0c;例如請求數據、響應構建器、路由參數等。 基本的格式&#xff1a; func SomeHandler(ctx *gi…

空間計量模型及 Stata 具體操作步驟

目錄 一、引言 二、空間計量模型理論原理 空間自回歸模型&#xff08;SAR&#xff09;&#xff1a; 空間誤差模型&#xff08;SEM&#xff09;&#xff1a;&#xff0c; 空間杜賓模型&#xff08;SDM&#xff09;&#xff1a; 三、實證模型構建 四、數據準備 五、Stata …

14-56 劍和詩人30 - IaC、PaC 和 OaC 在云成功中的作用

介紹 隨著各大企業在 2024 年加速采用云計算&#xff0c;基礎設施即代碼 (IaC)、策略即代碼 (PaC) 和優化即代碼 (OaC) 已成為成功實現云遷移、IT 現代化和業務轉型的關鍵功能。 讓我在云計劃的背景下全面了解這些代碼功能的當前狀態。我們將研究現代云基礎設施趨勢、IaC、Pa…

【電路筆記】-C類放大器

C類放大器 文章目錄 C類放大器1、概述2、C類放大介紹3、C類放大器的功能4、C 類放大器的效率5、C類放大器的應用:倍頻器6、總結1、概述 盡管存在差異,但我們在之前有關 A 類、B 類和 AB 類放大器的文章中已經看到,這三類放大器是線性或部分線性的,因為它們在放大過程中再現…

Collection 和 Collections 的區別與用法

Collection 和 Collections 的區別與用法 1、Collection 接口1.1 主要特點1.2 常見方法 2、 Collections 工具類2.1 主要特點2.2 常見方法 3、示例代碼3.1 使用 Collection 接口3.2 使用 Collections 工具類 4、總結 &#x1f496;The Begin&#x1f496;點點關注&#xff0c;收…

STM32學習歷程(day6)

EXTI外部中斷使用教程 首先先看下EXTI的框圖 看這個框圖就能知道要先初始化GPIO外設 那么和前面一樣 1、先RCC使能時鐘 2、配置GPIO 選擇端口為輸入模式&#xff0c; 3、配置AFIO&#xff0c;選擇我們用的GPIO連接到后面的EXTI 4、配置EXTI&#xff0c;選擇邊沿觸發方式…

LVS實驗

LVS實驗 nginx1 RS1 192.168.11.137 nginx2 RS2 192.168.11.138 test4 調度器 ens33 192.168.11.135 ens36 12.0.0.1 test2 客戶端 12.0.0.10 一、test4 配置兩張網卡地址信息 [roottest4 network-scripts]# cat ifcfg-ens33 TYPEEthernet BOOTPROTOstatic DEFROUTEyes DEVIC…

詳解平面DP(上)

前言 其實平面DP和正常的dp沒有什么本質上的區別&#xff0c;只不過是在二維的面上進行DP&#xff0c;而且&#xff0c;客觀的說&#xff0c;其實和遞推沒有什么區別&#xff0c;不要把他想的太難了 講解 本蒻雞思前想后&#xff0c;好像關于平面DP的理論知識好像沒有什么&a…

前后端分離系統

前后端分離是一種現代軟件架構模式&#xff0c;特別適用于Web應用開發&#xff0c;它強調將用戶界面&#xff08;前端&#xff09;與服務器端應用邏輯&#xff08;后端&#xff09;相分離。兩者通過API接口進行數據交互。這種架構模式的主要優勢在于提高開發效率、維護性和可擴…

Git命令常規操作

目錄 常用操作示意圖 文件的狀態變化周期 1. 創建文件 2. 修改原有文件 3. 刪除原有文件 沒有添加到暫存區的數據直接 rm 刪除即可&#xff1a; 對于添加到暫存區的數據 文件或目錄&#xff1a; 4. 重命名暫存區數據 5. 查看歷史記錄 6. 還原歷史數據 恢復過程的原…

最新深度技術Win7精簡版系統:免費下載!

在Win7電腦操作中&#xff0c;用戶想要給電腦安裝上深度技術Win7精簡版系統&#xff0c;但不知道去哪里才能找到該系統版本&#xff1f;接下來系統之家小編給大家帶來了深度技術Win7系統精簡版本的下載地址&#xff0c;方便大家點擊下載安裝。系統安裝步驟已簡化&#xff0c;新…

定位和分析解決std::thread創建失敗的問題和解決方法(mmap虛擬地址耗盡)

文章目錄 引言問題描述和分析監控shell腳本shell腳本解釋 問題根源追溯解決方案一&#xff1a;增大mmap區域解決方案二&#xff1a;優化線程棧空間解決方案三&#xff1a;引入線程池參考文章 引言 在高并發和長周期運行的環境中&#xff0c;頻繁創建std::thread線程可能導致mm…

設計模式8-橋模式

設計模式8-Bridge 橋模式 由來與目的模式定義結構代碼推導1. 類和接口的定義2. 平臺實現3. 業務抽象4. 使用示例總結1. 類數量過多&#xff0c;復雜度高2. 代碼重復3. 不符合單一職責原則4. 缺乏擴展性改進后的設計1. 抽象和實現分離&#xff08;橋接模式&#xff09;2. 抽象類…

學習XDMA—20240709

概覽&#xff1a; 在內部&#xff0c;子系統可以配置為實現多達8個獨立的物理DMA引擎(最多4個H2C和4個C2H)。這些DMA引擎可以映射到單獨的AXI4Stream接口&#xff0c;也可以將共享的AXI4內存映射(MM)接口映射到用戶應用程序。在axis4 MM接口上&#xff0c;PCI Express的DMA/橋接…

智能警衛:Conda包依賴的自動監控之道

智能警衛&#xff1a;Conda包依賴的自動監控之道 引言 在復雜的軟件開發項目中&#xff0c;依賴管理是確保項目健康運行的關鍵環節。Conda作為Python和其他科學計算語言的強大包管理器&#xff0c;提供了依賴監控功能&#xff0c;幫助用戶自動化和簡化依賴項的監控過程。本文…

軟考高級第四版備考--第15天(建設團隊)Develop Team

定義&#xff1a;提高工作能力&#xff0c;促進團隊成員互動&#xff0c;改善團隊整體氛圍以提高項目績效的過程 作用&#xff1a;改進團隊協作、增強人際關系技能、激勵員工、減少摩擦以提升整體項目績效 說明&#xff1a;高效團隊行為&#xff1a; 使用開放與有效的溝通&a…

簡述 JS 中對象的創建和拷貝

在 JavaScript 中&#xff0c;對象是一種非常重要且靈活的數據結構&#xff0c;用于存儲多個值&#xff08;屬性&#xff09;和方法&#xff08;函數&#xff09; 對象的創建和拷貝是日常開發中經常涉及的操作&#xff0c;對于業務邏輯的準確實現有著重要的作用 本文將簡要概…

linux查看目錄下的文件夾命令,find 查找某個目錄,但是不包括這個目錄本身?

linux查看目錄下的文件夾命令&#xff0c;find 查找某個目錄&#xff0c;但是不包括這個目錄本身&#xff1f; Linux中查看目錄下的文件夾的命令是使用ls命令。ls命令用于列出指定目錄中的文件和文件夾。通過不同的選項可以實現顯示詳細信息、按照不同的排序方式以及使用不同的…

Profibus轉ModbusTCP網關模塊實現Profibus_DP向ModbusTCP轉換

Profibus和ModbusTCP是工業控制自動化常用的二種通信協議。Profibus是一種串口通信協議&#xff0c;它提供了迅速靠譜的數據傳輸和各種拓撲結構&#xff0c;如總線和星型構造。Profibus可以和感應器、執行器、PLC等各類設備進行通信。 ModbusTCP是一種基于TCP/IP協議的通信協議…